OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
8 import "package:async_helper/async_helper.dart"; | 8 import "package:async_helper/async_helper.dart"; |
9 | 9 |
10 // Test that local variable reads and writes are sequenced correctly with | 10 // Test that local variable reads and writes are sequenced correctly with |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 } | 47 } |
48 | 48 |
49 Future test6(ignore) async { | 49 Future test6(ignore) async { |
50 Expect.equals('bbb', '${cell = 'b'}${await asyncReadCell()}${cell}'); | 50 Expect.equals('bbb', '${cell = 'b'}${await asyncReadCell()}${cell}'); |
51 } | 51 } |
52 | 52 |
53 // Test that throwing is sequenced correctly with respect to other effects. | 53 // Test that throwing is sequenced correctly with respect to other effects. |
54 Future test7(ignore) async { | 54 Future test7(ignore) async { |
55 cell = 'a'; | 55 cell = 'a'; |
56 try { | 56 try { |
57 Expect.equals('unreachable', | 57 Expect.equals( |
58 '${throw 0}${await asyncWriteCell('b')}${cell}'); | 58 'unreachable', '${throw 0}${await asyncWriteCell('b')}${cell}'); |
59 } catch (_) { | 59 } catch (_) { |
60 Expect.equals('a', cell); | 60 Expect.equals('a', cell); |
61 } | 61 } |
62 } | 62 } |
63 | 63 |
64 main() { | 64 main() { |
65 asyncStart(); | 65 asyncStart(); |
66 test1() | 66 test1() |
67 .then(test2) | 67 .then(test2) |
68 .then(test3) | 68 .then(test3) |
69 .then(test4) | 69 .then(test4) |
70 .then(test5) | 70 .then(test5) |
71 .then(test6) | 71 .then(test6) |
72 .then(test7) | 72 .then(test7) |
73 .then((_) => asyncEnd()); | 73 .then((_) => asyncEnd()); |
74 } | 74 } |
OLD | NEW |