OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 matcher.future_matchers; | 5 library matcher.future_matchers; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'core_matchers.dart'; | |
10 import 'expect.dart'; | 9 import 'expect.dart'; |
11 import 'interfaces.dart'; | 10 import 'interfaces.dart'; |
| 11 import 'util.dart'; |
12 | 12 |
13 /// Matches a [Future] that completes successfully with a value. Note that this | 13 /// Matches a [Future] that completes successfully with a value. Note that this |
14 /// creates an asynchronous expectation. The call to `expect()` that includes | 14 /// creates an asynchronous expectation. The call to `expect()` that includes |
15 /// this will return immediately and execution will continue. Later, when the | 15 /// this will return immediately and execution will continue. Later, when the |
16 /// future completes, the actual expectation will run. | 16 /// future completes, the actual expectation will run. |
17 /// | 17 /// |
18 /// To test that a Future completes with an exception, you can use [throws] and | 18 /// To test that a Future completes with an exception, you can use [throws] and |
19 /// [throwsA]. | 19 /// [throwsA]. |
20 final Matcher completes = const _Completes(null, ''); | 20 final Matcher completes = const _Completes(null, ''); |
21 | 21 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 Description describe(Description description) { | 62 Description describe(Description description) { |
63 if (_matcher == null) { | 63 if (_matcher == null) { |
64 description.add('completes successfully'); | 64 description.add('completes successfully'); |
65 } else { | 65 } else { |
66 description.add('completes to a value that ').addDescriptionOf(_matcher); | 66 description.add('completes to a value that ').addDescriptionOf(_matcher); |
67 } | 67 } |
68 return description; | 68 return description; |
69 } | 69 } |
70 } | 70 } |
OLD | NEW |