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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 test('returns the URI string for non-file URIs', () { | 496 test('returns the URI string for non-file URIs', () { |
497 expect(new Frame.parseVM('#0 Foo (dart:async/future.dart:0:0)').library, | 497 expect(new Frame.parseVM('#0 Foo (dart:async/future.dart:0:0)').library, |
498 equals('dart:async/future.dart')); | 498 equals('dart:async/future.dart')); |
499 expect(new Frame.parseVM('#0 Foo ' | 499 expect(new Frame.parseVM('#0 Foo ' |
500 '(http://dartlang.org/stuff/thing.dart:0:0)').library, | 500 '(http://dartlang.org/stuff/thing.dart:0:0)').library, |
501 equals('http://dartlang.org/stuff/thing.dart')); | 501 equals('http://dartlang.org/stuff/thing.dart')); |
502 }); | 502 }); |
503 | 503 |
504 test('returns the relative path for file URIs', () { | 504 test('returns the relative path for file URIs', () { |
505 expect(new Frame.parseVM('#0 Foo (foo/bar.dart:0:0)').library, | 505 expect(new Frame.parseVM('#0 Foo (foo/bar.dart:0:0)').library, |
506 equals('foo/bar.dart')); | 506 equals(path.join('foo', 'bar.dart'))); |
507 }); | 507 }); |
508 }); | 508 }); |
509 | 509 |
510 group('.location', () { | 510 group('.location', () { |
511 test('returns the library and line/column numbers for non-core ' | 511 test('returns the library and line/column numbers for non-core ' |
512 'libraries', () { | 512 'libraries', () { |
513 expect(new Frame.parseVM('#0 Foo ' | 513 expect(new Frame.parseVM('#0 Foo ' |
514 '(http://dartlang.org/thing.dart:5:10)').location, | 514 '(http://dartlang.org/thing.dart:5:10)').location, |
515 equals('http://dartlang.org/thing.dart 5:10')); | 515 equals('http://dartlang.org/thing.dart 5:10')); |
516 expect(new Frame.parseVM('#0 Foo (foo/bar.dart:1:2)').location, | 516 expect(new Frame.parseVM('#0 Foo (foo/bar.dart:1:2)').location, |
517 equals('foo/bar.dart 1:2')); | 517 equals('${path.join('foo', 'bar.dart')} 1:2')); |
518 }); | 518 }); |
519 }); | 519 }); |
520 | 520 |
521 group('.package', () { | 521 group('.package', () { |
522 test('returns null for non-package URIs', () { | 522 test('returns null for non-package URIs', () { |
523 expect(new Frame.parseVM('#0 Foo (dart:async/future.dart:0:0)').package, | 523 expect(new Frame.parseVM('#0 Foo (dart:async/future.dart:0:0)').package, |
524 isNull); | 524 isNull); |
525 expect(new Frame.parseVM('#0 Foo ' | 525 expect(new Frame.parseVM('#0 Foo ' |
526 '(http://dartlang.org/stuff/thing.dart:0:0)').package, | 526 '(http://dartlang.org/stuff/thing.dart:0:0)').package, |
527 isNull); | 527 isNull); |
(...skipping 26 matching lines...) Expand all Loading... |
554 equals('dart:core/uri.dart 5 in Foo')); | 554 equals('dart:core/uri.dart 5 in Foo')); |
555 }); | 555 }); |
556 | 556 |
557 test('prints relative paths as relative', () { | 557 test('prints relative paths as relative', () { |
558 var relative = path.normalize('relative/path/to/foo.dart'); | 558 var relative = path.normalize('relative/path/to/foo.dart'); |
559 expect(new Frame.parseFriendly('$relative 5:10 Foo').toString(), | 559 expect(new Frame.parseFriendly('$relative 5:10 Foo').toString(), |
560 equals('$relative 5:10 in Foo')); | 560 equals('$relative 5:10 in Foo')); |
561 }); | 561 }); |
562 }); | 562 }); |
563 } | 563 } |
OLD | NEW |