File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
graal-js/src/com.oracle.truffle.js.test/src/com/oracle/truffle/js/test/interop Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -607,6 +607,28 @@ public void asyncCaseSwitch() {
607607 }
608608 }
609609
610+ @ Test
611+ public void testAwaitInSwitchInLoop () {
612+ TestOutput out = new TestOutput ();
613+ try (Context context = JSTest .newContextBuilder ().out (out ).build ()) {
614+ context .eval ("js" , "" //
615+ + "(async function () {" //
616+ + " for (o of ['a', 'b']) {" //
617+ + " switch (o) {" //
618+ + " case 'a':" //
619+ + " await 42;" //
620+ + " console.log('seen a');" //
621+ + " break;" //
622+ + " case 'b':" //
623+ + " console.log('seen b');" //
624+ + " break;" //
625+ + " }" //
626+ + " }" //
627+ + "})();" );
628+ assertEquals ("seen a\n seen b\n " , out .toString ());
629+ }
630+ }
631+
610632 private static Function <String , CompletionStage <String >> asChainable (Value jsFunction ) {
611633 assert jsFunction .canExecute ();
612634 return v -> {
You can’t perform that action at this time.
0 commit comments