| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 'Foo._bar@http://pub.dartlang.org/stuff.js:42'); | 123 'Foo._bar@http://pub.dartlang.org/stuff.js:42'); |
| 124 | 124 |
| 125 expect(trace.frames[0].uri, | 125 expect(trace.frames[0].uri, |
| 126 equals(Uri.parse("http://pub.dartlang.org/thing.js"))); | 126 equals(Uri.parse("http://pub.dartlang.org/thing.js"))); |
| 127 expect(trace.frames[1].uri, | 127 expect(trace.frames[1].uri, |
| 128 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); | 128 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); |
| 129 expect(trace.frames[2].uri, | 129 expect(trace.frames[2].uri, |
| 130 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); | 130 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); |
| 131 }); | 131 }); |
| 132 | 132 |
| 133 test('.parseSafari', () { |
| 134 var trace = new Trace.parse( |
| 135 'Foo._bar@http://pub.dartlang.org/stuff.js:42\n' |
| 136 'zip/<@http://pub.dartlang.org/stuff.js:0\n' |
| 137 'zip.zap(12, "@)()/<")@http://pub.dartlang.org/thing.js:1\n' |
| 138 '[native code]'); |
| 139 |
| 140 expect(trace.frames[0].uri, |
| 141 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); |
| 142 expect(trace.frames[1].uri, |
| 143 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); |
| 144 expect(trace.frames[2].uri, |
| 145 equals(Uri.parse("http://pub.dartlang.org/thing.js"))); |
| 146 expect(trace.frames.length, equals(3)); |
| 147 }); |
| 148 |
| 133 test('parses a package:stack_trace stack trace correctly', () { | 149 test('parses a package:stack_trace stack trace correctly', () { |
| 134 var trace = new Trace.parse( | 150 var trace = new Trace.parse( |
| 135 'http://dartlang.org/foo/bar.dart 10:11 Foo.<fn>.bar\n' | 151 'http://dartlang.org/foo/bar.dart 10:11 Foo.<fn>.bar\n' |
| 136 'http://dartlang.org/foo/baz.dart Foo.<fn>.bar'); | 152 'http://dartlang.org/foo/baz.dart Foo.<fn>.bar'); |
| 137 | 153 |
| 138 expect(trace.frames[0].uri, | 154 expect(trace.frames[0].uri, |
| 139 equals(Uri.parse("http://dartlang.org/foo/bar.dart"))); | 155 equals(Uri.parse("http://dartlang.org/foo/bar.dart"))); |
| 140 expect(trace.frames[1].uri, | 156 expect(trace.frames[1].uri, |
| 141 equals(Uri.parse("http://dartlang.org/foo/baz.dart"))); | 157 equals(Uri.parse("http://dartlang.org/foo/baz.dart"))); |
| 142 }); | 158 }); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 227 |
| 212 var folded = trace.foldFrames((frame) => frame.member.startsWith('foo')); | 228 var folded = trace.foldFrames((frame) => frame.member.startsWith('foo')); |
| 213 expect(folded.toString(), equals(''' | 229 expect(folded.toString(), equals(''' |
| 214 foo.dart 42:21 notFoo | 230 foo.dart 42:21 notFoo |
| 215 foo.dart 1:100 fooBottom | 231 foo.dart 1:100 fooBottom |
| 216 bar.dart 10:20 alsoNotFoo | 232 bar.dart 10:20 alsoNotFoo |
| 217 dart:async-patch/future.dart 9:11 fooBottom | 233 dart:async-patch/future.dart 9:11 fooBottom |
| 218 ''')); | 234 ''')); |
| 219 }); | 235 }); |
| 220 } | 236 } |
| OLD | NEW |