Index: test/cctest/interpreter/test-bytecode-generator.cc |
diff --git a/test/cctest/interpreter/test-bytecode-generator.cc b/test/cctest/interpreter/test-bytecode-generator.cc |
index 85c1c43874058dbfcc29eb75f95a21baf67504dd..5ee0a6fc3caf8216a320be5e803d222eeef4aaa0 100644 |
--- a/test/cctest/interpreter/test-bytecode-generator.cc |
+++ b/test/cctest/interpreter/test-bytecode-generator.cc |
@@ -2371,6 +2371,45 @@ TEST(NewAndSpread) { |
LoadGolden("NewAndSpread.golden"))); |
} |
+TEST(ForAwaitOf) { |
+ bool old_flag = i::FLAG_harmony_async_iteration; |
+ i::FLAG_harmony_async_iteration = true; |
+ InitializedIgnitionHandleScope scope; |
+ BytecodeExpectationsPrinter printer(CcTest::isolate()); |
+ printer.set_wrap(false); |
+ printer.set_test_function_name("f"); |
+ |
+ const char* snippets[] = { |
+ "async function f() {\n" |
+ " for await (let x of [1, 2, 3]) {}\n" |
+ "}\n" |
+ "f();\n", |
+ |
+ "async function f() {\n" |
+ " for await (let x of [1, 2, 3]) { return x; }\n" |
+ "}\n" |
+ "f();\n", |
+ |
+ "async function f() {\n" |
+ " for await (let x of [10, 20, 30]) {\n" |
+ " if (x == 10) continue;\n" |
+ " if (x == 20) break;\n" |
+ " }\n" |
+ "}\n" |
+ "f();\n", |
+ |
+ "async function f() {\n" |
+ " var x = { 'a': 1, 'b': 2 };\n" |
+ " for (x['a'] of [1,2,3]) { return x['a']; }\n" |
+ "}\n" |
+ "f();\n"}; |
+ |
+ CHECK(CompareTexts(BuildActual(printer, snippets), |
+ LoadGolden("ForAwaitOf.golden"))); |
+ |
+ i::FLAG_harmony_async_iteration = old_flag; |
+} |
+ |
} // namespace interpreter |
} // namespace internal |
} // namespace v8 |