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 String getStackTraceString() { | |
10 try { | |
11 throw ''; | |
12 } catch (_, stackTrace) { | |
13 return stackTrace.toString(); | |
14 } | |
15 } | |
16 | |
17 StackTrace getStackTraceObject() { | |
18 try { | |
19 throw ''; | |
20 } catch (_, stackTrace) { | |
21 return stackTrace; | |
22 } | |
23 } | |
24 | |
25 Trace getCurrentTrace([int level]) => new Trace.current(level); | 9 Trace getCurrentTrace([int level]) => new Trace.current(level); |
26 | 10 |
27 Trace nestedGetCurrentTrace(int level) => getCurrentTrace(level); | 11 Trace nestedGetCurrentTrace(int level) => getCurrentTrace(level); |
28 | 12 |
29 void main() { | 13 void main() { |
30 // This just shouldn't crash. | 14 // This just shouldn't crash. |
31 test('a native stack trace is parseable', () => new Trace.current()); | 15 test('a native stack trace is parseable', () => new Trace.current()); |
32 | 16 |
33 group('.parse', () { | 17 group('.parse', () { |
34 test('.parse parses a VM stack trace correctly', () { | 18 test('.parse parses a VM stack trace correctly', () { |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 '''); | 403 '''); |
420 | 404 |
421 expect(trace.foldFrames((frame) => true).toString(), equals(r''' | 405 expect(trace.foldFrames((frame) => true).toString(), equals(r''' |
422 .g"cs$#:b";a#>sw{*{ul$"$xqwr`p | 406 .g"cs$#:b";a#>sw{*{ul$"$xqwr`p |
423 %+j-?uppx<([j@#nu{{>*+$%x-={`{ | 407 %+j-?uppx<([j@#nu{{>*+$%x-={`{ |
424 !e($b{nj)zs?cgr%!;bmw.+$j+pfj~ | 408 !e($b{nj)zs?cgr%!;bmw.+$j+pfj~ |
425 ''')); | 409 ''')); |
426 }); | 410 }); |
427 }); | 411 }); |
428 } | 412 } |
OLD | NEW |