| 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 part of matcher; |
| 6 |
| 5 /** | 7 /** |
| 6 * Matches a [Future] that completes successfully with a value. Note that this | 8 * Matches a [Future] that completes successfully with a value. Note that this |
| 7 * creates an asynchronous expectation. The call to `expect()` that includes | 9 * creates an asynchronous expectation. The call to `expect()` that includes |
| 8 * this will return immediately and execution will continue. Later, when the | 10 * this will return immediately and execution will continue. Later, when the |
| 9 * future completes, the actual expectation will run. | 11 * future completes, the actual expectation will run. |
| 10 * | 12 * |
| 11 * To test that a Future completes with an exception, you can use [throws] and | 13 * To test that a Future completes with an exception, you can use [throws] and |
| 12 * [throwsA]. | 14 * [throwsA]. |
| 13 */ | 15 */ |
| 14 | |
| 15 part of matcher; | |
| 16 | |
| 17 Matcher completes = const _Completes(null); | 16 Matcher completes = const _Completes(null); |
| 18 | 17 |
| 19 /** | 18 /** |
| 20 * Matches a [Future] that completes succesfully with a value that matches | 19 * Matches a [Future] that completes succesfully with a value that matches |
| 21 * [matcher]. Note that this creates an asynchronous expectation. The call to | 20 * [matcher]. Note that this creates an asynchronous expectation. The call to |
| 22 * `expect()` that includes this will return immediately and execution will | 21 * `expect()` that includes this will return immediately and execution will |
| 23 * continue. Later, when the future completes, the actual expectation will run. | 22 * continue. Later, when the future completes, the actual expectation will run. |
| 24 * | 23 * |
| 25 * To test that a Future completes with an exception, you can use [throws] and | 24 * To test that a Future completes with an exception, you can use [throws] and |
| 26 * [throwsA]. | 25 * [throwsA]. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 54 | 53 |
| 55 Description describe(Description description) { | 54 Description describe(Description description) { |
| 56 if (_matcher == null) { | 55 if (_matcher == null) { |
| 57 description.add('completes successfully'); | 56 description.add('completes successfully'); |
| 58 } else { | 57 } else { |
| 59 description.add('completes to a value that ').addDescriptionOf(_matcher); | 58 description.add('completes to a value that ').addDescriptionOf(_matcher); |
| 60 } | 59 } |
| 61 return description; | 60 return description; |
| 62 } | 61 } |
| 63 } | 62 } |
| OLD | NEW |