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

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

Issue 23533074: Support "[as ...]" in V8 stack traces in pkg/stack_trace. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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
« no previous file with comments | « pkg/stack_trace/lib/src/frame.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 test('parses an anonymous stack frame correctly', () { 67 test('parses an anonymous stack frame correctly', () {
68 var frame = new Frame.parseV8( 68 var frame = new Frame.parseV8(
69 " at http://pub.dartlang.org/stuff.dart.js:560:28"); 69 " at http://pub.dartlang.org/stuff.dart.js:560:28");
70 expect(frame.uri, 70 expect(frame.uri,
71 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js"))); 71 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js")));
72 expect(frame.line, equals(560)); 72 expect(frame.line, equals(560));
73 expect(frame.column, equals(28)); 73 expect(frame.column, equals(28));
74 expect(frame.member, equals('<fn>')); 74 expect(frame.member, equals('<fn>'));
75 }); 75 });
76 76
77 solo_test('parses a stack frame with [as ...] correctly', () {
Jennifer Messerly 2013/09/20 19:14:46 remove solo?
nweiz 2013/09/20 19:29:09 Done.
78 // Ignore "[as ...]", since other stack trace formats don't support a
79 // similar construct.
80 var frame = new Frame.parseV8(" at VW.call\$0 [as call\$4] "
81 "(http://pub.dartlang.org/stuff.dart.js:560:28)");
82 expect(frame.uri,
83 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js")));
84 expect(frame.line, equals(560));
85 expect(frame.column, equals(28));
86 expect(frame.member, equals('VW.call\$0'));
87 });
88
77 test('converts "<anonymous>" to "<fn>"', () { 89 test('converts "<anonymous>" to "<fn>"', () {
78 String parsedMember(String member) => 90 String parsedMember(String member) =>
79 new Frame.parseV8(' at $member (foo:0:0)').member; 91 new Frame.parseV8(' at $member (foo:0:0)').member;
80 92
81 expect(parsedMember('Foo.<anonymous>'), equals('Foo.<fn>')); 93 expect(parsedMember('Foo.<anonymous>'), equals('Foo.<fn>'));
82 expect(parsedMember('<anonymous>.<anonymous>.bar'), 94 expect(parsedMember('<anonymous>.<anonymous>.bar'),
83 equals('<fn>.<fn>.bar')); 95 equals('<fn>.<fn>.bar'));
84 }); 96 });
85 97
86 test('throws a FormatException for malformed frames', () { 98 test('throws a FormatException for malformed frames', () {
87 expect(() => new Frame.parseV8(''), throwsFormatException); 99 expect(() => new Frame.parseV8(''), throwsFormatException);
88 expect(() => new Frame.parseV8(' at'), throwsFormatException); 100 expect(() => new Frame.parseV8(' at'), throwsFormatException);
89 expect(() => new Frame.parseV8(' at Foo'), throwsFormatException); 101 expect(() => new Frame.parseV8(' at Foo'), throwsFormatException);
90 expect(() => new Frame.parseV8(' at Foo (dart:async/future.dart)'), 102 expect(() => new Frame.parseV8(' at Foo (dart:async/future.dart)'),
91 throwsFormatException); 103 throwsFormatException);
92 expect(() => new Frame.parseV8(' at Foo (dart:async/future.dart:10)'), 104 expect(() => new Frame.parseV8(' at Foo (dart:async/future.dart:10)'),
93 throwsFormatException); 105 throwsFormatException);
106 expect(() => new Frame.parseV8(' at Foo [as] '
107 '(dart:async/future.dart:10:15)'),
108 throwsFormatException);
94 expect(() => new Frame.parseV8(' at (dart:async/future.dart:10:15)'), 109 expect(() => new Frame.parseV8(' at (dart:async/future.dart:10:15)'),
95 throwsFormatException); 110 throwsFormatException);
96 expect(() => new Frame.parseV8('Foo (dart:async/future.dart:10:15)'), 111 expect(() => new Frame.parseV8('Foo (dart:async/future.dart:10:15)'),
97 throwsFormatException); 112 throwsFormatException);
98 expect(() => new Frame.parseV8(' at dart:async/future.dart'), 113 expect(() => new Frame.parseV8(' at dart:async/future.dart'),
99 throwsFormatException); 114 throwsFormatException);
100 expect(() => new Frame.parseV8(' at dart:async/future.dart:10'), 115 expect(() => new Frame.parseV8(' at dart:async/future.dart:10'),
101 throwsFormatException); 116 throwsFormatException);
102 expect(() => new Frame.parseV8('dart:async/future.dart:10:15'), 117 expect(() => new Frame.parseV8('dart:async/future.dart:10:15'),
103 throwsFormatException); 118 throwsFormatException);
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 equals('http://dartlang.org/thing.dart 5:10 in Foo')); 311 equals('http://dartlang.org/thing.dart 5:10 in Foo'));
297 }); 312 });
298 313
299 test('converts "<anonymous closure>" to "<fn>"', () { 314 test('converts "<anonymous closure>" to "<fn>"', () {
300 expect(new Frame.parseVM('#0 Foo.<anonymous closure> ' 315 expect(new Frame.parseVM('#0 Foo.<anonymous closure> '
301 '(dart:core/uri.dart:5:10)').toString(), 316 '(dart:core/uri.dart:5:10)').toString(),
302 equals('dart:core/uri.dart 5:10 in Foo.<fn>')); 317 equals('dart:core/uri.dart 5:10 in Foo.<fn>'));
303 }); 318 });
304 }); 319 });
305 } 320 }
OLDNEW
« no previous file with comments | « 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