| 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 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |