| 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 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:pathos/path.dart' as path; | 9 import 'package:pathos/path.dart' as path; |
| 10 import 'package:stack_trace/stack_trace.dart'; | 10 import 'package:stack_trace/stack_trace.dart'; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 group('.library', () { | 107 group('.library', () { |
| 108 test('returns the URI string for non-file URIs', () { | 108 test('returns the URI string for non-file URIs', () { |
| 109 expect(new Frame.parse('#0 Foo (dart:async/future.dart:0:0)').library, | 109 expect(new Frame.parse('#0 Foo (dart:async/future.dart:0:0)').library, |
| 110 equals('dart:async/future.dart')); | 110 equals('dart:async/future.dart')); |
| 111 expect(new Frame.parse('#0 Foo ' | 111 expect(new Frame.parse('#0 Foo ' |
| 112 '(http://dartlang.org/stuff/thing.dart:0:0)').library, | 112 '(http://dartlang.org/stuff/thing.dart:0:0)').library, |
| 113 equals('http://dartlang.org/stuff/thing.dart')); | 113 equals('http://dartlang.org/stuff/thing.dart')); |
| 114 }); | 114 }); |
| 115 | 115 |
| 116 test('returns the relative path for file URIs', () { | 116 test('returns the relative path for file URIs', () { |
| 117 var uri = path.toUri(path.join('foo', 'bar.dart')); | 117 expect(new Frame.parse('#0 Foo (foo/bar.dart:0:0)').library, |
| 118 expect(new Frame.parse('#0 Foo ($uri:0:0)').library, | 118 equals('foo/bar.dart')); |
| 119 equals(path.join('foo', 'bar.dart'))); | |
| 120 }); | 119 }); |
| 121 }); | 120 }); |
| 122 | 121 |
| 123 group('.location', () { | 122 group('.location', () { |
| 124 test('returns the library and line/column numbers for non-core ' | 123 test('returns the library and line/column numbers for non-core ' |
| 125 'libraries', () { | 124 'libraries', () { |
| 126 expect(new Frame.parse('#0 Foo ' | 125 expect(new Frame.parse('#0 Foo ' |
| 127 '(http://dartlang.org/thing.dart:5:10)').location, | 126 '(http://dartlang.org/thing.dart:5:10)').location, |
| 128 equals('http://dartlang.org/thing.dart 5:10')); | 127 equals('http://dartlang.org/thing.dart 5:10')); |
| 129 var uri = path.toUri(path.join('foo', 'bar.dart')); | 128 expect(new Frame.parse('#0 Foo (foo/bar.dart:1:2)').location, |
| 130 expect(new Frame.parse('#0 Foo ($uri:1:2)').location, | 129 equals('foo/bar.dart 1:2')); |
| 131 equals('${path.join('foo', 'bar.dart')} 1:2')); | |
| 132 }); | 130 }); |
| 133 }); | 131 }); |
| 134 | 132 |
| 135 group('.package', () { | 133 group('.package', () { |
| 136 test('returns null for non-package URIs', () { | 134 test('returns null for non-package URIs', () { |
| 137 expect(new Frame.parse('#0 Foo (dart:async/future.dart:0:0)').package, | 135 expect(new Frame.parse('#0 Foo (dart:async/future.dart:0:0)').package, |
| 138 isNull); | 136 isNull); |
| 139 expect(new Frame.parse('#0 Foo ' | 137 expect(new Frame.parse('#0 Foo ' |
| 140 '(http://dartlang.org/stuff/thing.dart:0:0)').package, | 138 '(http://dartlang.org/stuff/thing.dart:0:0)').package, |
| 141 isNull); | 139 isNull); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 157 equals('http://dartlang.org/thing.dart 5:10 in Foo')); | 155 equals('http://dartlang.org/thing.dart 5:10 in Foo')); |
| 158 }); | 156 }); |
| 159 | 157 |
| 160 test('converts "<anonymous closure>" to "<fn>"', () { | 158 test('converts "<anonymous closure>" to "<fn>"', () { |
| 161 expect(new Frame.parse('#0 Foo.<anonymous closure> ' | 159 expect(new Frame.parse('#0 Foo.<anonymous closure> ' |
| 162 '(dart:core/uri.dart:5:10)').toString(), | 160 '(dart:core/uri.dart:5:10)').toString(), |
| 163 equals('dart:core/uri.dart 5:10 in Foo.<fn>')); | 161 equals('dart:core/uri.dart 5:10 in Foo.<fn>')); |
| 164 }); | 162 }); |
| 165 }); | 163 }); |
| 166 } | 164 } |
| OLD | NEW |