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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 ' at http://pub.dartlang.org/stuff.js:0:2\n' | 54 ' at http://pub.dartlang.org/stuff.js:0:2\n' |
55 ' at zip.<anonymous>.zap ' | 55 ' at zip.<anonymous>.zap ' |
56 '(http://pub.dartlang.org/thing.js:1:100)'); | 56 '(http://pub.dartlang.org/thing.js:1:100)'); |
57 | 57 |
58 expect(trace.frames[0].uri, | 58 expect(trace.frames[0].uri, |
59 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); | 59 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); |
60 expect(trace.frames[1].uri, | 60 expect(trace.frames[1].uri, |
61 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); | 61 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); |
62 expect(trace.frames[2].uri, | 62 expect(trace.frames[2].uri, |
63 equals(Uri.parse("http://pub.dartlang.org/thing.js"))); | 63 equals(Uri.parse("http://pub.dartlang.org/thing.js"))); |
| 64 |
| 65 trace = new Trace.parse( |
| 66 "Exception: foo\n" |
| 67 ' at Foo._bar (http://pub.dartlang.org/stuff.js:42:21)\n' |
| 68 ' at http://pub.dartlang.org/stuff.js:0:2\n' |
| 69 ' at zip.<anonymous>.zap ' |
| 70 '(http://pub.dartlang.org/thing.js:1:100)'); |
| 71 |
| 72 expect(trace.frames[0].uri, |
| 73 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); |
| 74 expect(trace.frames[1].uri, |
| 75 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); |
| 76 expect(trace.frames[2].uri, |
| 77 equals(Uri.parse("http://pub.dartlang.org/thing.js"))); |
| 78 |
| 79 trace = new Trace.parse( |
| 80 'Exception: foo\n' |
| 81 ' bar\n' |
| 82 ' at Foo._bar (http://pub.dartlang.org/stuff.js:42:21)\n' |
| 83 ' at http://pub.dartlang.org/stuff.js:0:2\n' |
| 84 ' at zip.<anonymous>.zap ' |
| 85 '(http://pub.dartlang.org/thing.js:1:100)'); |
| 86 |
| 87 expect(trace.frames[0].uri, |
| 88 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); |
| 89 expect(trace.frames[1].uri, |
| 90 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); |
| 91 expect(trace.frames[2].uri, |
| 92 equals(Uri.parse("http://pub.dartlang.org/thing.js"))); |
64 }); | 93 }); |
65 | 94 |
66 test('parses a Firefox stack trace correctly', () { | 95 test('parses a Firefox stack trace correctly', () { |
67 var trace = new Trace.parse( | 96 var trace = new Trace.parse( |
68 'Foo._bar@http://pub.dartlang.org/stuff.js:42\n' | 97 'Foo._bar@http://pub.dartlang.org/stuff.js:42\n' |
69 'zip/<@http://pub.dartlang.org/stuff.js:0\n' | 98 'zip/<@http://pub.dartlang.org/stuff.js:0\n' |
70 'zip.zap(12, "@)()/<")@http://pub.dartlang.org/thing.js:1'); | 99 'zip.zap(12, "@)()/<")@http://pub.dartlang.org/thing.js:1'); |
71 | 100 |
72 expect(trace.frames[0].uri, | 101 expect(trace.frames[0].uri, |
73 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); | 102 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 211 |
183 var folded = trace.foldFrames((frame) => frame.member.startsWith('foo')); | 212 var folded = trace.foldFrames((frame) => frame.member.startsWith('foo')); |
184 expect(folded.toString(), equals(''' | 213 expect(folded.toString(), equals(''' |
185 foo.dart 42:21 notFoo | 214 foo.dart 42:21 notFoo |
186 foo.dart 1:100 fooBottom | 215 foo.dart 1:100 fooBottom |
187 bar.dart 10:20 alsoNotFoo | 216 bar.dart 10:20 alsoNotFoo |
188 dart:async-patch/future.dart 9:11 fooBottom | 217 dart:async-patch/future.dart 9:11 fooBottom |
189 ''')); | 218 ''')); |
190 }); | 219 }); |
191 } | 220 } |
OLD | NEW |