Commit 7cf7a430 authored by Caitlin Potter's avatar Caitlin Potter Committed by Commit Bot

[cctest] add Async Generator bytecode tests

These were originally written as part of
https://chromium-review.googlesource.com/c/550396/. I've separated them
out into a separate CL with the intent of landing it first, so that it's
easier to see the difference these CLs will have on generated bytecode.

BUG=v8:5855
TBR=tebbi@chromium.org, rmcilroy@chromium.org

Change-Id: Ib84e65847d7396e31b0e38d28f59454cf7c58fc1
Reviewed-on: https://chromium-review.googlesource.com/558221Reviewed-by: 's avatarCaitlin Potter <caitp@igalia.com>
Commit-Queue: Caitlin Potter <caitp@igalia.com>
Cr-Commit-Position: refs/heads/master@{#46370}
parent 6c1e67f8
...@@ -2358,6 +2358,34 @@ TEST(Generators) { ...@@ -2358,6 +2358,34 @@ TEST(Generators) {
LoadGolden("Generators.golden"))); LoadGolden("Generators.golden")));
} }
TEST(AsyncGenerators) {
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"
"f();\n",
"async function* f() { yield 42 }\n"
"f();\n",
"async function* f() { for (let x of [42]) yield x }\n"
"f();\n",
"function* g() { yield 42 }\n"
"async function* f() { yield* g() }\n"
"f();\n",
};
CHECK(CompareTexts(BuildActual(printer, snippets),
LoadGolden("AsyncGenerators.golden")));
i::FLAG_harmony_async_iteration = old_flag;
}
TEST(Modules) { TEST(Modules) {
InitializedIgnitionHandleScope scope; InitializedIgnitionHandleScope scope;
BytecodeExpectationsPrinter printer(CcTest::isolate()); BytecodeExpectationsPrinter printer(CcTest::isolate());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment