OLD | NEW |
| (Empty) |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 import "dart:async"; | |
6 import "dart:js"; | |
7 import "dart:collection" show Queue; | |
8 import "package:expect/expect.dart"; | |
9 import "package:async_helper/async_helper.dart"; | |
10 | |
11 var errors = new Queue(); | |
12 int ctr = 0; | |
13 | |
14 main() { | |
15 print("STARTED"); | |
16 asyncStart(); | |
17 | |
18 void errorHandler(self, message, url, line, [column, error]) { | |
19 print(">> $message / $ctr"); | |
20 var expect = errors.removeFirst(); | |
21 if (ctr == 2) { | |
22 asyncEnd(); | |
23 print("DONE"); | |
24 } | |
25 Expect.equals(expect[0].toString(), message); | |
26 Expect.equals(expect[1].toString(), error["stack"].toString()); | |
27 } | |
28 | |
29 context["onerror"] = new JsFunction.withThis(errorHandler); | |
30 | |
31 void throwit() { | |
32 var err = ++ctr; | |
33 try { | |
34 throw err; | |
35 } catch (e, s) { | |
36 errors.add([e, s]); | |
37 rethrow; | |
38 } | |
39 } | |
40 | |
41 () async { | |
42 () async { | |
43 throwit(); | |
44 }(); | |
45 throwit(); | |
46 }(); | |
47 } | |
OLD | NEW |