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

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

Issue 75863004: Add a stack chain class to the stack trace package. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 7 years, 1 month 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/test/chain_test.dart ('k') | pkg/stack_trace/test/utils.dart » ('j') | 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: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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 var trace = new Trace.parse( 164 var trace = new Trace.parse(
165 'http://dartlang.org/foo/bar.dart 10:11 Foo.<fn>.bar\n' 165 'http://dartlang.org/foo/bar.dart 10:11 Foo.<fn>.bar\n'
166 'http://dartlang.org/foo/baz.dart Foo.<fn>.bar'); 166 'http://dartlang.org/foo/baz.dart Foo.<fn>.bar');
167 167
168 expect(trace.frames[0].uri, 168 expect(trace.frames[0].uri,
169 equals(Uri.parse("http://dartlang.org/foo/bar.dart"))); 169 equals(Uri.parse("http://dartlang.org/foo/bar.dart")));
170 expect(trace.frames[1].uri, 170 expect(trace.frames[1].uri,
171 equals(Uri.parse("http://dartlang.org/foo/baz.dart"))); 171 equals(Uri.parse("http://dartlang.org/foo/baz.dart")));
172 }); 172 });
173 173
174 test('parses a package:stack_trace stack chain correctly', () {
175 var trace = new Trace.parse(
176 'http://dartlang.org/foo/bar.dart 10:11 Foo.<fn>.bar\n'
177 'http://dartlang.org/foo/baz.dart Foo.<fn>.bar\n'
178 '===== asynchronous gap ===========================\n'
179 'http://dartlang.org/foo/bang.dart 10:11 Foo.<fn>.bar\n'
180 'http://dartlang.org/foo/quux.dart Foo.<fn>.bar');
181
182 expect(trace.frames[0].uri,
183 equals(Uri.parse("http://dartlang.org/foo/bar.dart")));
184 expect(trace.frames[1].uri,
185 equals(Uri.parse("http://dartlang.org/foo/baz.dart")));
186 expect(trace.frames[2].uri,
187 equals(Uri.parse("http://dartlang.org/foo/bang.dart")));
188 expect(trace.frames[3].uri,
189 equals(Uri.parse("http://dartlang.org/foo/quux.dart")));
190 });
191
174 test('parses a real package:stack_trace stack trace correctly', () { 192 test('parses a real package:stack_trace stack trace correctly', () {
175 var traceString = new Trace.current().toString(); 193 var traceString = new Trace.current().toString();
176 expect(new Trace.parse(traceString).toString(), equals(traceString)); 194 expect(new Trace.parse(traceString).toString(), equals(traceString));
177 }); 195 });
178 196
179 test('parses an empty string correctly', () { 197 test('parses an empty string correctly', () {
180 var trace = new Trace.parse(''); 198 var trace = new Trace.parse('');
181 expect(trace.frames, isEmpty); 199 expect(trace.frames, isEmpty);
182 expect(trace.toString(), equals('')); 200 expect(trace.toString(), equals(''));
183 }); 201 });
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 259
242 var folded = trace.foldFrames((frame) => frame.member.startsWith('foo')); 260 var folded = trace.foldFrames((frame) => frame.member.startsWith('foo'));
243 expect(folded.toString(), equals(''' 261 expect(folded.toString(), equals('''
244 foo.dart 42:21 notFoo 262 foo.dart 42:21 notFoo
245 foo.dart 1:100 fooBottom 263 foo.dart 1:100 fooBottom
246 bar.dart 10:20 alsoNotFoo 264 bar.dart 10:20 alsoNotFoo
247 dart:async-patch/future.dart 9:11 fooBottom 265 dart:async-patch/future.dart 9:11 fooBottom
248 ''')); 266 '''));
249 }); 267 });
250 } 268 }
OLDNEW
« no previous file with comments | « pkg/stack_trace/test/chain_test.dart ('k') | pkg/stack_trace/test/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698