| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 'zip\$zap@http://pub.dartlang.org/thing.js:1:2'); | 153 'zip\$zap@http://pub.dartlang.org/thing.js:1:2'); |
| 154 | 154 |
| 155 expect(trace.frames[0].uri, | 155 expect(trace.frames[0].uri, |
| 156 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); | 156 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); |
| 157 expect(trace.frames[1].uri, | 157 expect(trace.frames[1].uri, |
| 158 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); | 158 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); |
| 159 expect(trace.frames[2].uri, | 159 expect(trace.frames[2].uri, |
| 160 equals(Uri.parse("http://pub.dartlang.org/thing.js"))); | 160 equals(Uri.parse("http://pub.dartlang.org/thing.js"))); |
| 161 }); | 161 }); |
| 162 | 162 |
| 163 test('parses a Safari 6.1 stack trace with an empty line correctly', () { |
| 164 var trace = new Trace.parse( |
| 165 'http://pub.dartlang.org/stuff.js:42:43\n' |
| 166 '\n' |
| 167 'zip@http://pub.dartlang.org/stuff.js:0:1\n' |
| 168 'zip\$zap@http://pub.dartlang.org/thing.js:1:2'); |
| 169 |
| 170 expect(trace.frames[0].uri, |
| 171 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); |
| 172 expect(trace.frames[1].uri, |
| 173 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); |
| 174 expect(trace.frames[2].uri, |
| 175 equals(Uri.parse("http://pub.dartlang.org/thing.js"))); |
| 176 }); |
| 177 |
| 163 test('parses a package:stack_trace stack trace correctly', () { | 178 test('parses a package:stack_trace stack trace correctly', () { |
| 164 var trace = new Trace.parse( | 179 var trace = new Trace.parse( |
| 165 'http://dartlang.org/foo/bar.dart 10:11 Foo.<fn>.bar\n' | 180 'http://dartlang.org/foo/bar.dart 10:11 Foo.<fn>.bar\n' |
| 166 'http://dartlang.org/foo/baz.dart Foo.<fn>.bar'); | 181 'http://dartlang.org/foo/baz.dart Foo.<fn>.bar'); |
| 167 | 182 |
| 168 expect(trace.frames[0].uri, | 183 expect(trace.frames[0].uri, |
| 169 equals(Uri.parse("http://dartlang.org/foo/bar.dart"))); | 184 equals(Uri.parse("http://dartlang.org/foo/bar.dart"))); |
| 170 expect(trace.frames[1].uri, | 185 expect(trace.frames[1].uri, |
| 171 equals(Uri.parse("http://dartlang.org/foo/baz.dart"))); | 186 equals(Uri.parse("http://dartlang.org/foo/baz.dart"))); |
| 172 }); | 187 }); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 274 |
| 260 var folded = trace.foldFrames((frame) => frame.member.startsWith('foo')); | 275 var folded = trace.foldFrames((frame) => frame.member.startsWith('foo')); |
| 261 expect(folded.toString(), equals(''' | 276 expect(folded.toString(), equals(''' |
| 262 foo.dart 42:21 notFoo | 277 foo.dart 42:21 notFoo |
| 263 foo.dart 1:100 fooBottom | 278 foo.dart 1:100 fooBottom |
| 264 bar.dart 10:20 alsoNotFoo | 279 bar.dart 10:20 alsoNotFoo |
| 265 dart:async-patch/future.dart 9:11 fooBottom | 280 dart:async-patch/future.dart 9:11 fooBottom |
| 266 ''')); | 281 ''')); |
| 267 }); | 282 }); |
| 268 } | 283 } |
| OLD | NEW |