| 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 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 throwsFormatException); | 203 throwsFormatException); |
| 204 expect(() => new Frame.parseV8(' at dart:async/future.dart'), | 204 expect(() => new Frame.parseV8(' at dart:async/future.dart'), |
| 205 throwsFormatException); | 205 throwsFormatException); |
| 206 expect(() => new Frame.parseV8(' at dart:async/future.dart:10'), | 206 expect(() => new Frame.parseV8(' at dart:async/future.dart:10'), |
| 207 throwsFormatException); | 207 throwsFormatException); |
| 208 expect(() => new Frame.parseV8('dart:async/future.dart:10:15'), | 208 expect(() => new Frame.parseV8('dart:async/future.dart:10:15'), |
| 209 throwsFormatException); | 209 throwsFormatException); |
| 210 }); | 210 }); |
| 211 }); | 211 }); |
| 212 | 212 |
| 213 group('.parseFirefox', () { | 213 group('.parseFirefox/.parseSafari', () { |
| 214 test('parses a simple stack frame correctly', () { | 214 test('parses a simple stack frame correctly', () { |
| 215 var frame = new Frame.parseFirefox( | 215 var frame = new Frame.parseFirefox( |
| 216 ".VW.call\$0@http://pub.dartlang.org/stuff.dart.js:560"); | 216 ".VW.call\$0@http://pub.dartlang.org/stuff.dart.js:560"); |
| 217 expect(frame.uri, | 217 expect(frame.uri, |
| 218 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js"))); | 218 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js"))); |
| 219 expect(frame.line, equals(560)); | 219 expect(frame.line, equals(560)); |
| 220 expect(frame.column, isNull); | 220 expect(frame.column, isNull); |
| 221 expect(frame.member, equals('VW.call\$0')); | 221 expect(frame.member, equals('VW.call\$0')); |
| 222 }); | 222 }); |
| 223 | 223 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 test('throws a FormatException for malformed frames', () { | 349 test('throws a FormatException for malformed frames', () { |
| 350 expect(() => new Frame.parseFirefox(''), throwsFormatException); | 350 expect(() => new Frame.parseFirefox(''), throwsFormatException); |
| 351 expect(() => new Frame.parseFirefox('.foo'), throwsFormatException); | 351 expect(() => new Frame.parseFirefox('.foo'), throwsFormatException); |
| 352 expect(() => new Frame.parseFirefox('.foo@dart:async/future.dart'), | 352 expect(() => new Frame.parseFirefox('.foo@dart:async/future.dart'), |
| 353 throwsFormatException); | 353 throwsFormatException); |
| 354 expect(() => new Frame.parseFirefox('.foo(@dart:async/future.dart:10'), | 354 expect(() => new Frame.parseFirefox('.foo(@dart:async/future.dart:10'), |
| 355 throwsFormatException); | 355 throwsFormatException); |
| 356 expect(() => new Frame.parseFirefox('@dart:async/future.dart'), | 356 expect(() => new Frame.parseFirefox('@dart:async/future.dart'), |
| 357 throwsFormatException); | 357 throwsFormatException); |
| 358 }); | 358 }); |
| 359 }); | |
| 360 | 359 |
| 361 group('.parseSafari6_1', () { | |
| 362 test('parses a simple stack frame correctly', () { | 360 test('parses a simple stack frame correctly', () { |
| 363 var frame = new Frame.parseSafari6_1( | 361 var frame = new Frame.parseFirefox( |
| 364 "foo\$bar@http://dartlang.org/foo/bar.dart:10:11"); | 362 "foo\$bar@http://dartlang.org/foo/bar.dart:10:11"); |
| 365 expect(frame.uri, equals(Uri.parse("http://dartlang.org/foo/bar.dart"))); | 363 expect(frame.uri, equals(Uri.parse("http://dartlang.org/foo/bar.dart"))); |
| 366 expect(frame.line, equals(10)); | 364 expect(frame.line, equals(10)); |
| 367 expect(frame.column, equals(11)); | 365 expect(frame.column, equals(11)); |
| 368 expect(frame.member, equals('foo\$bar')); | 366 expect(frame.member, equals('foo\$bar')); |
| 369 }); | 367 }); |
| 370 | 368 |
| 371 test('parses an anonymous stack frame correctly', () { | 369 test('parses an anonymous stack frame correctly', () { |
| 372 var frame = new Frame.parseSafari6_1( | 370 var frame = new Frame.parseFirefox( |
| 373 "http://dartlang.org/foo/bar.dart:10:11"); | 371 "http://dartlang.org/foo/bar.dart:10:11"); |
| 374 expect(frame.uri, equals(Uri.parse("http://dartlang.org/foo/bar.dart"))); | 372 expect(frame.uri, equals(Uri.parse("http://dartlang.org/foo/bar.dart"))); |
| 375 expect(frame.line, equals(10)); | 373 expect(frame.line, equals(10)); |
| 376 expect(frame.column, equals(11)); | 374 expect(frame.column, equals(11)); |
| 377 expect(frame.member, equals('<fn>')); | 375 expect(frame.member, equals('<fn>')); |
| 378 }); | 376 }); |
| 379 | 377 |
| 380 test('parses a stack frame with no line correctly', () { | 378 test('parses a stack frame with no line correctly', () { |
| 381 var frame = new Frame.parseSafari6_1( | 379 var frame = new Frame.parseFirefox( |
| 382 "foo\$bar@http://dartlang.org/foo/bar.dart::11"); | 380 "foo\$bar@http://dartlang.org/foo/bar.dart::11"); |
| 383 expect(frame.uri, equals(Uri.parse("http://dartlang.org/foo/bar.dart"))); | 381 expect(frame.uri, equals(Uri.parse("http://dartlang.org/foo/bar.dart"))); |
| 384 expect(frame.line, isNull); | 382 expect(frame.line, isNull); |
| 385 expect(frame.column, equals(11)); | 383 expect(frame.column, equals(11)); |
| 386 expect(frame.member, equals('foo\$bar')); | 384 expect(frame.member, equals('foo\$bar')); |
| 387 }); | 385 }); |
| 388 | 386 |
| 389 test('parses a stack frame with no column correctly', () { | 387 test('parses a stack frame with no column correctly', () { |
| 390 var frame = new Frame.parseSafari6_1( | 388 var frame = new Frame.parseFirefox( |
| 391 "foo\$bar@http://dartlang.org/foo/bar.dart:10:"); | 389 "foo\$bar@http://dartlang.org/foo/bar.dart:10:"); |
| 392 expect(frame.uri, equals(Uri.parse("http://dartlang.org/foo/bar.dart"))); | 390 expect(frame.uri, equals(Uri.parse("http://dartlang.org/foo/bar.dart"))); |
| 393 expect(frame.line, equals(10)); | 391 expect(frame.line, equals(10)); |
| 394 expect(frame.column, isNull); | 392 expect(frame.column, isNull); |
| 395 expect(frame.member, equals('foo\$bar')); | 393 expect(frame.member, equals('foo\$bar')); |
| 396 }); | 394 }); |
| 397 | 395 |
| 398 test('parses a stack frame with no line or column correctly', () { | 396 test('parses a stack frame with no line or column correctly', () { |
| 399 var frame = new Frame.parseSafari6_1( | 397 var frame = new Frame.parseFirefox( |
| 400 "foo\$bar@http://dartlang.org/foo/bar.dart:10:11"); | 398 "foo\$bar@http://dartlang.org/foo/bar.dart:10:11"); |
| 401 expect(frame.uri, equals(Uri.parse("http://dartlang.org/foo/bar.dart"))); | 399 expect(frame.uri, equals(Uri.parse("http://dartlang.org/foo/bar.dart"))); |
| 402 expect(frame.line, equals(10)); | 400 expect(frame.line, equals(10)); |
| 403 expect(frame.column, equals(11)); | 401 expect(frame.column, equals(11)); |
| 404 expect(frame.member, equals('foo\$bar')); | 402 expect(frame.member, equals('foo\$bar')); |
| 405 }); | 403 }); |
| 406 }); | 404 }); |
| 407 | 405 |
| 408 group('.parseFriendly', () { | 406 group('.parseFriendly', () { |
| 409 test('parses a simple stack frame correctly', () { | 407 test('parses a simple stack frame correctly', () { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 equals('dart:core/uri.dart 5 in Foo')); | 525 equals('dart:core/uri.dart 5 in Foo')); |
| 528 }); | 526 }); |
| 529 | 527 |
| 530 test('prints relative paths as relative', () { | 528 test('prints relative paths as relative', () { |
| 531 var relative = path.normalize('relative/path/to/foo.dart'); | 529 var relative = path.normalize('relative/path/to/foo.dart'); |
| 532 expect(new Frame.parseFriendly('$relative 5:10 Foo').toString(), | 530 expect(new Frame.parseFriendly('$relative 5:10 Foo').toString(), |
| 533 equals('$relative 5:10 in Foo')); | 531 equals('$relative 5:10 in Foo')); |
| 534 }); | 532 }); |
| 535 }); | 533 }); |
| 536 } | 534 } |
| OLD | NEW |