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

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

Issue 48273005: Support Safari 6.1's new stack trace format in pkg/stack_trace. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/lib/src/trace.dart ('k') | pkg/stack_trace/test/trace_test.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 frame_test; 5 library frame_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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 expect(() => new Frame.parseFirefox('.foo'), throwsFormatException); 219 expect(() => new Frame.parseFirefox('.foo'), throwsFormatException);
220 expect(() => new Frame.parseFirefox('.foo@dart:async/future.dart'), 220 expect(() => new Frame.parseFirefox('.foo@dart:async/future.dart'),
221 throwsFormatException); 221 throwsFormatException);
222 expect(() => new Frame.parseFirefox('.foo(@dart:async/future.dart:10'), 222 expect(() => new Frame.parseFirefox('.foo(@dart:async/future.dart:10'),
223 throwsFormatException); 223 throwsFormatException);
224 expect(() => new Frame.parseFirefox('@dart:async/future.dart'), 224 expect(() => new Frame.parseFirefox('@dart:async/future.dart'),
225 throwsFormatException); 225 throwsFormatException);
226 }); 226 });
227 }); 227 });
228 228
229 group('.parseSafari6_1', () {
230 test('parses a simple stack frame correctly', () {
231 var frame = new Frame.parseSafari6_1(
232 "foo\$bar@http://dartlang.org/foo/bar.dart:10:11");
233 expect(frame.uri, equals(Uri.parse("http://dartlang.org/foo/bar.dart")));
234 expect(frame.line, equals(10));
235 expect(frame.column, equals(11));
236 expect(frame.member, equals('foo\$bar'));
237 });
238
239 test('parses an anonymous stack frame correctly', () {
240 var frame = new Frame.parseSafari6_1(
241 "http://dartlang.org/foo/bar.dart:10:11");
242 expect(frame.uri, equals(Uri.parse("http://dartlang.org/foo/bar.dart")));
243 expect(frame.line, equals(10));
244 expect(frame.column, equals(11));
245 expect(frame.member, equals('<fn>'));
246 });
247
248 test('parses a stack frame with no line correctly', () {
249 var frame = new Frame.parseSafari6_1(
250 "foo\$bar@http://dartlang.org/foo/bar.dart::11");
251 expect(frame.uri, equals(Uri.parse("http://dartlang.org/foo/bar.dart")));
252 expect(frame.line, isNull);
253 expect(frame.column, equals(11));
254 expect(frame.member, equals('foo\$bar'));
255 });
256
257 test('parses a stack frame with no column correctly', () {
258 var frame = new Frame.parseSafari6_1(
259 "foo\$bar@http://dartlang.org/foo/bar.dart:10:");
260 expect(frame.uri, equals(Uri.parse("http://dartlang.org/foo/bar.dart")));
261 expect(frame.line, equals(10));
262 expect(frame.column, isNull);
263 expect(frame.member, equals('foo\$bar'));
264 });
265
266 test('parses a stack frame with no line or column correctly', () {
267 var frame = new Frame.parseSafari6_1(
268 "foo\$bar@http://dartlang.org/foo/bar.dart:10:11");
269 expect(frame.uri, equals(Uri.parse("http://dartlang.org/foo/bar.dart")));
270 expect(frame.line, equals(10));
271 expect(frame.column, equals(11));
272 expect(frame.member, equals('foo\$bar'));
273 });
274 });
275
229 group('.parseFriendly', () { 276 group('.parseFriendly', () {
230 test('parses a simple stack frame correctly', () { 277 test('parses a simple stack frame correctly', () {
231 var frame = new Frame.parseFriendly( 278 var frame = new Frame.parseFriendly(
232 "http://dartlang.org/foo/bar.dart 10:11 Foo.<fn>.bar"); 279 "http://dartlang.org/foo/bar.dart 10:11 Foo.<fn>.bar");
233 expect(frame.uri, equals(Uri.parse("http://dartlang.org/foo/bar.dart"))); 280 expect(frame.uri, equals(Uri.parse("http://dartlang.org/foo/bar.dart")));
234 expect(frame.line, equals(10)); 281 expect(frame.line, equals(10));
235 expect(frame.column, equals(11)); 282 expect(frame.column, equals(11));
236 expect(frame.member, equals('Foo.<fn>.bar')); 283 expect(frame.member, equals('Foo.<fn>.bar'));
237 }); 284 });
238 285
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 '(dart:core/uri.dart:5:10)').toString(), 389 '(dart:core/uri.dart:5:10)').toString(),
343 equals('dart:core/uri.dart 5:10 in Foo.<fn>')); 390 equals('dart:core/uri.dart 5:10 in Foo.<fn>'));
344 }); 391 });
345 392
346 test('prints a frame without a column correctly', () { 393 test('prints a frame without a column correctly', () {
347 expect(new Frame.parseVM('#0 Foo (dart:core/uri.dart:5)').toString(), 394 expect(new Frame.parseVM('#0 Foo (dart:core/uri.dart:5)').toString(),
348 equals('dart:core/uri.dart 5 in Foo')); 395 equals('dart:core/uri.dart 5 in Foo'));
349 }); 396 });
350 }); 397 });
351 } 398 }
OLDNEW
« no previous file with comments | « pkg/stack_trace/lib/src/trace.dart ('k') | pkg/stack_trace/test/trace_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698