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 frame_test; | 5 library frame_test; |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 import 'dart:uri'; | 8 import 'dart:uri'; |
9 | 9 |
10 import 'package:pathos/path.dart' as path; | 10 import 'package:pathos/path.dart' as path; |
(...skipping 13 matching lines...) Expand all Loading... |
24 if (level == null) return new Frame.caller(); | 24 if (level == null) return new Frame.caller(); |
25 return new Frame.caller(level); | 25 return new Frame.caller(level); |
26 } | 26 } |
27 | 27 |
28 Frame nestedGetCaller(int level) => getCaller(level); | 28 Frame nestedGetCaller(int level) => getCaller(level); |
29 | 29 |
30 void main() { | 30 void main() { |
31 test('parses a stack frame correctly', () { | 31 test('parses a stack frame correctly', () { |
32 var frame = new Frame.parse("#1 Foo._bar " | 32 var frame = new Frame.parse("#1 Foo._bar " |
33 "(file:///home/nweiz/code/stuff.dart:42:21)"); | 33 "(file:///home/nweiz/code/stuff.dart:42:21)"); |
34 expect(frame.uri, | 34 expect(frame.uri, equals(Uri.parse("file:///home/nweiz/code/stuff.dart"))); |
35 equals(new Uri.fromString("file:///home/nweiz/code/stuff.dart"))); | |
36 expect(frame.line, equals(42)); | 35 expect(frame.line, equals(42)); |
37 expect(frame.column, equals(21)); | 36 expect(frame.column, equals(21)); |
38 expect(frame.member, equals('Foo._bar')); | 37 expect(frame.member, equals('Foo._bar')); |
39 }); | 38 }); |
40 | 39 |
41 test('parses a real stack frame correctly', () { | 40 test('parses a real stack frame correctly', () { |
42 var frame = new Frame.parse(getStackFrame()); | 41 var frame = new Frame.parse(getStackFrame()); |
43 // TODO(nweiz): use URL-style paths when such a thing exists. | 42 // TODO(nweiz): use URL-style paths when such a thing exists. |
44 var builder = new path.Builder(style: path.Style.posix); | 43 var builder = new path.Builder(style: path.Style.posix); |
45 expect(builder.basename(frame.uri.path), equals('frame_test.dart')); | 44 expect(builder.basename(frame.uri.path), equals('frame_test.dart')); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 equals('dart:core in Foo')); | 167 equals('dart:core in Foo')); |
169 }); | 168 }); |
170 | 169 |
171 test('converts "<anonymous closure>" to "<fn>"', () { | 170 test('converts "<anonymous closure>" to "<fn>"', () { |
172 expect(new Frame.parse('#0 Foo.<anonymous closure> (dart:core:5:10)') | 171 expect(new Frame.parse('#0 Foo.<anonymous closure> (dart:core:5:10)') |
173 .toString(), | 172 .toString(), |
174 equals('dart:core in Foo.<fn>')); | 173 equals('dart:core in Foo.<fn>')); |
175 }); | 174 }); |
176 }); | 175 }); |
177 } | 176 } |
OLD | NEW |