@@ -249,6 +249,25 @@ void main() {
249
249
equals (Uri .parse ('https://dart.dev/foo/quux.dart' )));
250
250
});
251
251
252
+ test ('parses a package:stack_trace stack chain with end gap correctly' , () {
253
+ var trace =
254
+ Trace .parse ('https://dart.dev/foo/bar.dart 10:11 Foo.<fn>.bar\n '
255
+ 'https://dart.dev/foo/baz.dart Foo.<fn>.bar\n '
256
+ 'https://dart.dev/foo/bang.dart 10:11 Foo.<fn>.bar\n '
257
+ 'https://dart.dev/foo/quux.dart Foo.<fn>.bar'
258
+ '===== asynchronous gap ===========================\n ' );
259
+
260
+ expect (trace.frames.length, 4 );
261
+ expect (trace.frames[0 ].uri,
262
+ equals (Uri .parse ('https://dart.dev/foo/bar.dart' )));
263
+ expect (trace.frames[1 ].uri,
264
+ equals (Uri .parse ('https://dart.dev/foo/baz.dart' )));
265
+ expect (trace.frames[2 ].uri,
266
+ equals (Uri .parse ('https://dart.dev/foo/bang.dart' )));
267
+ expect (trace.frames[3 ].uri,
268
+ equals (Uri .parse ('https://dart.dev/foo/quux.dart' )));
269
+ });
270
+
252
271
test ('parses a real package:stack_trace stack trace correctly' , () {
253
272
var traceString = Trace .current ().toString ();
254
273
expect (Trace .parse (traceString).toString (), equals (traceString));
@@ -259,6 +278,28 @@ void main() {
259
278
expect (trace.frames, isEmpty);
260
279
expect (trace.toString (), equals ('' ));
261
280
});
281
+
282
+ test ('parses trace with async gap correctly' , () {
283
+ var trace = Trace .parse ('#0 bop (file:///pull.dart:42:23)\n '
284
+ '<asynchronous suspension>\n '
285
+ '#1 twist (dart:the/future.dart:0:2)\n '
286
+ '#2 main (dart:my/file.dart:4:6)\n ' );
287
+
288
+ expect (trace.frames.length, 3 );
289
+ expect (trace.frames[0 ].uri, equals (Uri .parse ('file:///pull.dart' )));
290
+ expect (trace.frames[1 ].uri, equals (Uri .parse ('dart:the/future.dart' )));
291
+ expect (trace.frames[2 ].uri, equals (Uri .parse ('dart:my/file.dart' )));
292
+ });
293
+
294
+ test ('parses trace with async gap at end correctly' , () {
295
+ var trace = Trace .parse ('#0 bop (file:///pull.dart:42:23)\n '
296
+ '#1 twist (dart:the/future.dart:0:2)\n '
297
+ '<asynchronous suspension>\n ' );
298
+
299
+ expect (trace.frames.length, 2 );
300
+ expect (trace.frames[0 ].uri, equals (Uri .parse ('file:///pull.dart' )));
301
+ expect (trace.frames[1 ].uri, equals (Uri .parse ('dart:the/future.dart' )));
302
+ });
262
303
});
263
304
264
305
test ('.toString() nicely formats the stack trace' , () {
0 commit comments