From 2d6c419661d88ba73fef012329947f76c987225f Mon Sep 17 00:00:00 2001 From: FranklinDM Date: Sun, 7 May 2023 00:58:34 +0800 Subject: [PATCH] Issue #2234 - Part 3: Update tests Based on https://bugzilla.mozilla.org/show_bug.cgi?id=1402649 and https://bugzilla.mozilla.org/show_bug.cgi?id=1382306 --- js/src/jit-test/tests/modules/bug-1402649.js | 15 +++++++++++++++ .../async-function-declaration-in-modules.js | 13 +++++++++++++ .../async-generator-declaration-in-modules.js | 13 +++++++++++++ js/src/tests/ecma_2018/AsyncGenerators/browser.js | 0 js/src/tests/ecma_2018/AsyncGenerators/shell.js | 0 js/src/tests/ecma_2018/browser.js | 0 js/src/tests/ecma_2018/shell.js | 0 7 files changed, 41 insertions(+) create mode 100644 js/src/jit-test/tests/modules/bug-1402649.js create mode 100644 js/src/tests/ecma_2017/AsyncFunctions/async-function-declaration-in-modules.js create mode 100644 js/src/tests/ecma_2018/AsyncGenerators/async-generator-declaration-in-modules.js create mode 100644 js/src/tests/ecma_2018/AsyncGenerators/browser.js create mode 100644 js/src/tests/ecma_2018/AsyncGenerators/shell.js create mode 100644 js/src/tests/ecma_2018/browser.js create mode 100644 js/src/tests/ecma_2018/shell.js diff --git a/js/src/jit-test/tests/modules/bug-1402649.js b/js/src/jit-test/tests/modules/bug-1402649.js new file mode 100644 index 0000000000..2e5487210b --- /dev/null +++ b/js/src/jit-test/tests/modules/bug-1402649.js @@ -0,0 +1,15 @@ +if (!('oomTest' in this)) + quit(); + +loadFile(` +function parseAndEvaluate(source) { + let m = parseModule(source); + m.declarationInstantiation(); +} +parseAndEvaluate("async function a() { await 2 + 3; }") +`); +function loadFile(lfVarx) { + oomTest(function() { + eval(lfVarx); + }); +} diff --git a/js/src/tests/ecma_2017/AsyncFunctions/async-function-declaration-in-modules.js b/js/src/tests/ecma_2017/AsyncFunctions/async-function-declaration-in-modules.js new file mode 100644 index 0000000000..41cc37bf33 --- /dev/null +++ b/js/src/tests/ecma_2017/AsyncFunctions/async-function-declaration-in-modules.js @@ -0,0 +1,13 @@ +// |reftest| module + +async function f() { + return "success"; +} + +var AsyncFunction = (async function(){}).constructor; + +assertEq(f instanceof AsyncFunction, true); + +f().then(v => { + reportCompare("success", v); +}); diff --git a/js/src/tests/ecma_2018/AsyncGenerators/async-generator-declaration-in-modules.js b/js/src/tests/ecma_2018/AsyncGenerators/async-generator-declaration-in-modules.js new file mode 100644 index 0000000000..6cac859579 --- /dev/null +++ b/js/src/tests/ecma_2018/AsyncGenerators/async-generator-declaration-in-modules.js @@ -0,0 +1,13 @@ +// |reftest| module skip-if(release_or_beta) + +async function* f() { + return "success"; +} + +var AsyncGenerator = (async function*(){}).constructor; + +assertEq(f instanceof AsyncGenerator, true); + +f().next().then(v => { + reportCompare("success", v.value); +}); diff --git a/js/src/tests/ecma_2018/AsyncGenerators/browser.js b/js/src/tests/ecma_2018/AsyncGenerators/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/ecma_2018/AsyncGenerators/shell.js b/js/src/tests/ecma_2018/AsyncGenerators/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/ecma_2018/browser.js b/js/src/tests/ecma_2018/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/ecma_2018/shell.js b/js/src/tests/ecma_2018/shell.js new file mode 100644 index 0000000000..e69de29bb2