| 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 |
| 11 void main() { | 11 void main() { |
| 12 group('.parseVM', () { | 12 group('.parseVM', () { |
| 13 test('parses a stack frame correctly', () { | 13 test('parses a stack frame with column correctly', () { |
| 14 var frame = new Frame.parseVM("#1 Foo._bar " | 14 var frame = new Frame.parseVM("#1 Foo._bar " |
| 15 "(file:///home/nweiz/code/stuff.dart:42:21)"); | 15 "(file:///home/nweiz/code/stuff.dart:42:21)"); |
| 16 expect(frame.uri, | 16 expect(frame.uri, |
| 17 equals(Uri.parse("file:///home/nweiz/code/stuff.dart"))); | 17 equals(Uri.parse("file:///home/nweiz/code/stuff.dart"))); |
| 18 expect(frame.line, equals(42)); | 18 expect(frame.line, equals(42)); |
| 19 expect(frame.column, equals(21)); | 19 expect(frame.column, equals(21)); |
| 20 expect(frame.member, equals('Foo._bar')); | 20 expect(frame.member, equals('Foo._bar')); |
| 21 }); | 21 }); |
| 22 | 22 |
| 23 test('parses a stack frame without column correctly', () { |
| 24 var frame = new Frame.parseVM("#1 Foo._bar " |
| 25 "(file:///home/nweiz/code/stuff.dart:24)"); |
| 26 expect(frame.uri, |
| 27 equals(Uri.parse("file:///home/nweiz/code/stuff.dart"))); |
| 28 expect(frame.line, equals(24)); |
| 29 expect(frame.column, null); |
| 30 expect(frame.member, equals('Foo._bar')); |
| 31 }); |
| 32 |
| 23 test('converts "<anonymous closure>" to "<fn>"', () { | 33 test('converts "<anonymous closure>" to "<fn>"', () { |
| 24 String parsedMember(String member) => | 34 String parsedMember(String member) => |
| 25 new Frame.parseVM('#0 $member (foo:0:0)').member; | 35 new Frame.parseVM('#0 $member (foo:0:0)').member; |
| 26 | 36 |
| 27 expect(parsedMember('Foo.<anonymous closure>'), equals('Foo.<fn>')); | 37 expect(parsedMember('Foo.<anonymous closure>'), equals('Foo.<fn>')); |
| 28 expect(parsedMember('<anonymous closure>.<anonymous closure>.bar'), | 38 expect(parsedMember('<anonymous closure>.<anonymous closure>.bar'), |
| 29 equals('<fn>.<fn>.bar')); | 39 equals('<fn>.<fn>.bar')); |
| 30 }); | 40 }); |
| 31 | 41 |
| 32 test('parses a folded frame correctly', () { | 42 test('parses a folded frame correctly', () { |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 equals('http://dartlang.org/thing.dart 5:10 in Foo')); | 316 equals('http://dartlang.org/thing.dart 5:10 in Foo')); |
| 307 }); | 317 }); |
| 308 | 318 |
| 309 test('converts "<anonymous closure>" to "<fn>"', () { | 319 test('converts "<anonymous closure>" to "<fn>"', () { |
| 310 expect(new Frame.parseVM('#0 Foo.<anonymous closure> ' | 320 expect(new Frame.parseVM('#0 Foo.<anonymous closure> ' |
| 311 '(dart:core/uri.dart:5:10)').toString(), | 321 '(dart:core/uri.dart:5:10)').toString(), |
| 312 equals('dart:core/uri.dart 5:10 in Foo.<fn>')); | 322 equals('dart:core/uri.dart 5:10 in Foo.<fn>')); |
| 313 }); | 323 }); |
| 314 }); | 324 }); |
| 315 } | 325 } |
| OLD | NEW |