diff --git a/test/stream_queue_test.dart b/test/stream_queue_test.dart index 626eb16..002fa35 100644 --- a/test/stream_queue_test.dart +++ b/test/stream_queue_test.dart @@ -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 fort 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', () {