Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1356)

Unified Diff: test/cctest/interpreter/test-bytecode-generator.cc

Issue 2645313003: [async-iteration] implement Async-from-Sync Iterator (Closed)
Patch Set: cleanmerge Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « test/cctest/interpreter/generate-bytecode-expectations.cc ('k') | test/mjsunit/harmony/async-from-sync-iterator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698