[Test] Fixes chain/vm_test on ending async gaps. (#99)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b9918d5..25773bb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,8 @@
## 1.10.0-nullsafety.7-dev
+* Fix broken test, `test/chain/vm_test.dart`, which incorrectly handles
+ asynchronous suspension gap markers at the end of stack traces.
+
## 1.10.0-nullsafety.6
* Fix bug parsing asynchronous suspension gap markers at the end of stack
diff --git a/test/chain/vm_test.dart b/test/chain/vm_test.dart
index 8a66b83..9d82b2c 100644
--- a/test/chain/vm_test.dart
+++ b/test/chain/vm_test.dart
@@ -492,9 +492,13 @@
}
});
- var chain = Chain.forTrace(trace);
- expect(chain.traces,
- hasLength(vmChainGap.allMatches(trace.toString()).length + 1));
+ final chain = Chain.forTrace(trace);
+ final traceStr = trace.toString();
+ final gaps = vmChainGap.allMatches(traceStr);
+ // If the trace ends on a gap, there's no sub-trace following the gap.
+ final expectedLength =
+ (gaps.last.end == traceStr.length) ? gaps.length : gaps.length + 1;
+ expect(chain.traces, hasLength(expectedLength));
expect(
chain.traces.first.frames, contains(frameMember(startsWith('main'))));
});