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