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

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

Issue 130443002: Properly parse V8 lines involving eval in pkg/stack_trace. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 11 months 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // similar construct. 142 // similar construct.
143 var frame = new Frame.parseV8(" at VW.call\$0 [as call\$4] " 143 var frame = new Frame.parseV8(" at VW.call\$0 [as call\$4] "
144 "(http://pub.dartlang.org/stuff.dart.js:560:28)"); 144 "(http://pub.dartlang.org/stuff.dart.js:560:28)");
145 expect(frame.uri, 145 expect(frame.uri,
146 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js"))); 146 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js")));
147 expect(frame.line, equals(560)); 147 expect(frame.line, equals(560));
148 expect(frame.column, equals(28)); 148 expect(frame.column, equals(28));
149 expect(frame.member, equals('VW.call\$0')); 149 expect(frame.member, equals('VW.call\$0'));
150 }); 150 });
151 151
152 test('parses a basic eval stack frame correctly', () {
153 var frame = new Frame.parseV8(" at eval (eval at <anonymous> "
154 "(http://pub.dartlang.org/stuff.dart.js:560:28))");
155 expect(frame.uri,
156 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js")));
157 expect(frame.line, equals(560));
158 expect(frame.column, equals(28));
159 expect(frame.member, equals('eval'));
160 });
161
162 test('parses an eval stack frame with inner position info correctly', () {
163 var frame = new Frame.parseV8(" at eval (eval at <anonymous> "
164 "(http://pub.dartlang.org/stuff.dart.js:560:28), <anonymous>:3:28)");
165 expect(frame.uri,
166 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js")));
167 expect(frame.line, equals(560));
168 expect(frame.column, equals(28));
169 expect(frame.member, equals('eval'));
170 });
171
172 test('parses a nested eval stack frame correctly', () {
173 var frame = new Frame.parseV8(" at eval (eval at <anonymous> "
174 "(eval at sub (http://pub.dartlang.org/stuff.dart.js:560:28)))");
175 expect(frame.uri,
176 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js")));
177 expect(frame.line, equals(560));
178 expect(frame.column, equals(28));
179 expect(frame.member, equals('eval'));
180 });
181
152 test('converts "<anonymous>" to "<fn>"', () { 182 test('converts "<anonymous>" to "<fn>"', () {
153 String parsedMember(String member) => 183 String parsedMember(String member) =>
154 new Frame.parseV8(' at $member (foo:0:0)').member; 184 new Frame.parseV8(' at $member (foo:0:0)').member;
155 185
156 expect(parsedMember('Foo.<anonymous>'), equals('Foo.<fn>')); 186 expect(parsedMember('Foo.<anonymous>'), equals('Foo.<fn>'));
157 expect(parsedMember('<anonymous>.<anonymous>.bar'), 187 expect(parsedMember('<anonymous>.<anonymous>.bar'),
158 equals('<fn>.<fn>.bar')); 188 equals('<fn>.<fn>.bar'));
159 }); 189 });
160 190
161 test('throws a FormatException for malformed frames', () { 191 test('throws a FormatException for malformed frames', () {
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 equals('dart:core/uri.dart 5 in Foo')); 526 equals('dart:core/uri.dart 5 in Foo'));
497 }); 527 });
498 528
499 test('prints relative paths as relative', () { 529 test('prints relative paths as relative', () {
500 var relative = path.normalize('relative/path/to/foo.dart'); 530 var relative = path.normalize('relative/path/to/foo.dart');
501 expect(new Frame.parseFriendly('$relative 5:10 Foo').toString(), 531 expect(new Frame.parseFriendly('$relative 5:10 Foo').toString(),
502 equals('$relative 5:10 in Foo')); 532 equals('$relative 5:10 in Foo'));
503 }); 533 });
504 }); 534 });
505 } 535 }
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