@@ -157,6 +157,19 @@ Future awaitTimeout() async {
157157 await (throwAsync ().timeout (Duration (seconds: 1 )));
158158}
159159
160+ // ----
161+ // Scenario: Future.wait:
162+ // ----
163+
164+ Future awaitWait () async {
165+ await Future .wait ([
166+ throwAsync (),
167+ () async {
168+ await Future .value ();
169+ }()
170+ ]);
171+ }
172+
160173// Helpers:
161174
162175// We want lines that either start with a frame index or an async gap marker.
@@ -689,6 +702,48 @@ Future<void> doTestsCausal([String? debugInfoFilename]) async {
689702 r'^#6 _RawReceivePortImpl._handleMessage ' ,
690703 ],
691704 debugInfoFilename);
705+
706+ final awaitWaitExpected = const < String > [
707+ r'^#0 throwAsync \(.*/utils.dart:21(:3)?\)$' ,
708+ r'^^<asynchronous suspension>$' ,
709+ r'^#1 awaitWait ' ,
710+ ];
711+ await doTestAwait (
712+ awaitWait,
713+ awaitWaitExpected +
714+ const < String > [
715+ r'^#2 doTestAwait ' ,
716+ r'^#3 doTestsCausal ' ,
717+ r'^<asynchronous suspension>$' ,
718+ r'^#4 main \(.+\)$' ,
719+ r'^#5 _startIsolate.<anonymous closure> ' ,
720+ r'^#6 _RawReceivePortImpl._handleMessage ' ,
721+ ],
722+ debugInfoFilename);
723+ await doTestAwaitThen (
724+ awaitWait,
725+ awaitWaitExpected +
726+ const < String > [
727+ r'^#2 doTestAwaitThen ' ,
728+ r'^#3 doTestsCausal ' ,
729+ r'^<asynchronous suspension>$' ,
730+ r'^#4 main \(.+\)$' ,
731+ r'^#5 _startIsolate.<anonymous closure> ' ,
732+ r'^#6 _RawReceivePortImpl._handleMessage ' ,
733+ ],
734+ debugInfoFilename);
735+ await doTestAwaitCatchError (
736+ awaitWait,
737+ awaitWaitExpected +
738+ const < String > [
739+ r'^#2 doTestAwaitCatchError ' ,
740+ r'^#3 doTestsCausal ' ,
741+ r'^<asynchronous suspension>$' ,
742+ r'^#4 main \(.+\)$' ,
743+ r'^#5 _startIsolate.<anonymous closure> ' ,
744+ r'^#6 _RawReceivePortImpl._handleMessage ' ,
745+ ],
746+ debugInfoFilename);
692747}
693748
694749// For: --no-causal-async-stacks --no-lazy-async-stacks
@@ -1027,6 +1082,25 @@ Future<void> doTestsNoCausalNoLazy([String? debugInfoFilename]) async {
10271082 awaitTimeout, awaitTimeoutExpected + const < String > [], debugInfoFilename);
10281083 await doTestAwaitCatchError (
10291084 awaitTimeout, awaitTimeoutExpected + const < String > [], debugInfoFilename);
1085+
1086+ final awaitWaitExpected = const < String > [
1087+ r'#0 throwAsync \(.*/utils.dart:21(:3)?\)$' ,
1088+ r'^#1 _RootZone.runUnary ' ,
1089+ r'^#2 _FutureListener.handleValue ' ,
1090+ r'^#3 Future._propagateToListeners.handleValueCallback ' ,
1091+ r'^#4 Future._propagateToListeners ' ,
1092+ r'^#5 Future.(_addListener|_prependListeners).<anonymous closure> ' ,
1093+ r'^#6 _microtaskLoop ' ,
1094+ r'^#7 _startMicrotaskLoop ' ,
1095+ r'^#8 _runPendingImmediateCallback ' ,
1096+ r'^#9 _RawReceivePortImpl._handleMessage ' ,
1097+ ];
1098+ await doTestAwait (
1099+ awaitWait, awaitWaitExpected + const < String > [], debugInfoFilename);
1100+ await doTestAwaitThen (
1101+ awaitWait, awaitWaitExpected + const < String > [], debugInfoFilename);
1102+ await doTestAwaitCatchError (
1103+ awaitWait, awaitWaitExpected + const < String > [], debugInfoFilename);
10301104}
10311105
10321106// For: --lazy-async-stacks
@@ -1319,4 +1393,35 @@ Future<void> doTestsLazy([String? debugInfoFilename]) async {
13191393 debugInfoFilename);
13201394 await doTestAwaitCatchError (
13211395 awaitTimeout, awaitTimeoutExpected + const < String > [], debugInfoFilename);
1396+
1397+ final awaitWaitExpected = const < String > [
1398+ r'^#0 throwAsync \(.*/utils.dart:21(:3)?\)$' ,
1399+ r'^<asynchronous suspension>$' ,
1400+ r'^#1 Future.wait.<anonymous closure> \(dart:async/future.dart\)$' ,
1401+ r'^<asynchronous suspension>$' ,
1402+ r'^#2 awaitWait ' ,
1403+ r'^<asynchronous suspension>$' ,
1404+ ];
1405+ await doTestAwait (
1406+ awaitWait,
1407+ awaitWaitExpected +
1408+ const < String > [
1409+ r'^#3 doTestAwait ' ,
1410+ r'^<asynchronous suspension>$' ,
1411+ r'^#4 doTestsLazy ' ,
1412+ r'^<asynchronous suspension>$' ,
1413+ r'^#5 main ' ,
1414+ r'^<asynchronous suspension>$' ,
1415+ ],
1416+ debugInfoFilename);
1417+ await doTestAwaitThen (
1418+ awaitWait,
1419+ awaitWaitExpected +
1420+ const < String > [
1421+ r'^#3 doTestAwaitThen.<anonymous closure> ' ,
1422+ r'^<asynchronous suspension>$' ,
1423+ ],
1424+ debugInfoFilename);
1425+ await doTestAwaitCatchError (
1426+ awaitWait, awaitWaitExpected + const < String > [], debugInfoFilename);
13221427}
0 commit comments