Chromium Code Reviews| Index: lib/unittest.dart |
| diff --git a/lib/unittest.dart b/lib/unittest.dart |
| index 791f0f553d5195ec1f6065fc913618955cdd2dc1..08b59a83626c0482335711fb800bb86c63cad239 100644 |
| --- a/lib/unittest.dart |
| +++ b/lib/unittest.dart |
| @@ -6,22 +6,43 @@ library unittest; |
| import 'dart:async'; |
| import 'dart:collection'; |
| -import 'dart:isolate'; |
| - |
| -import 'package:matcher/matcher.dart' |
| - show |
| - DefaultFailureHandler, |
| - configureExpectFailureHandler, |
| - TestFailure, |
| - wrapAsync; |
| -export 'package:matcher/matcher.dart'; |
| +import 'src/configuration.dart'; |
| +import 'src/expect.dart'; |
| import 'src/utils.dart'; |
| -import 'src/configuration.dart'; |
| +export 'package:matcher/matcher.dart' |
| + hide |
| + completes, |
| + completion, |
| + ErrorFormatter, |
| + expect, |
| + fail, |
| + prints, |
| + TestFailure, |
| + Throws, |
| + throws, |
| + throwsA, |
| + throwsArgumentError, |
| + throwsConcurrentModificationError, |
| + throwsCyclicInitializationError, |
| + throwsException, |
| + throwsFormatException, |
| + throwsNoSuchMethodError, |
| + throwsNullThrownError, |
| + throwsRangeError, |
| + throwsStateError, |
| + throwsUnimplementedError, |
| + throwsUnsupportedError; |
| + |
| export 'src/configuration.dart'; |
| +export 'src/expect.dart'; |
| +export 'src/simple_configuration.dart'; |
| +export 'src/future_matchers.dart'; |
| +export 'src/prints_matcher.dart'; |
| +export 'src/throws_matcher.dart'; |
| +export 'src/throws_matchers.dart'; |
| -part 'src/simple_configuration.dart'; |
| part 'src/group_context.dart'; |
| part 'src/spread_args_helper.dart'; |
| part 'src/test_case.dart'; |
| @@ -410,8 +431,6 @@ void _ensureInitialized(bool configAutoStart) { |
| return; |
| } |
| _environment.initialized = true; |
| - // Hook our async guard into the matcher library. |
| - wrapAsync = (f, [id]) => expectAsync(f, id: id); |
| _environment.uncaughtErrorMessage = null; |
| @@ -480,3 +499,14 @@ dynamic withTestEnvironment(callback()) { |
| return runZoned(callback, |
| zoneValues: {_UNITTEST_ENVIRONMENT: new _TestEnvironment()}); |
| } |
| + |
| +/// This Function is used by certain Matchers to catch certain exceptions. |
|
nweiz
2015/01/26 22:44:10
"Function" -> "function"
kevmoo
2015/01/27 00:11:30
Done.
|
| +/// |
| +/// Some matchers, like those for Futures and exception testing, |
| +/// can fail in asynchronous sections, and throw exceptions. |
| +/// A user of this library will typically want to catch and handle |
| +/// such exceptions. The [wrapAsync] property is a function that |
| +/// can wrap callbacks used by these Matchers so that they can be |
| +/// used safely. For example, the unittest library will set this |
| +/// to be `expectAsync`. By default this is an identity function. |
| +Function wrapAsync = (Function f, [id]) => f; |
|
nweiz
2015/01/26 22:44:10
Since this is now defined in unittest, why doesn't
kevmoo
2015/01/27 00:11:30
Done.
|