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 /// This file tests stack_trace's ability to parse live stack traces. It's a | 5 /// This file tests stack_trace's ability to parse live stack traces. It's a |
6 /// dual of dartium_test.dart, since method names can differ somewhat from | 6 /// dual of dartium_test.dart, since method names can differ somewhat from |
7 /// platform to platform. No similar file exists for dart2js since the specific | 7 /// platform to platform. No similar file exists for dart2js since the specific |
8 /// method names there are implementation details. | 8 /// method names there are implementation details. |
9 | 9 |
10 import 'package:pathos/path.dart' as path; | 10 import 'package:path/path.dart' as path; |
11 import 'package:stack_trace/stack_trace.dart'; | 11 import 'package:stack_trace/stack_trace.dart'; |
12 import 'package:unittest/unittest.dart'; | 12 import 'package:unittest/unittest.dart'; |
13 | 13 |
14 String getStackTraceString() { | 14 String getStackTraceString() { |
15 try { | 15 try { |
16 throw ''; | 16 throw ''; |
17 } catch (_, stackTrace) { | 17 } catch (_, stackTrace) { |
18 return stackTrace.toString(); | 18 return stackTrace.toString(); |
19 } | 19 } |
20 } | 20 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 test('at level 2 returns the grandparent frame', () { | 101 test('at level 2 returns the grandparent frame', () { |
102 expect(nestedGetCaller(2).member, equals('main.<fn>.<fn>')); | 102 expect(nestedGetCaller(2).member, equals('main.<fn>.<fn>')); |
103 }); | 103 }); |
104 | 104 |
105 test('throws an ArgumentError for negative levels', () { | 105 test('throws an ArgumentError for negative levels', () { |
106 expect(() => new Frame.caller(-1), throwsArgumentError); | 106 expect(() => new Frame.caller(-1), throwsArgumentError); |
107 }); | 107 }); |
108 }); | 108 }); |
109 } | 109 } |
OLD | NEW |