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:test/test.dart'; | 9 import 'package:test/test.dart'; |
10 | 10 |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 equals('dart:async/future.dart')); | 496 equals('dart:async/future.dart')); |
497 expect(new Frame.parseVM('#0 Foo ' | 497 expect(new Frame.parseVM('#0 Foo ' |
498 '(http://dartlang.org/stuff/thing.dart:0:0)').library, | 498 '(http://dartlang.org/stuff/thing.dart:0:0)').library, |
499 equals('http://dartlang.org/stuff/thing.dart')); | 499 equals('http://dartlang.org/stuff/thing.dart')); |
500 }); | 500 }); |
501 | 501 |
502 test('returns the relative path for file URIs', () { | 502 test('returns the relative path for file URIs', () { |
503 expect(new Frame.parseVM('#0 Foo (foo/bar.dart:0:0)').library, | 503 expect(new Frame.parseVM('#0 Foo (foo/bar.dart:0:0)').library, |
504 equals(path.join('foo', 'bar.dart'))); | 504 equals(path.join('foo', 'bar.dart'))); |
505 }); | 505 }); |
| 506 |
| 507 test('truncates data: URIs', () { |
| 508 var frame = new Frame.parseVM( |
| 509 '#0 Foo (data:application/dart;charset=utf-8,blah:0:0)'); |
| 510 expect(frame.library, equals('data:...')); |
| 511 }); |
506 }); | 512 }); |
507 | 513 |
508 group('.location', () { | 514 group('.location', () { |
509 test('returns the library and line/column numbers for non-core ' | 515 test('returns the library and line/column numbers for non-core ' |
510 'libraries', () { | 516 'libraries', () { |
511 expect(new Frame.parseVM('#0 Foo ' | 517 expect(new Frame.parseVM('#0 Foo ' |
512 '(http://dartlang.org/thing.dart:5:10)').location, | 518 '(http://dartlang.org/thing.dart:5:10)').location, |
513 equals('http://dartlang.org/thing.dart 5:10')); | 519 equals('http://dartlang.org/thing.dart 5:10')); |
514 expect(new Frame.parseVM('#0 Foo (foo/bar.dart:1:2)').location, | 520 expect(new Frame.parseVM('#0 Foo (foo/bar.dart:1:2)').location, |
515 equals('${path.join('foo', 'bar.dart')} 1:2')); | 521 equals('${path.join('foo', 'bar.dart')} 1:2')); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 equals('$relative 5:10 in Foo')); | 564 equals('$relative 5:10 in Foo')); |
559 }); | 565 }); |
560 }); | 566 }); |
561 } | 567 } |
562 | 568 |
563 void expectIsUnparsed(Frame constructor(String text), String text) { | 569 void expectIsUnparsed(Frame constructor(String text), String text) { |
564 var frame = constructor(text); | 570 var frame = constructor(text); |
565 expect(frame, new isInstanceOf<UnparsedFrame>()); | 571 expect(frame, new isInstanceOf<UnparsedFrame>()); |
566 expect(frame.toString(), equals(text)); | 572 expect(frame.toString(), equals(text)); |
567 } | 573 } |
OLD | NEW |