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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 }); | 217 }); |
218 | 218 |
219 test('.toString() nicely formats the stack trace', () { | 219 test('.toString() nicely formats the stack trace', () { |
220 var trace = new Trace.parse(''' | 220 var trace = new Trace.parse(''' |
221 #0 Foo._bar (foo/bar.dart:42:21) | 221 #0 Foo._bar (foo/bar.dart:42:21) |
222 #1 zip.<anonymous closure>.zap (dart:async/future.dart:0:2) | 222 #1 zip.<anonymous closure>.zap (dart:async/future.dart:0:2) |
223 #2 zip.<anonymous closure>.zap (http://pub.dartlang.org/thing.dart:1:100) | 223 #2 zip.<anonymous closure>.zap (http://pub.dartlang.org/thing.dart:1:100) |
224 '''); | 224 '''); |
225 | 225 |
226 expect(trace.toString(), equals(''' | 226 expect(trace.toString(), equals(''' |
227 foo/bar.dart 42:21 Foo._bar | 227 ${path.join('foo', 'bar.dart')} 42:21 Foo._bar |
228 dart:async/future.dart 0:2 zip.<fn>.zap | 228 dart:async/future.dart 0:2 zip.<fn>.zap |
229 http://pub.dartlang.org/thing.dart 1:100 zip.<fn>.zap | 229 http://pub.dartlang.org/thing.dart 1:100 zip.<fn>.zap |
230 ''')); | 230 ''')); |
231 }); | 231 }); |
232 | 232 |
233 test('.vmTrace returns a native-style trace', () { | 233 test('.vmTrace returns a native-style trace', () { |
234 var uri = path.toUri(path.absolute('foo')); | 234 var uri = path.toUri(path.absolute('foo')); |
235 var trace = new Trace([ | 235 var trace = new Trace([ |
236 new Frame(uri, 10, 20, 'Foo.<fn>'), | 236 new Frame(uri, 10, 20, 'Foo.<fn>'), |
237 new Frame(Uri.parse('http://dartlang.org/foo.dart'), null, null, 'bar'), | 237 new Frame(Uri.parse('http://dartlang.org/foo.dart'), null, null, 'bar'), |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 274 |
275 var folded = trace.foldFrames((frame) => frame.member.startsWith('foo')); | 275 var folded = trace.foldFrames((frame) => frame.member.startsWith('foo')); |
276 expect(folded.toString(), equals(''' | 276 expect(folded.toString(), equals(''' |
277 foo.dart 42:21 notFoo | 277 foo.dart 42:21 notFoo |
278 foo.dart 1:100 fooBottom | 278 foo.dart 1:100 fooBottom |
279 bar.dart 10:20 alsoNotFoo | 279 bar.dart 10:20 alsoNotFoo |
280 dart:async-patch/future.dart 9:11 fooBottom | 280 dart:async-patch/future.dart 9:11 fooBottom |
281 ''')); | 281 ''')); |
282 }); | 282 }); |
283 } | 283 } |
OLD | NEW |