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 // Tests for Future.immediate | 5 // Tests for Future.immediate |
6 | 6 |
7 testImmediate() { | 7 testImmediate() { |
8 final future = new Future<String>.immediate("42"); | 8 final future = new Future<String>.immediate("42"); |
9 Expect.isTrue(future.isComplete); | 9 Expect.isTrue(future.isComplete); |
10 Expect.isTrue(future.hasValue); | 10 Expect.isTrue(future.hasValue); |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 Expect.throws(() { future.then((e) { }); }); | 302 Expect.throws(() { future.then((e) { }); }); |
303 Expect.equals(ex, ex2); | 303 Expect.equals(ex, ex2); |
304 } | 304 } |
305 | 305 |
306 // Tests for accessing the exception call stack. | 306 // Tests for accessing the exception call stack. |
307 | 307 |
308 testCallStackThrowsIfNotComplete() { | 308 testCallStackThrowsIfNotComplete() { |
309 var exception; | 309 var exception; |
310 try { | 310 try { |
311 new Completer().future.stackTrace; | 311 new Completer().future.stackTrace; |
312 } catch (var ex) { | 312 } catch (ex) { |
313 exception = ex; | 313 exception = ex; |
314 } | 314 } |
315 | 315 |
316 Expect.isTrue(exception is FutureNotCompleteException); | 316 Expect.isTrue(exception is FutureNotCompleteException); |
317 } | 317 } |
318 | 318 |
319 testCallStackIsNullIfCompletedSuccessfully() { | 319 testCallStackIsNullIfCompletedSuccessfully() { |
320 Expect.isNull(new Future.immediate('blah').stackTrace); | 320 Expect.isNull(new Future.immediate('blah').stackTrace); |
321 } | 321 } |
322 | 322 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 testExceptionWithCompletionAndSuccessHandlers(); | 527 testExceptionWithCompletionAndSuccessHandlers(); |
528 testExceptionWithCompletionAndSuccessAndExceptionHandlers(); | 528 testExceptionWithCompletionAndSuccessAndExceptionHandlers(); |
529 testTransformSuccess(); | 529 testTransformSuccess(); |
530 testTransformFutureFails(); | 530 testTransformFutureFails(); |
531 testTransformTransformerFails(); | 531 testTransformTransformerFails(); |
532 testChainSuccess(); | 532 testChainSuccess(); |
533 testChainFirstFutureFails(); | 533 testChainFirstFutureFails(); |
534 testChainTransformerFails(); | 534 testChainTransformerFails(); |
535 testChainSecondFutureFails(); | 535 testChainSecondFutureFails(); |
536 } | 536 } |
OLD | NEW |