| 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 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 test('converts "<anonymous closure>" to "<fn>"', () { | 23 test('converts "<anonymous closure>" to "<fn>"', () { |
| 24 String parsedMember(String member) => | 24 String parsedMember(String member) => |
| 25 new Frame.parseVM('#0 $member (foo:0:0)').member; | 25 new Frame.parseVM('#0 $member (foo:0:0)').member; |
| 26 | 26 |
| 27 expect(parsedMember('Foo.<anonymous closure>'), equals('Foo.<fn>')); | 27 expect(parsedMember('Foo.<anonymous closure>'), equals('Foo.<fn>')); |
| 28 expect(parsedMember('<anonymous closure>.<anonymous closure>.bar'), | 28 expect(parsedMember('<anonymous closure>.<anonymous closure>.bar'), |
| 29 equals('<fn>.<fn>.bar')); | 29 equals('<fn>.<fn>.bar')); |
| 30 }); | 30 }); |
| 31 | 31 |
| 32 test('parses a folded frame correctly', () { |
| 33 var frame = new Frame.parseVM('...'); |
| 34 |
| 35 expect(frame.member, equals('...')); |
| 36 expect(frame.uri, equals(new Uri())); |
| 37 expect(frame.line, isNull); |
| 38 expect(frame.column, isNull); |
| 39 }); |
| 40 |
| 32 test('throws a FormatException for malformed frames', () { | 41 test('throws a FormatException for malformed frames', () { |
| 33 expect(() => new Frame.parseVM(''), throwsFormatException); | 42 expect(() => new Frame.parseVM(''), throwsFormatException); |
| 34 expect(() => new Frame.parseVM('#1'), throwsFormatException); | 43 expect(() => new Frame.parseVM('#1'), throwsFormatException); |
| 35 expect(() => new Frame.parseVM('#1 Foo'), throwsFormatException); | 44 expect(() => new Frame.parseVM('#1 Foo'), throwsFormatException); |
| 36 expect(() => new Frame.parseVM('#1 Foo (dart:async/future.dart)'), | 45 expect(() => new Frame.parseVM('#1 Foo (dart:async/future.dart)'), |
| 37 throwsFormatException); | 46 throwsFormatException); |
| 38 expect(() => new Frame.parseVM('#1 Foo (dart:async/future.dart:10)'), | 47 expect(() => new Frame.parseVM('#1 Foo (dart:async/future.dart:10)'), |
| 39 throwsFormatException); | 48 throwsFormatException); |
| 40 expect(() => new Frame.parseVM('#1 (dart:async/future.dart:10:15)'), | 49 expect(() => new Frame.parseVM('#1 (dart:async/future.dart:10:15)'), |
| 41 throwsFormatException); | 50 throwsFormatException); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 equals('http://dartlang.org/thing.dart 5:10 in Foo')); | 296 equals('http://dartlang.org/thing.dart 5:10 in Foo')); |
| 288 }); | 297 }); |
| 289 | 298 |
| 290 test('converts "<anonymous closure>" to "<fn>"', () { | 299 test('converts "<anonymous closure>" to "<fn>"', () { |
| 291 expect(new Frame.parseVM('#0 Foo.<anonymous closure> ' | 300 expect(new Frame.parseVM('#0 Foo.<anonymous closure> ' |
| 292 '(dart:core/uri.dart:5:10)').toString(), | 301 '(dart:core/uri.dart:5:10)').toString(), |
| 293 equals('dart:core/uri.dart 5:10 in Foo.<fn>')); | 302 equals('dart:core/uri.dart 5:10 in Foo.<fn>')); |
| 294 }); | 303 }); |
| 295 }); | 304 }); |
| 296 } | 305 } |
| OLD | NEW |