Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: test/trace_test.dart

Issue 1653603002: pkg/stack_trace: Use StackTrace.current (Closed) Base URL: https://github.com/dart-lang/stack_trace.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698