OLD | NEW |
1 import "dart:async"; | 1 import "dart:async"; |
2 import "package:expect/expect.dart"; | 2 import "package:expect/expect.dart"; |
3 | 3 |
4 class Blah extends StackTrace { | 4 class Blah implements StackTrace { |
5 Blah(this._trace); | 5 Blah(this._trace); |
6 | 6 |
7 toString() { | 7 toString() { |
8 return "Blah " + _trace.toString(); | 8 return "Blah " + _trace.toString(); |
9 } | 9 } |
10 | 10 |
11 var _trace; | 11 var _trace; |
12 } | 12 } |
13 | 13 |
14 foo() { | 14 foo() { |
15 var x = "\nBloop\nBleep\n"; | 15 var x = "\nBloop\nBleep\n"; |
16 return new Future.error(42, new Blah(x)); | 16 return new Future.error(42, new Blah(x)); |
17 } | 17 } |
18 | 18 |
19 main() async { | 19 main() async { |
20 try { | 20 try { |
21 var x = await foo(); | 21 var x = await foo(); |
22 Expect.fail("Should not reach here."); | 22 Expect.fail("Should not reach here."); |
23 } on int catch (e, s) { | 23 } on int catch (e, s) { |
24 Expect.equals(42, e); | 24 Expect.equals(42, e); |
25 Expect.equals("Blah \nBloop\nBleep\n", s.toString()); | 25 Expect.equals("Blah \nBloop\nBleep\n", s.toString()); |
26 return; | 26 return; |
27 } | 27 } |
28 Expect.fail("Unreachable."); | 28 Expect.fail("Unreachable."); |
29 } | 29 } |
OLD | NEW |