| 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 import 'package:expect/expect.dart'; | 6 import 'package:expect/expect.dart'; |
| 7 import 'package:async_helper/async_helper.dart'; | 7 import 'package:async_helper/async_helper.dart'; |
| 8 | 8 |
| 9 import 'dart:async'; | 9 import 'dart:async'; |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 .catchError(events.add) | 24 .catchError(events.add) |
| 25 .then(delayedError.complete); | 25 .then(delayedError.complete); |
| 26 throw 'in async function error'; | 26 throw 'in async function error'; |
| 27 } | 27 } |
| 28 | 28 |
| 29 void main() { | 29 void main() { |
| 30 asyncStart(); | 30 asyncStart(); |
| 31 var asyncValueFuture = foo().then(events.add); | 31 var asyncValueFuture = foo().then(events.add); |
| 32 var asyncErrorFuture = bar().catchError(events.add); | 32 var asyncErrorFuture = bar().catchError(events.add); |
| 33 Future.wait([ | 33 Future.wait([ |
| 34 asyncValueFuture, | 34 asyncValueFuture, |
| 35 delayedValue.future, | 35 delayedValue.future, |
| 36 asyncErrorFuture, | 36 asyncErrorFuture, |
| 37 delayedError.future]).then((_) { | 37 delayedError.future |
| 38 ]).then((_) { |
| 38 // The body completed before nested microtask. So they should appear | 39 // The body completed before nested microtask. So they should appear |
| 39 // before the delayed functions. In other words, the async function should | 40 // before the delayed functions. In other words, the async function should |
| 40 // not unnecessarily delay the propagation of errors and values. | 41 // not unnecessarily delay the propagation of errors and values. |
| 41 Expect.listEquals([ | 42 Expect.listEquals([ |
| 42 "in async function", | 43 "in async function", |
| 43 "in async function error", | 44 "in async function error", |
| 44 "in microtask", | 45 "in microtask", |
| 45 "in microtask error"], | 46 "in microtask error" |
| 46 events); | 47 ], events); |
| 47 asyncEnd(); | 48 asyncEnd(); |
| 48 }); | 49 }); |
| 49 } | 50 } |
| OLD | NEW |