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

Side by Side Diff: test/trace_test.dart

Issue 1062123003: Support JavaScriptCore stack traces. (Closed) Base URL: git@github.com:dart-lang/stack_trace@master
Patch Set: Code review changes Created 5 years, 8 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
« no previous file with comments | « pubspec.yaml ('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 trace_test; 5 library trace_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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 '(http://pub.dartlang.org/thing.js:1:100)'); 85 '(http://pub.dartlang.org/thing.js:1:100)');
86 86
87 expect(trace.frames[0].uri, 87 expect(trace.frames[0].uri,
88 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); 88 equals(Uri.parse("http://pub.dartlang.org/stuff.js")));
89 expect(trace.frames[1].uri, 89 expect(trace.frames[1].uri,
90 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); 90 equals(Uri.parse("http://pub.dartlang.org/stuff.js")));
91 expect(trace.frames[2].uri, 91 expect(trace.frames[2].uri,
92 equals(Uri.parse("http://pub.dartlang.org/thing.js"))); 92 equals(Uri.parse("http://pub.dartlang.org/thing.js")));
93 }); 93 });
94 94
95 // JavaScriptCore traces are just like V8, except that it doesn't have a
96 // header and it starts with a tab rather than spaces.
97 test('parses a JavaScriptCore stack trace correctly', () {
98 var trace = new Trace.parse(
99 '\tat Foo._bar (http://pub.dartlang.org/stuff.js:42:21)\n'
100 '\tat http://pub.dartlang.org/stuff.js:0:2\n'
101 '\tat zip.<anonymous>.zap '
102 '(http://pub.dartlang.org/thing.js:1:100)');
103
104 expect(trace.frames[0].uri,
105 equals(Uri.parse("http://pub.dartlang.org/stuff.js")));
106 expect(trace.frames[1].uri,
107 equals(Uri.parse("http://pub.dartlang.org/stuff.js")));
108 expect(trace.frames[2].uri,
109 equals(Uri.parse("http://pub.dartlang.org/thing.js")));
110 });
111
95 test('parses a Firefox/Safari stack trace correctly', () { 112 test('parses a Firefox/Safari stack trace correctly', () {
96 var trace = new Trace.parse( 113 var trace = new Trace.parse(
97 'Foo._bar@http://pub.dartlang.org/stuff.js:42\n' 114 'Foo._bar@http://pub.dartlang.org/stuff.js:42\n'
98 'zip/<@http://pub.dartlang.org/stuff.js:0\n' 115 'zip/<@http://pub.dartlang.org/stuff.js:0\n'
99 'zip.zap(12, "@)()/<")@http://pub.dartlang.org/thing.js:1'); 116 'zip.zap(12, "@)()/<")@http://pub.dartlang.org/thing.js:1');
100 117
101 expect(trace.frames[0].uri, 118 expect(trace.frames[0].uri,
102 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); 119 equals(Uri.parse("http://pub.dartlang.org/stuff.js")));
103 expect(trace.frames[1].uri, 120 expect(trace.frames[1].uri,
104 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); 121 equals(Uri.parse("http://pub.dartlang.org/stuff.js")));
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 var folded = trace.foldFrames((frame) => frame.member.startsWith('foo'), 390 var folded = trace.foldFrames((frame) => frame.member.startsWith('foo'),
374 terse: true); 391 terse: true);
375 expect(folded.toString(), equals(''' 392 expect(folded.toString(), equals('''
376 foo.dart 42:21 notFoo 393 foo.dart 42:21 notFoo
377 package:foo fooBottom 394 package:foo fooBottom
378 bar.dart 10:20 alsoNotFoo 395 bar.dart 10:20 alsoNotFoo
379 foo fooBottom 396 foo fooBottom
380 ''')); 397 '''));
381 }); 398 });
382 } 399 }
OLDNEW
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698