From 7ec30cc7497500304823a6a36906319b52adf951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Wed, 30 Apr 2025 14:16:45 +0200 Subject: [PATCH] Replace SpiderMonkey-specific parseModule in async-functions/async-contains-unicode-escape.js and fix a test bug --- .../async-contains-unicode-escape-module.js | 17 +++++++++++++++++ .../async-contains-unicode-escape.js | 14 ++------------ 2 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 test/staging/sm/async-functions/async-contains-unicode-escape-module.js diff --git a/test/staging/sm/async-functions/async-contains-unicode-escape-module.js b/test/staging/sm/async-functions/async-contains-unicode-escape-module.js new file mode 100644 index 0000000000..fcf6d0f64d --- /dev/null +++ b/test/staging/sm/async-functions/async-contains-unicode-escape-module.js @@ -0,0 +1,17 @@ +// Copyright (C) 2024 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + async/await containing escapes +esid: pending +negative: + phase: parse + type: SyntaxError +flags: + - module +---*/ + +$DONOTEVALUATE(); + +export default \u0061sync function f() {} diff --git a/test/staging/sm/async-functions/async-contains-unicode-escape.js b/test/staging/sm/async-functions/async-contains-unicode-escape.js index 61dfa69bf6..3d208aedea 100644 --- a/test/staging/sm/async-functions/async-contains-unicode-escape.js +++ b/test/staging/sm/async-functions/async-contains-unicode-escape.js @@ -2,22 +2,15 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -flags: - - noStrict description: | async/await containing escapes esid: pending ---*/ -// Using "eval" as the argument name is fugly, but it means evals below are -// *direct* evals, and so their effects in the unescaped case won't extend -// past each separate |test| call (as would happen if we used a different name -// that made each eval into an indirect eval, affecting code in the global -// scope). -function test(code, eval) +function test(code) { var unescaped = code.replace("###", "async"); - var escaped = code.replace("###", "\\u0061"); + var escaped = code.replace("###", "\\u0061sync"); assert.throws(SyntaxError, () => eval(escaped)); eval(unescaped); @@ -34,9 +27,6 @@ test("var x = ### (y) => {}", eval); test("({ ### x() {} })", eval); test("var x = ### function f() {}", eval); -if (typeof parseModule === "function") - test("export default ### function f() {}", parseModule); - assert.throws(SyntaxError, () => eval("async await => 1;")); assert.throws(SyntaxError, () => eval("async aw\\u0061it => 1;"));