OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 run_async_test; |
| 6 |
| 7 import 'package:async_helper/async_helper.dart'; |
5 import 'package:expect/expect.dart'; | 8 import 'package:expect/expect.dart'; |
6 import 'package:async_helper/async_helper.dart'; | |
7 import 'dart:async'; | 9 import 'dart:async'; |
8 | 10 |
9 main() { | 11 main() { |
10 StackTrace trace; | 12 int lastCallback = -1; |
11 asyncStart(); | 13 for (int i = 0; i < 100; i++) { |
12 var f = new Future(() { | 14 asyncStart(); |
13 throw "foo"; | 15 scheduleMicrotask(() { |
14 }); | 16 Expect.equals(lastCallback, i - 1); |
15 f.catchError((e, st) { | 17 lastCallback = i; |
16 Expect.equals("foo", e); | 18 asyncEnd(); |
17 Expect.isNotNull(st); | 19 }); |
18 asyncEnd(); | 20 } |
19 }); | |
20 } | 21 } |
OLD | NEW |