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 'package:path/path.dart' as path; | 7 import 'package:path/path.dart' as path; |
8 import 'package:stack_trace/stack_trace.dart'; | 8 import 'package:stack_trace/stack_trace.dart'; |
9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 test('parses a stack frame without column correctly', () { | 23 test('parses a stack frame without column correctly', () { |
24 var frame = new Frame.parseVM("#1 Foo._bar " | 24 var frame = new Frame.parseVM("#1 Foo._bar " |
25 "(file:///home/nweiz/code/stuff.dart:24)"); | 25 "(file:///home/nweiz/code/stuff.dart:24)"); |
26 expect(frame.uri, | 26 expect(frame.uri, |
27 equals(Uri.parse("file:///home/nweiz/code/stuff.dart"))); | 27 equals(Uri.parse("file:///home/nweiz/code/stuff.dart"))); |
28 expect(frame.line, equals(24)); | 28 expect(frame.line, equals(24)); |
29 expect(frame.column, null); | 29 expect(frame.column, null); |
30 expect(frame.member, equals('Foo._bar')); | 30 expect(frame.member, equals('Foo._bar')); |
31 }); | 31 }); |
32 | 32 |
33 test('parses a stack frame with timer_impl correctly', () { | |
34 var frame = new Frame.parseVM("#1 Foo._bar " | |
35 "(timer_impl.dart:24)"); | |
36 expect(frame.uri, equals(Uri.parse("dart:io/timer_impl.dart"))); | |
37 expect(frame.line, equals(24)); | |
38 expect(frame.column, null); | |
39 expect(frame.member, equals('Foo._bar')); | |
40 }); | |
41 | |
42 test('parses a stack frame with http_parser correctly', () { | |
43 var frame = new Frame.parseVM("#1 Foo._bar " | |
44 "(http_parser.dart:24)"); | |
45 expect(frame.uri, equals(Uri.parse("dart:io/http_parser.dart"))); | |
46 expect(frame.line, equals(24)); | |
47 expect(frame.column, null); | |
48 expect(frame.member, equals('Foo._bar')); | |
49 }); | |
50 | |
51 test('parses a stack frame with http_impl correctly', () { | |
52 var frame = new Frame.parseVM("#1 Foo._bar " | |
53 "(http_impl.dart:24)"); | |
54 expect(frame.uri, equals(Uri.parse("dart:io/http_impl.dart"))); | |
55 expect(frame.line, equals(24)); | |
56 expect(frame.column, null); | |
57 expect(frame.member, equals('Foo._bar')); | |
58 }); | |
59 | |
60 test('converts "<anonymous closure>" to "<fn>"', () { | 33 test('converts "<anonymous closure>" to "<fn>"', () { |
61 String parsedMember(String member) => | 34 String parsedMember(String member) => |
62 new Frame.parseVM('#0 $member (foo:0:0)').member; | 35 new Frame.parseVM('#0 $member (foo:0:0)').member; |
63 | 36 |
64 expect(parsedMember('Foo.<anonymous closure>'), equals('Foo.<fn>')); | 37 expect(parsedMember('Foo.<anonymous closure>'), equals('Foo.<fn>')); |
65 expect(parsedMember('<anonymous closure>.<anonymous closure>.bar'), | 38 expect(parsedMember('<anonymous closure>.<anonymous closure>.bar'), |
66 equals('<fn>.<fn>.bar')); | 39 equals('<fn>.<fn>.bar')); |
67 }); | 40 }); |
68 | 41 |
69 test('parses a folded frame correctly', () { | 42 test('parses a folded frame correctly', () { |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 equals('dart:core/uri.dart 5 in Foo')); | 527 equals('dart:core/uri.dart 5 in Foo')); |
555 }); | 528 }); |
556 | 529 |
557 test('prints relative paths as relative', () { | 530 test('prints relative paths as relative', () { |
558 var relative = path.normalize('relative/path/to/foo.dart'); | 531 var relative = path.normalize('relative/path/to/foo.dart'); |
559 expect(new Frame.parseFriendly('$relative 5:10 Foo').toString(), | 532 expect(new Frame.parseFriendly('$relative 5:10 Foo').toString(), |
560 equals('$relative 5:10 in Foo')); | 533 equals('$relative 5:10 in Foo')); |
561 }); | 534 }); |
562 }); | 535 }); |
563 } | 536 } |
OLD | NEW |