Skip to content

Commit

Permalink
Regression test for error rejecting transaction (dart-archive/async#230)
Browse files Browse the repository at this point in the history
Towards dart-lang/async#229

Add a skipped test demonstrating the sequence of interaction with a
StreamQueueTransaction that leads to a `StateError` during the call to
`transaction.reject()`.
  • Loading branch information
natebosch authored Apr 19, 2023
1 parent d33b646 commit db3aeb8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pkgs/async/test/stream_queue_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,25 @@ void main() {
await flushMicrotasks();
controller.close();
});

test(
'can reject a transaction where one copy is fully consumed '
'in a transaction and a second copy is made', () async {
// Regression test for https://github.com/dart-lang/async/issues/229
final queue = StreamQueue(Stream.fromIterable([0]));
final transaction = queue.startTransaction();

final copy1 = transaction.newQueue();
final inner1 = copy1.startTransaction();
final innerCopy1 = inner1.newQueue();
await innerCopy1.next;

transaction.newQueue();

transaction.reject();
expect(await queue.next, 0);
expect(await queue.hasNext, isFalse);
}, skip: 'https://github.com/dart-lang/async/issues/229');
});

group('when committed', () {
Expand Down

0 comments on commit db3aeb8

Please sign in to comment.