| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 var frame = new Frame.parseFirefox( | 195 var frame = new Frame.parseFirefox( |
| 196 '.foo(12, "@)()/<")/.fn<@' | 196 '.foo(12, "@)()/<")/.fn<@' |
| 197 'http://pub.dartlang.org/stuff.dart.js:560'); | 197 'http://pub.dartlang.org/stuff.dart.js:560'); |
| 198 expect(frame.uri, | 198 expect(frame.uri, |
| 199 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js"))); | 199 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js"))); |
| 200 expect(frame.line, equals(560)); | 200 expect(frame.line, equals(560)); |
| 201 expect(frame.column, isNull); | 201 expect(frame.column, isNull); |
| 202 expect(frame.member, equals("foo.<fn>")); | 202 expect(frame.member, equals("foo.<fn>")); |
| 203 }); | 203 }); |
| 204 | 204 |
| 205 test('parses a deeply-nested anonymous stack frame with parameters ' |
| 206 'correctly', () { |
| 207 var frame = new Frame.parseFirefox( |
| 208 '.convertDartClosureToJS/\$function</<@' |
| 209 'http://pub.dartlang.org/stuff.dart.js:560'); |
| 210 expect(frame.uri, |
| 211 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js"))); |
| 212 expect(frame.line, equals(560)); |
| 213 expect(frame.column, isNull); |
| 214 expect(frame.member, equals("convertDartClosureToJS.<fn>.<fn>")); |
| 215 }); |
| 216 |
| 205 test('throws a FormatException for malformed frames', () { | 217 test('throws a FormatException for malformed frames', () { |
| 206 expect(() => new Frame.parseFirefox(''), throwsFormatException); | 218 expect(() => new Frame.parseFirefox(''), throwsFormatException); |
| 207 expect(() => new Frame.parseFirefox('.foo'), throwsFormatException); | 219 expect(() => new Frame.parseFirefox('.foo'), throwsFormatException); |
| 208 expect(() => new Frame.parseFirefox('.foo@dart:async/future.dart'), | 220 expect(() => new Frame.parseFirefox('.foo@dart:async/future.dart'), |
| 209 throwsFormatException); | 221 throwsFormatException); |
| 210 expect(() => new Frame.parseFirefox('.foo(@dart:async/future.dart:10'), | 222 expect(() => new Frame.parseFirefox('.foo(@dart:async/future.dart:10'), |
| 211 throwsFormatException); | 223 throwsFormatException); |
| 212 expect(() => new Frame.parseFirefox('@dart:async/future.dart'), | 224 expect(() => new Frame.parseFirefox('@dart:async/future.dart'), |
| 213 throwsFormatException); | 225 throwsFormatException); |
| 214 }); | 226 }); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 equals('http://dartlang.org/thing.dart 5:10 in Foo')); | 328 equals('http://dartlang.org/thing.dart 5:10 in Foo')); |
| 317 }); | 329 }); |
| 318 | 330 |
| 319 test('converts "<anonymous closure>" to "<fn>"', () { | 331 test('converts "<anonymous closure>" to "<fn>"', () { |
| 320 expect(new Frame.parseVM('#0 Foo.<anonymous closure> ' | 332 expect(new Frame.parseVM('#0 Foo.<anonymous closure> ' |
| 321 '(dart:core/uri.dart:5:10)').toString(), | 333 '(dart:core/uri.dart:5:10)').toString(), |
| 322 equals('dart:core/uri.dart 5:10 in Foo.<fn>')); | 334 equals('dart:core/uri.dart 5:10 in Foo.<fn>')); |
| 323 }); | 335 }); |
| 324 }); | 336 }); |
| 325 } | 337 } |
| OLD | NEW |