| 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 15 matching lines...) Expand all Loading... |
| 26 expect(frame.uri, | 26 expect(frame.uri, |
| 27 equals(Uri.parse("file:///home/nweiz/code/stuff.dart"))); | 27 equals(Uri.parse("file:///home/nweiz/code/stuff.dart"))); |
| 28 expect(frame.line, equals(24)); | 28 expect(frame.line, equals(24)); |
| 29 expect(frame.column, null); | 29 expect(frame.column, null); |
| 30 expect(frame.member, equals('Foo._bar')); | 30 expect(frame.member, equals('Foo._bar')); |
| 31 }); | 31 }); |
| 32 | 32 |
| 33 test('parses a stack frame with timer_impl correctly', () { | 33 test('parses a stack frame with timer_impl correctly', () { |
| 34 var frame = new Frame.parseVM("#1 Foo._bar " | 34 var frame = new Frame.parseVM("#1 Foo._bar " |
| 35 "(timer_impl.dart:24)"); | 35 "(timer_impl.dart:24)"); |
| 36 expect(frame.uri, equals(Uri.parse("dart:async/timer_impl.dart"))); | 36 expect(frame.uri, equals(Uri.parse("dart:io/timer_impl.dart"))); |
| 37 expect(frame.line, equals(24)); | 37 expect(frame.line, equals(24)); |
| 38 expect(frame.column, null); | 38 expect(frame.column, null); |
| 39 expect(frame.member, equals('Foo._bar')); | 39 expect(frame.member, equals('Foo._bar')); |
| 40 }); |
| 41 |
| 42 test('parses a stack frame with http_parser correctly', () { |
| 43 var frame = new Frame.parseVM("#1 Foo._bar " |
| 44 "(http_parser.dart:24)"); |
| 45 expect(frame.uri, equals(Uri.parse("dart:io/http_parser.dart"))); |
| 46 expect(frame.line, equals(24)); |
| 47 expect(frame.column, null); |
| 48 expect(frame.member, equals('Foo._bar')); |
| 49 }); |
| 50 |
| 51 test('parses a stack frame with http_impl correctly', () { |
| 52 var frame = new Frame.parseVM("#1 Foo._bar " |
| 53 "(http_impl.dart:24)"); |
| 54 expect(frame.uri, equals(Uri.parse("dart:io/http_impl.dart"))); |
| 55 expect(frame.line, equals(24)); |
| 56 expect(frame.column, null); |
| 57 expect(frame.member, equals('Foo._bar')); |
| 40 }); | 58 }); |
| 41 | 59 |
| 42 test('converts "<anonymous closure>" to "<fn>"', () { | 60 test('converts "<anonymous closure>" to "<fn>"', () { |
| 43 String parsedMember(String member) => | 61 String parsedMember(String member) => |
| 44 new Frame.parseVM('#0 $member (foo:0:0)').member; | 62 new Frame.parseVM('#0 $member (foo:0:0)').member; |
| 45 | 63 |
| 46 expect(parsedMember('Foo.<anonymous closure>'), equals('Foo.<fn>')); | 64 expect(parsedMember('Foo.<anonymous closure>'), equals('Foo.<fn>')); |
| 47 expect(parsedMember('<anonymous closure>.<anonymous closure>.bar'), | 65 expect(parsedMember('<anonymous closure>.<anonymous closure>.bar'), |
| 48 equals('<fn>.<fn>.bar')); | 66 equals('<fn>.<fn>.bar')); |
| 49 }); | 67 }); |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 equals('dart:core/uri.dart 5 in Foo')); | 544 equals('dart:core/uri.dart 5 in Foo')); |
| 527 }); | 545 }); |
| 528 | 546 |
| 529 test('prints relative paths as relative', () { | 547 test('prints relative paths as relative', () { |
| 530 var relative = path.normalize('relative/path/to/foo.dart'); | 548 var relative = path.normalize('relative/path/to/foo.dart'); |
| 531 expect(new Frame.parseFriendly('$relative 5:10 Foo').toString(), | 549 expect(new Frame.parseFriendly('$relative 5:10 Foo').toString(), |
| 532 equals('$relative 5:10 in Foo')); | 550 equals('$relative 5:10 in Foo')); |
| 533 }); | 551 }); |
| 534 }); | 552 }); |
| 535 } | 553 } |
| OLD | NEW |