| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 test('parses a stack frame correctly', () { | 65 test('parses a stack frame correctly', () { |
| 66 var frame = new Frame.parseV8(" at VW.call\$0 " | 66 var frame = new Frame.parseV8(" at VW.call\$0 " |
| 67 "(http://pub.dartlang.org/stuff.dart.js:560:28)"); | 67 "(http://pub.dartlang.org/stuff.dart.js:560:28)"); |
| 68 expect(frame.uri, | 68 expect(frame.uri, |
| 69 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js"))); | 69 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js"))); |
| 70 expect(frame.line, equals(560)); | 70 expect(frame.line, equals(560)); |
| 71 expect(frame.column, equals(28)); | 71 expect(frame.column, equals(28)); |
| 72 expect(frame.member, equals('VW.call\$0')); | 72 expect(frame.member, equals('VW.call\$0')); |
| 73 }); | 73 }); |
| 74 | 74 |
| 75 test('parses a stack frame with an absolute POSIX path correctly', () { |
| 76 var frame = new Frame.parseV8(" at VW.call\$0 " |
| 77 "(/path/to/stuff.dart.js:560:28)"); |
| 78 expect(frame.uri, equals(Uri.parse("file:///path/to/stuff.dart.js"))); |
| 79 expect(frame.line, equals(560)); |
| 80 expect(frame.column, equals(28)); |
| 81 expect(frame.member, equals('VW.call\$0')); |
| 82 }); |
| 83 |
| 84 test('parses a stack frame with an absolute Windows path correctly', () { |
| 85 var frame = new Frame.parseV8(" at VW.call\$0 " |
| 86 r"(C:\path\to\stuff.dart.js:560:28)"); |
| 87 expect(frame.uri, equals(Uri.parse("file:///C:/path/to/stuff.dart.js"))); |
| 88 expect(frame.line, equals(560)); |
| 89 expect(frame.column, equals(28)); |
| 90 expect(frame.member, equals('VW.call\$0')); |
| 91 }); |
| 92 |
| 93 test('parses a stack frame with a Windows UNC path correctly', () { |
| 94 var frame = new Frame.parseV8(" at VW.call\$0 " |
| 95 r"(\\mount\path\to\stuff.dart.js:560:28)"); |
| 96 expect(frame.uri, |
| 97 equals(Uri.parse("file://mount/path/to/stuff.dart.js"))); |
| 98 expect(frame.line, equals(560)); |
| 99 expect(frame.column, equals(28)); |
| 100 expect(frame.member, equals('VW.call\$0')); |
| 101 }); |
| 102 |
| 103 test('parses a stack frame with a relative POSIX path correctly', () { |
| 104 var frame = new Frame.parseV8(" at VW.call\$0 " |
| 105 "(path/to/stuff.dart.js:560:28)"); |
| 106 expect(frame.uri, equals(Uri.parse("path/to/stuff.dart.js"))); |
| 107 expect(frame.line, equals(560)); |
| 108 expect(frame.column, equals(28)); |
| 109 expect(frame.member, equals('VW.call\$0')); |
| 110 }); |
| 111 |
| 112 test('parses a stack frame with a relative Windows path correctly', () { |
| 113 var frame = new Frame.parseV8(" at VW.call\$0 " |
| 114 r"(path\to\stuff.dart.js:560:28)"); |
| 115 expect(frame.uri, equals(Uri.parse("path/to/stuff.dart.js"))); |
| 116 expect(frame.line, equals(560)); |
| 117 expect(frame.column, equals(28)); |
| 118 expect(frame.member, equals('VW.call\$0')); |
| 119 }); |
| 120 |
| 75 test('parses an anonymous stack frame correctly', () { | 121 test('parses an anonymous stack frame correctly', () { |
| 76 var frame = new Frame.parseV8( | 122 var frame = new Frame.parseV8( |
| 77 " at http://pub.dartlang.org/stuff.dart.js:560:28"); | 123 " at http://pub.dartlang.org/stuff.dart.js:560:28"); |
| 78 expect(frame.uri, | 124 expect(frame.uri, |
| 79 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js"))); | 125 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js"))); |
| 80 expect(frame.line, equals(560)); | 126 expect(frame.line, equals(560)); |
| 81 expect(frame.column, equals(28)); | 127 expect(frame.column, equals(28)); |
| 82 expect(frame.member, equals('<fn>')); | 128 expect(frame.member, equals('<fn>')); |
| 83 }); | 129 }); |
| 84 | 130 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 test('parses a simple stack frame correctly', () { | 174 test('parses a simple stack frame correctly', () { |
| 129 var frame = new Frame.parseFirefox( | 175 var frame = new Frame.parseFirefox( |
| 130 ".VW.call\$0@http://pub.dartlang.org/stuff.dart.js:560"); | 176 ".VW.call\$0@http://pub.dartlang.org/stuff.dart.js:560"); |
| 131 expect(frame.uri, | 177 expect(frame.uri, |
| 132 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js"))); | 178 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js"))); |
| 133 expect(frame.line, equals(560)); | 179 expect(frame.line, equals(560)); |
| 134 expect(frame.column, isNull); | 180 expect(frame.column, isNull); |
| 135 expect(frame.member, equals('VW.call\$0')); | 181 expect(frame.member, equals('VW.call\$0')); |
| 136 }); | 182 }); |
| 137 | 183 |
| 184 test('parses a stack frame with an absolute POSIX path correctly', () { |
| 185 var frame = new Frame.parseFirefox( |
| 186 ".VW.call\$0@/path/to/stuff.dart.js:560"); |
| 187 expect(frame.uri, equals(Uri.parse("file:///path/to/stuff.dart.js"))); |
| 188 expect(frame.line, equals(560)); |
| 189 expect(frame.column, isNull); |
| 190 expect(frame.member, equals('VW.call\$0')); |
| 191 }); |
| 192 |
| 193 test('parses a stack frame with an absolute Windows path correctly', () { |
| 194 var frame = new Frame.parseFirefox( |
| 195 r".VW.call$0@C:\path\to\stuff.dart.js:560"); |
| 196 expect(frame.uri, equals(Uri.parse("file:///C:/path/to/stuff.dart.js"))); |
| 197 expect(frame.line, equals(560)); |
| 198 expect(frame.column, isNull); |
| 199 expect(frame.member, equals('VW.call\$0')); |
| 200 }); |
| 201 |
| 202 test('parses a stack frame with a Windows UNC path correctly', () { |
| 203 var frame = new Frame.parseFirefox( |
| 204 r".VW.call$0@\\mount\path\to\stuff.dart.js:560"); |
| 205 expect(frame.uri, |
| 206 equals(Uri.parse("file://mount/path/to/stuff.dart.js"))); |
| 207 expect(frame.line, equals(560)); |
| 208 expect(frame.column, isNull); |
| 209 expect(frame.member, equals('VW.call\$0')); |
| 210 }); |
| 211 |
| 212 test('parses a stack frame with a relative POSIX path correctly', () { |
| 213 var frame = new Frame.parseFirefox( |
| 214 ".VW.call\$0@path/to/stuff.dart.js:560"); |
| 215 expect(frame.uri, equals(Uri.parse("path/to/stuff.dart.js"))); |
| 216 expect(frame.line, equals(560)); |
| 217 expect(frame.column, isNull); |
| 218 expect(frame.member, equals('VW.call\$0')); |
| 219 }); |
| 220 |
| 221 test('parses a stack frame with a relative Windows path correctly', () { |
| 222 var frame = new Frame.parseFirefox( |
| 223 r".VW.call$0@path\to\stuff.dart.js:560"); |
| 224 expect(frame.uri, equals(Uri.parse("path/to/stuff.dart.js"))); |
| 225 expect(frame.line, equals(560)); |
| 226 expect(frame.column, isNull); |
| 227 expect(frame.member, equals('VW.call\$0')); |
| 228 }); |
| 229 |
| 138 test('parses a simple anonymous stack frame correctly', () { | 230 test('parses a simple anonymous stack frame correctly', () { |
| 139 var frame = new Frame.parseFirefox( | 231 var frame = new Frame.parseFirefox( |
| 140 "@http://pub.dartlang.org/stuff.dart.js:560"); | 232 "@http://pub.dartlang.org/stuff.dart.js:560"); |
| 141 expect(frame.uri, | 233 expect(frame.uri, |
| 142 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js"))); | 234 equals(Uri.parse("http://pub.dartlang.org/stuff.dart.js"))); |
| 143 expect(frame.line, equals(560)); | 235 expect(frame.line, equals(560)); |
| 144 expect(frame.column, isNull); | 236 expect(frame.column, isNull); |
| 145 expect(frame.member, equals("<fn>")); | 237 expect(frame.member, equals("<fn>")); |
| 146 }); | 238 }); |
| 147 | 239 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 '(dart:core/uri.dart:5:10)').toString(), | 481 '(dart:core/uri.dart:5:10)').toString(), |
| 390 equals('dart:core/uri.dart 5:10 in Foo.<fn>')); | 482 equals('dart:core/uri.dart 5:10 in Foo.<fn>')); |
| 391 }); | 483 }); |
| 392 | 484 |
| 393 test('prints a frame without a column correctly', () { | 485 test('prints a frame without a column correctly', () { |
| 394 expect(new Frame.parseVM('#0 Foo (dart:core/uri.dart:5)').toString(), | 486 expect(new Frame.parseVM('#0 Foo (dart:core/uri.dart:5)').toString(), |
| 395 equals('dart:core/uri.dart 5 in Foo')); | 487 equals('dart:core/uri.dart 5 in Foo')); |
| 396 }); | 488 }); |
| 397 }); | 489 }); |
| 398 } | 490 } |
| OLD | NEW |