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

Side by Side Diff: pkg/stack_trace/test/trace_test.dart

Issue 18170002: Properly handle empty stack traces in package:stack_trace. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « pkg/stack_trace/lib/src/trace.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 library trace_test; 5 library trace_test;
6 6
7 import 'package:pathos/path.dart' as path; 7 import 'package:pathos/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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 expect(trace.frames[0].uri, 96 expect(trace.frames[0].uri,
97 equals(Uri.parse("http://pub.dartlang.org/thing.js"))); 97 equals(Uri.parse("http://pub.dartlang.org/thing.js")));
98 expect(trace.frames[1].uri, 98 expect(trace.frames[1].uri,
99 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); 99 equals(Uri.parse("http://pub.dartlang.org/stuff.js")));
100 expect(trace.frames[2].uri, 100 expect(trace.frames[2].uri,
101 equals(Uri.parse("http://pub.dartlang.org/stuff.js"))); 101 equals(Uri.parse("http://pub.dartlang.org/stuff.js")));
102 }); 102 });
103 103
104 test('parses an empty string correctly', () { 104 test('parses an empty string correctly', () {
105 expect(new Trace.parse('').frames, isEmpty); 105 var trace = new Trace.parse('');
106 expect(trace.frames, isEmpty);
107 expect(trace.toString(), equals(''));
106 }); 108 });
107 }); 109 });
108 110
109 test('.toString() nicely formats the stack trace', () { 111 test('.toString() nicely formats the stack trace', () {
110 var trace = new Trace.parse(''' 112 var trace = new Trace.parse('''
111 #0 Foo._bar (foo/bar.dart:42:21) 113 #0 Foo._bar (foo/bar.dart:42:21)
112 #1 zip.<anonymous closure>.zap (dart:async/future.dart:0:2) 114 #1 zip.<anonymous closure>.zap (dart:async/future.dart:0:2)
113 #2 zip.<anonymous closure>.zap (http://pub.dartlang.org/thing.dart:1:100) 115 #2 zip.<anonymous closure>.zap (http://pub.dartlang.org/thing.dart:1:100)
114 '''); 116 ''');
115 117
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 162
161 var folded = trace.foldFrames((frame) => frame.member.startsWith('foo')); 163 var folded = trace.foldFrames((frame) => frame.member.startsWith('foo'));
162 expect(folded.toString(), equals(''' 164 expect(folded.toString(), equals('''
163 foo.dart 42:21 notFoo 165 foo.dart 42:21 notFoo
164 foo.dart 1:100 fooBottom 166 foo.dart 1:100 fooBottom
165 bar.dart 10:20 alsoNotFoo 167 bar.dart 10:20 alsoNotFoo
166 dart:async-patch/future.dart 9:11 fooBottom 168 dart:async-patch/future.dart 9:11 fooBottom
167 ''')); 169 '''));
168 }); 170 });
169 } 171 }
OLDNEW
« no previous file with comments | « pkg/stack_trace/lib/src/trace.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698