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 "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 import "package:async_helper/async_helper.dart"; | 6 import "package:async_helper/async_helper.dart"; |
7 import "dart:async"; | 7 import "dart:async"; |
8 | 8 |
9 void main() { | 9 void main() { |
10 StackTrace stack; | 10 StackTrace stack; |
11 try { throw 0; } catch (e, s) { stack = s; } | 11 try { |
| 12 throw 0; |
| 13 } catch (e, s) { |
| 14 stack = s; |
| 15 } |
12 var string = "$stack"; | 16 var string = "$stack"; |
13 StackTrace stringTrace = new StackTrace.fromString(string); | 17 StackTrace stringTrace = new StackTrace.fromString(string); |
14 Expect.isTrue(stringTrace is StackTrace); | 18 Expect.isTrue(stringTrace is StackTrace); |
15 Expect.equals(stack.toString(), stringTrace.toString()); | 19 Expect.equals(stack.toString(), stringTrace.toString()); |
16 | 20 |
17 string = "some random string, nothing like a StackTrace"; | 21 string = "some random string, nothing like a StackTrace"; |
18 stringTrace = new StackTrace.fromString(string); | 22 stringTrace = new StackTrace.fromString(string); |
19 Expect.isTrue(stringTrace is StackTrace); | 23 Expect.isTrue(stringTrace is StackTrace); |
20 Expect.equals(string, stringTrace.toString()); | 24 Expect.equals(string, stringTrace.toString()); |
21 | 25 |
(...skipping 10 matching lines...) Expand all Loading... |
32 c.stream.listen((v) { | 36 c.stream.listen((v) { |
33 throw "Unexpected value: $v"; | 37 throw "Unexpected value: $v"; |
34 }, onError: (e, s) { | 38 }, onError: (e, s) { |
35 Expect.equals(string, s.toString()); | 39 Expect.equals(string, s.toString()); |
36 asyncEnd(); | 40 asyncEnd(); |
37 }); | 41 }); |
38 c.addError(0, stringTrace); | 42 c.addError(0, stringTrace); |
39 c.close(); | 43 c.close(); |
40 }); | 44 }); |
41 } | 45 } |
OLD | NEW |