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 import 'package:path/path.dart' as path; | 5 import 'package:path/path.dart' as path; |
6 import 'package:stack_trace/stack_trace.dart'; | 6 import 'package:stack_trace/stack_trace.dart'; |
7 import 'package:test/test.dart'; | 7 import 'package:test/test.dart'; |
8 | 8 |
9 Trace getCurrentTrace([int level]) => new Trace.current(level); | 9 Trace getCurrentTrace([int level]) => new Trace.current(level); |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 ' at http://pub.dartlang.org/stuff.js:0:2\n' | 65 ' at http://pub.dartlang.org/stuff.js:0:2\n' |
66 ' at zip.<anonymous>.zap ' | 66 ' at zip.<anonymous>.zap ' |
67 '(http://pub.dartlang.org/thing.js:1:100)'); | 67 '(http://pub.dartlang.org/thing.js:1:100)'); |
68 | 68 |
69 expect(trace.frames[0].uri, | 69 expect(trace.frames[0].uri, |
70 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); | 70 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); |
71 expect(trace.frames[1].uri, | 71 expect(trace.frames[1].uri, |
72 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); | 72 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); |
73 expect(trace.frames[2].uri, | 73 expect(trace.frames[2].uri, |
74 equals(Uri.parse("http://pub.dartlang.org/thing.js"))); | 74 equals(Uri.parse("http://pub.dartlang.org/thing.js"))); |
| 75 |
| 76 trace = new Trace.parse( |
| 77 'Exception: foo\n' |
| 78 ' bar\n' |
| 79 ' at Foo._bar (http://pub.dartlang.org/stuff.js:42:21)\n' |
| 80 ' at http://pub.dartlang.org/stuff.js:0:2\n' |
| 81 ' at (anonymous function).zip.zap ' |
| 82 '(http://pub.dartlang.org/thing.js:1:100)'); |
| 83 |
| 84 expect(trace.frames[0].uri, |
| 85 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); |
| 86 expect(trace.frames[1].uri, |
| 87 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); |
| 88 expect(trace.frames[1].member, equals("<fn>")); |
| 89 expect(trace.frames[2].uri, |
| 90 equals(Uri.parse("http://pub.dartlang.org/thing.js"))); |
| 91 expect(trace.frames[2].member, equals("<fn>.zip.zap")); |
75 }); | 92 }); |
76 | 93 |
77 // JavaScriptCore traces are just like V8, except that it doesn't have a | 94 // JavaScriptCore traces are just like V8, except that it doesn't have a |
78 // header and it starts with a tab rather than spaces. | 95 // header and it starts with a tab rather than spaces. |
79 test('parses a JavaScriptCore stack trace correctly', () { | 96 test('parses a JavaScriptCore stack trace correctly', () { |
80 var trace = new Trace.parse( | 97 var trace = new Trace.parse( |
81 '\tat Foo._bar (http://pub.dartlang.org/stuff.js:42:21)\n' | 98 '\tat Foo._bar (http://pub.dartlang.org/stuff.js:42:21)\n' |
82 '\tat http://pub.dartlang.org/stuff.js:0:2\n' | 99 '\tat http://pub.dartlang.org/stuff.js:0:2\n' |
83 '\tat zip.<anonymous>.zap ' | 100 '\tat zip.<anonymous>.zap ' |
84 '(http://pub.dartlang.org/thing.js:1:100)'); | 101 '(http://pub.dartlang.org/thing.js:1:100)'); |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 '''); | 420 '''); |
404 | 421 |
405 expect(trace.foldFrames((frame) => true).toString(), equals(r''' | 422 expect(trace.foldFrames((frame) => true).toString(), equals(r''' |
406 .g"cs$#:b";a#>sw{*{ul$"$xqwr`p | 423 .g"cs$#:b";a#>sw{*{ul$"$xqwr`p |
407 %+j-?uppx<([j@#nu{{>*+$%x-={`{ | 424 %+j-?uppx<([j@#nu{{>*+$%x-={`{ |
408 !e($b{nj)zs?cgr%!;bmw.+$j+pfj~ | 425 !e($b{nj)zs?cgr%!;bmw.+$j+pfj~ |
409 ''')); | 426 ''')); |
410 }); | 427 }); |
411 }); | 428 }); |
412 } | 429 } |
OLD | NEW |