| 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 future_test; | 5 library future_test; |
| 6 | 6 |
| 7 import 'package:async_helper/async_helper.dart'; | 7 import 'package:async_helper/async_helper.dart'; |
| 8 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
| 9 import 'dart:async'; | 9 import 'dart:async'; |
| 10 | 10 |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 asyncStart(); | 610 asyncStart(); |
| 611 | 611 |
| 612 future.then((v) => new Future.error("Fehler")) | 612 future.then((v) => new Future.error("Fehler")) |
| 613 .then((v) { Expect.fail("unreachable!"); }, onError: (error) { | 613 .then((v) { Expect.fail("unreachable!"); }, onError: (error) { |
| 614 Expect.equals("Fehler", error); | 614 Expect.equals("Fehler", error); |
| 615 asyncEnd(); | 615 asyncEnd(); |
| 616 }); | 616 }); |
| 617 completer.complete(21); | 617 completer.complete(21); |
| 618 } | 618 } |
| 619 | 619 |
| 620 void testSyncFuture_i13368() { |
| 621 asyncStart(); |
| 622 |
| 623 final future = new Future<int>.sync(() { |
| 624 return new Future<int>.value(42); |
| 625 }); |
| 626 |
| 627 future.then((int val) { |
| 628 Expect.equals(val, 42); |
| 629 asyncEnd(); |
| 630 }); |
| 631 } |
| 632 |
| 620 main() { | 633 main() { |
| 621 testValue(); | 634 testValue(); |
| 622 testSync(); | 635 testSync(); |
| 623 testNeverComplete(); | 636 testNeverComplete(); |
| 624 | 637 |
| 625 testComplete(); | 638 testComplete(); |
| 626 testCompleteWithSuccessHandlerBeforeComplete(); | 639 testCompleteWithSuccessHandlerBeforeComplete(); |
| 627 testCompleteWithSuccessHandlerAfterComplete(); | 640 testCompleteWithSuccessHandlerAfterComplete(); |
| 628 testCompleteManySuccessHandlers(); | 641 testCompleteManySuccessHandlers(); |
| 629 testCompleteWithError(); | 642 testCompleteWithError(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 651 testFutureWhenErrorFutureError(); | 664 testFutureWhenErrorFutureError(); |
| 652 | 665 |
| 653 testFutureThenThrowsAsync(); | 666 testFutureThenThrowsAsync(); |
| 654 testFutureCatchThrowsAsync(); | 667 testFutureCatchThrowsAsync(); |
| 655 testFutureWhenThrowsAsync(); | 668 testFutureWhenThrowsAsync(); |
| 656 testFutureCatchRethrowsAsync(); | 669 testFutureCatchRethrowsAsync(); |
| 657 | 670 |
| 658 testChainedFutureValue(); | 671 testChainedFutureValue(); |
| 659 testChainedFutureValueDelay(); | 672 testChainedFutureValueDelay(); |
| 660 testChainedFutureError(); | 673 testChainedFutureError(); |
| 674 |
| 675 testSyncFuture_i13368(); |
| 661 } | 676 } |
| OLD | NEW |