OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library test_utils; | 5 library test_utils; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:scheduled_test/scheduled_test.dart'; | 9 import 'package:scheduled_test/scheduled_test.dart'; |
10 import 'package:scheduled_test/src/utils.dart'; | |
11 import 'package:test/test.dart' as test_pkg; | 10 import 'package:test/test.dart' as test_pkg; |
12 | 11 |
13 import 'package:metatest/metatest.dart'; | 12 import 'package:metatest/metatest.dart'; |
14 | 13 |
15 export 'package:scheduled_test/src/utils.dart'; | 14 export 'package:scheduled_test/src/utils.dart'; |
16 | 15 |
17 import 'mock_clock.dart'; | 16 import 'mock_clock.dart'; |
18 | 17 |
19 /// A matcher that validates whether an object is a [TestFailure]. | 18 /// A matcher that validates whether an object is a [TestFailure]. |
20 final isTestFailure = new isInstanceOf<TestFailure>(); | 19 final isTestFailure = new isInstanceOf<TestFailure>(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 65 |
67 /// Like [expectTestFails], but expects there to be only a single error and | 66 /// Like [expectTestFails], but expects there to be only a single error and |
68 /// unwraps that error before passing it to [validator]. | 67 /// unwraps that error before passing it to [validator]. |
69 void expectTestFailure(String description, Future testBody(), | 68 void expectTestFailure(String description, Future testBody(), |
70 void validator(error)) { | 69 void validator(error)) { |
71 expectTestFails(description, testBody, (errors) { | 70 expectTestFails(description, testBody, (errors) { |
72 expect(errors, hasLength(1)); | 71 expect(errors, hasLength(1)); |
73 validator(errors.single.error); | 72 validator(errors.single.error); |
74 }); | 73 }); |
75 } | 74 } |
OLD | NEW |