Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Side by Side Diff: pkg/stack_trace/test/frame_test.dart

Issue 63603005: Properly parse jsshell and d8 stack frames. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 test('parses a stack frame correctly', () { 65 test('parses a stack frame correctly', () {
66 var frame = new Frame.parseV8(" at VW.call\$0 " 66 var frame = new Frame.parseV8(" at VW.call\$0 "
67 "(http://pub.dartlang.org/stuff.dart.js:560:28)"); 67 "(http://pub.dartlang.org/stuff.dart.js:560:28)");
68 expect(frame.uri, 68 expect(frame.uri,
69 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js"))); 69 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js")));
70 expect(frame.line, equals(560)); 70 expect(frame.line, equals(560));
71 expect(frame.column, equals(28)); 71 expect(frame.column, equals(28));
72 expect(frame.member, equals('VW.call\$0')); 72 expect(frame.member, equals('VW.call\$0'));
73 }); 73 });
74 74
75 test('parses a stack frame with an absolute POSIX path correctly', () {
76 var frame = new Frame.parseV8(" at VW.call\$0 "
77 "(/path/to/stuff.dart.js:560:28)");
78 expect(frame.uri, equals(Uri.parse("file:///path/to/stuff.dart.js")));
79 expect(frame.line, equals(560));
80 expect(frame.column, equals(28));
81 expect(frame.member, equals('VW.call\$0'));
82 });
83
84 test('parses a stack frame with an absolute Windows path correctly', () {
85 var frame = new Frame.parseV8(" at VW.call\$0 "
86 r"(C:\path\to\stuff.dart.js:560:28)");
87 expect(frame.uri, equals(Uri.parse("file:///C:/path/to/stuff.dart.js")));
88 expect(frame.line, equals(560));
89 expect(frame.column, equals(28));
90 expect(frame.member, equals('VW.call\$0'));
91 });
Bob Nystrom 2013/11/07 22:25:10 Add a UNC path test too.
nweiz 2013/11/07 22:40:12 Done.
92
93 test('parses a stack frame with a relative POSIX path correctly', () {
94 var frame = new Frame.parseV8(" at VW.call\$0 "
95 "(path/to/stuff.dart.js:560:28)");
96 expect(frame.uri, equals(Uri.parse("path/to/stuff.dart.js")));
97 expect(frame.line, equals(560));
98 expect(frame.column, equals(28));
99 expect(frame.member, equals('VW.call\$0'));
100 });
101
102 test('parses a stack frame with a relative Windows path correctly', () {
103 var frame = new Frame.parseV8(" at VW.call\$0 "
104 r"(path\to\stuff.dart.js:560:28)");
105 expect(frame.uri, equals(Uri.parse("path/to/stuff.dart.js")));
106 expect(frame.line, equals(560));
107 expect(frame.column, equals(28));
108 expect(frame.member, equals('VW.call\$0'));
109 });
110
75 test('parses an anonymous stack frame correctly', () { 111 test('parses an anonymous stack frame correctly', () {
76 var frame = new Frame.parseV8( 112 var frame = new Frame.parseV8(
77 " at http://pub.dartlang.org/stuff.dart.js:560:28"); 113 " at http://pub.dartlang.org/stuff.dart.js:560:28");
78 expect(frame.uri, 114 expect(frame.uri,
79 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js"))); 115 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js")));
80 expect(frame.line, equals(560)); 116 expect(frame.line, equals(560));
81 expect(frame.column, equals(28)); 117 expect(frame.column, equals(28));
82 expect(frame.member, equals('<fn>')); 118 expect(frame.member, equals('<fn>'));
83 }); 119 });
84 120
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 test('parses a simple stack frame correctly', () { 164 test('parses a simple stack frame correctly', () {
129 var frame = new Frame.parseFirefox( 165 var frame = new Frame.parseFirefox(
130 ".VW.call\$0@http://pub.dartlang.org/stuff.dart.js:560"); 166 ".VW.call\$0@http://pub.dartlang.org/stuff.dart.js:560");
131 expect(frame.uri, 167 expect(frame.uri,
132 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js"))); 168 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js")));
133 expect(frame.line, equals(560)); 169 expect(frame.line, equals(560));
134 expect(frame.column, isNull); 170 expect(frame.column, isNull);
135 expect(frame.member, equals('VW.call\$0')); 171 expect(frame.member, equals('VW.call\$0'));
136 }); 172 });
137 173
174 test('parses a stack frame with an absolute POSIX path correctly', () {
175 var frame = new Frame.parseFirefox(
176 ".VW.call\$0@/path/to/stuff.dart.js:560");
177 expect(frame.uri, equals(Uri.parse("file:///path/to/stuff.dart.js")));
178 expect(frame.line, equals(560));
179 expect(frame.column, isNull);
180 expect(frame.member, equals('VW.call\$0'));
181 });
182
183 test('parses a stack frame with an absolute Windows path correctly', () {
184 var frame = new Frame.parseFirefox(
185 r".VW.call$0@C:\path\to\stuff.dart.js:560");
186 expect(frame.uri, equals(Uri.parse("file:///C:/path/to/stuff.dart.js")));
187 expect(frame.line, equals(560));
188 expect(frame.column, isNull);
189 expect(frame.member, equals('VW.call\$0'));
190 });
191
192 test('parses a stack frame with a relative POSIX path correctly', () {
193 var frame = new Frame.parseFirefox(
194 ".VW.call\$0@path/to/stuff.dart.js:560");
195 expect(frame.uri, equals(Uri.parse("path/to/stuff.dart.js")));
196 expect(frame.line, equals(560));
197 expect(frame.column, isNull);
198 expect(frame.member, equals('VW.call\$0'));
199 });
200
201 test('parses a stack frame with a relative Windows path correctly', () {
202 var frame = new Frame.parseFirefox(
203 r".VW.call$0@path\to\stuff.dart.js:560");
204 expect(frame.uri, equals(Uri.parse("path/to/stuff.dart.js")));
205 expect(frame.line, equals(560));
206 expect(frame.column, isNull);
207 expect(frame.member, equals('VW.call\$0'));
208 });
209
138 test('parses a simple anonymous stack frame correctly', () { 210 test('parses a simple anonymous stack frame correctly', () {
139 var frame = new Frame.parseFirefox( 211 var frame = new Frame.parseFirefox(
140 "@http://pub.dartlang.org/stuff.dart.js:560"); 212 "@http://pub.dartlang.org/stuff.dart.js:560");
141 expect(frame.uri, 213 expect(frame.uri,
142 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js"))); 214 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js")));
143 expect(frame.line, equals(560)); 215 expect(frame.line, equals(560));
144 expect(frame.column, isNull); 216 expect(frame.column, isNull);
145 expect(frame.member, equals("<fn>")); 217 expect(frame.member, equals("<fn>"));
146 }); 218 });
147 219
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 '(dart:core/uri.dart:5:10)').toString(), 461 '(dart:core/uri.dart:5:10)').toString(),
390 equals('dart:core/uri.dart 5:10 in Foo.<fn>')); 462 equals('dart:core/uri.dart 5:10 in Foo.<fn>'));
391 }); 463 });
392 464
393 test('prints a frame without a column correctly', () { 465 test('prints a frame without a column correctly', () {
394 expect(new Frame.parseVM('#0 Foo (dart:core/uri.dart:5)').toString(), 466 expect(new Frame.parseVM('#0 Foo (dart:core/uri.dart:5)').toString(),
395 equals('dart:core/uri.dart 5 in Foo')); 467 equals('dart:core/uri.dart 5 in Foo'));
396 }); 468 });
397 }); 469 });
398 } 470 }
OLDNEW
« pkg/stack_trace/lib/src/frame.dart ('K') | « pkg/stack_trace/lib/src/frame.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698