From 4d9d5c570d6b2668a5f7d9b4f2ef87a2a3c52c7a Mon Sep 17 00:00:00 2001 From: Cam Tenny Date: Thu, 29 Dec 2022 17:08:39 -0800 Subject: [PATCH] Refactor simple cases of (IIFE/async function).then(\$DONE, \$DONE); to use asyncTest --- .../expr-named/async-func-expr-named-no-strict.template | 5 +++-- .../expr-named/async-func-expr-named-strict-error.template | 5 +++-- .../expr-named/async-gen-func-expr-named-no-strict.template | 5 +++-- .../async-gen-func-expr-named-strict-error.template | 5 +++-- .../next/absent-value-not-passed.js | 5 +++-- .../return/absent-value-not-passed.js | 5 +++-- .../AsyncFromSyncIteratorPrototype/return/return-null.js | 5 +++-- .../next/request-queue-await-order.js | 3 ++- test/built-ins/Atomics/waitAsync/bigint/good-views.js | 6 +++--- test/built-ins/Atomics/waitAsync/good-views.js | 6 +++--- .../expressions/await/await-awaits-thenable-not-callable.js | 3 ++- .../expressions/await/await-awaits-thenables-that-throw.js | 3 ++- test/language/expressions/await/await-awaits-thenables.js | 3 ++- test/language/expressions/await/await-throws-rejections.js | 3 ++- ...ait-has-UnaryExpression-with-MultiplicativeExpression.js | 3 ++- .../expressions/await/syntax-await-has-UnaryExpression.js | 3 ++- .../dynamic-import/assignment-expression/additive-expr.js | 3 ++- .../dynamic-import/assignment-expression/array-literal.js | 3 ++- .../dynamic-import/assignment-expression/arrow-function.js | 3 ++- .../dynamic-import/assignment-expression/await-expr.js | 3 ++- .../assignment-expression/await-identifier.js | 3 ++- .../assignment-expression/call-expr-arguments.js | 3 ++- .../dynamic-import/assignment-expression/call-expr-expr.js | 3 ++- .../assignment-expression/call-expr-identifier.js | 3 ++- .../dynamic-import/assignment-expression/cover-call-expr.js | 3 ++- .../assignment-expression/cover-parenthesized-expr.js | 3 ++- .../dynamic-import/assignment-expression/identifier.js | 3 ++- .../lhs-assign-operator-assign-expr.js | 3 ++- .../assignment-expression/lhs-eq-assign-expr-nostrict.js | 3 ++- .../assignment-expression/lhs-eq-assign-expr.js | 3 ++- .../assignment-expression/logical-and-expr.js | 3 ++- .../dynamic-import/assignment-expression/logical-or-expr.js | 3 ++- .../dynamic-import/assignment-expression/member-expr.js | 3 ++- .../dynamic-import/assignment-expression/new-target.js | 3 ++- .../dynamic-import/assignment-expression/object-literal.js | 3 ++- .../assignment-expression/tagged-function-call.js | 3 ++- .../dynamic-import/assignment-expression/ternary.js | 3 ++- .../assignment-expression/yield-assign-expr.js | 3 ++- .../dynamic-import/assignment-expression/yield-expr.js | 3 ++- .../assignment-expression/yield-identifier.js | 3 ++- .../language/expressions/dynamic-import/custom-primitive.js | 3 ++- .../for-await-resolution-and-error-agen-yield.js | 3 ++- .../dynamic-import/for-await-resolution-and-error-agen.js | 3 ++- .../expressions/dynamic-import/imported-self-update.js | 1 + .../expressions/dynamic-import/update-to-dynamic-import.js | 3 ++- test/language/expressions/new.target/unary-expr.js | 5 +++-- .../optional-chaining/iteration-statement-for-await-of.js | 3 ++- .../optional-chaining/member-expression-async-identifier.js | 3 ++- .../optional-chaining/member-expression-async-literal.js | 3 ++- .../optional-chain-async-optional-chain-square-brackets.js | 3 ++- .../optional-chain-async-square-brackets.js | 3 ++- .../async-function/evaluation-this-value-global.js | 3 ++- .../iterator-close-non-throw-get-method-is-null.js | 5 +++-- 53 files changed, 116 insertions(+), 65 deletions(-) diff --git a/src/function-forms/expr-named/async-func-expr-named-no-strict.template b/src/function-forms/expr-named/async-func-expr-named-no-strict.template index bfb99bcff7..1c4612e0f3 100644 --- a/src/function-forms/expr-named/async-func-expr-named-no-strict.template +++ b/src/function-forms/expr-named/async-func-expr-named-no-strict.template @@ -12,6 +12,7 @@ info: | flags: [async, noStrict] features: [async-functions] +includes: [asyncHelpers.js] ---*/ // increment callCount in case "body" @@ -20,8 +21,8 @@ let ref = async function BindingIdentifier() { /*{ body }*/ }; -(async () => { +asyncTest(async () => { assert.sameValue(await ref(), ref); assert.sameValue(callCount, 1, 'function invoked exactly once'); -})().then($DONE, $DONE); +}); diff --git a/src/function-forms/expr-named/async-func-expr-named-strict-error.template b/src/function-forms/expr-named/async-func-expr-named-strict-error.template index e58a44f99a..1508e69d22 100644 --- a/src/function-forms/expr-named/async-func-expr-named-strict-error.template +++ b/src/function-forms/expr-named/async-func-expr-named-strict-error.template @@ -12,6 +12,7 @@ info: | features: [async-functions] flags: [async, onlyStrict] +includes: [asyncHelpers.js] ---*/ // increment callCount in case "body" @@ -20,7 +21,7 @@ let ref = async function BindingIdentifier() { /*{ body }*/ }; -(async () => { +asyncTest(async () => { let catchCount = 0; try { await ref() @@ -30,5 +31,5 @@ let ref = async function BindingIdentifier() { } assert.sameValue(catchCount, 1); assert.sameValue(callCount, 1); -})().then($DONE, $DONE); +}); diff --git a/src/function-forms/expr-named/async-gen-func-expr-named-no-strict.template b/src/function-forms/expr-named/async-gen-func-expr-named-no-strict.template index 3518f3aa72..6a333a7f01 100644 --- a/src/function-forms/expr-named/async-gen-func-expr-named-no-strict.template +++ b/src/function-forms/expr-named/async-gen-func-expr-named-no-strict.template @@ -10,6 +10,7 @@ info: | features: [async-iteration] flags: [async, noStrict] +includes: [asyncHelpers.js] ---*/ // increment callCount in case "body" @@ -18,8 +19,8 @@ let ref = async function * BindingIdentifier() { /*{ body }*/ }; -(async () => { +asyncTest(async () => { assert.sameValue((await (await ref()).next()).value, ref); assert.sameValue(callCount, 1, 'function invoked exactly once'); -})().then($DONE, $DONE); +}); diff --git a/src/function-forms/expr-named/async-gen-func-expr-named-strict-error.template b/src/function-forms/expr-named/async-gen-func-expr-named-strict-error.template index c95d75dd26..ee748d6b39 100644 --- a/src/function-forms/expr-named/async-gen-func-expr-named-strict-error.template +++ b/src/function-forms/expr-named/async-gen-func-expr-named-strict-error.template @@ -10,6 +10,7 @@ info: | features: [async-iteration] flags: [async, onlyStrict] +includes: [asyncHelpers.js] ---*/ // increment callCount in case "body" @@ -18,7 +19,7 @@ let ref = async function * BindingIdentifier() { /*{ body }*/ }; -(async () => { +asyncTest(async () => { let catchCount = 0; try { (await (await ref()).next()).value @@ -28,5 +29,5 @@ let ref = async function * BindingIdentifier() { } assert.sameValue(catchCount, 1); assert.sameValue(callCount, 1); -})().then($DONE, $DONE); +}); diff --git a/test/built-ins/AsyncFromSyncIteratorPrototype/next/absent-value-not-passed.js b/test/built-ins/AsyncFromSyncIteratorPrototype/next/absent-value-not-passed.js index 27ed797b2d..706a5fee53 100644 --- a/test/built-ins/AsyncFromSyncIteratorPrototype/next/absent-value-not-passed.js +++ b/test/built-ins/AsyncFromSyncIteratorPrototype/next/absent-value-not-passed.js @@ -16,6 +16,7 @@ info: | [...] flags: [async] features: [async-iteration] +includes: [asyncHelpers.js] ---*/ var nextArgumentsLength; @@ -29,8 +30,8 @@ var syncIterator = { }, }; -(async function () { +asyncTest(async function () { for await (let _ of syncIterator); assert.sameValue(nextArgumentsLength, 0); -})().then($DONE, $DONE); +}); diff --git a/test/built-ins/AsyncFromSyncIteratorPrototype/return/absent-value-not-passed.js b/test/built-ins/AsyncFromSyncIteratorPrototype/return/absent-value-not-passed.js index e654d5e74d..e423eaa9cf 100644 --- a/test/built-ins/AsyncFromSyncIteratorPrototype/return/absent-value-not-passed.js +++ b/test/built-ins/AsyncFromSyncIteratorPrototype/return/absent-value-not-passed.js @@ -16,6 +16,7 @@ info: | [...] flags: [async] features: [async-iteration] +includes: [asyncHelpers.js] ---*/ var returnArgumentsLength; @@ -32,10 +33,10 @@ var syncIterator = { }, }; -(async function () { +asyncTest(async function () { for await (let _ of syncIterator) { break; } assert.sameValue(returnArgumentsLength, 0); -})().then($DONE, $DONE); +}); diff --git a/test/built-ins/AsyncFromSyncIteratorPrototype/return/return-null.js b/test/built-ins/AsyncFromSyncIteratorPrototype/return/return-null.js index 1ca881ab5e..f3884fd45e 100644 --- a/test/built-ins/AsyncFromSyncIteratorPrototype/return/return-null.js +++ b/test/built-ins/AsyncFromSyncIteratorPrototype/return/return-null.js @@ -24,6 +24,7 @@ info: | 3. If func is either undefined or null, return undefined. flags: [async] features: [async-iteration] +includes: [asyncHelpers.js] ---*/ var iterationCount = 0; @@ -42,7 +43,7 @@ var syncIterator = { }, }; -(async function() { +asyncTest(async function() { for await (let _ of syncIterator) { iterationCount += 1; break; @@ -50,4 +51,4 @@ var syncIterator = { assert.sameValue(iterationCount, 1); assert.sameValue(returnGets, 1); -}()).then($DONE, $DONE); +}); diff --git a/test/built-ins/AsyncGeneratorPrototype/next/request-queue-await-order.js b/test/built-ins/AsyncGeneratorPrototype/next/request-queue-await-order.js index 23ce911b53..3fe03dd640 100644 --- a/test/built-ins/AsyncGeneratorPrototype/next/request-queue-await-order.js +++ b/test/built-ins/AsyncGeneratorPrototype/next/request-queue-await-order.js @@ -27,6 +27,7 @@ info: > flags: [async] features: [async-iteration] +includes: [asyncHelpers.js] ---*/ var yieldorder = 0; @@ -58,7 +59,7 @@ async function awaitnexts() { assert.sameValue((await item1).value, 1) } -awaitnexts().then($DONE, $DONE); +asyncTest(awaitnexts); // At this point: // yieldorder == 0 diff --git a/test/built-ins/Atomics/waitAsync/bigint/good-views.js b/test/built-ins/Atomics/waitAsync/bigint/good-views.js index 4b7e91c376..50a5131dd2 100644 --- a/test/built-ins/Atomics/waitAsync/bigint/good-views.js +++ b/test/built-ins/Atomics/waitAsync/bigint/good-views.js @@ -6,7 +6,7 @@ esid: sec-atomics.waitasync description: > Test Atomics.waitAsync on arrays that allow atomic operations flags: [async] -includes: [atomicsHelper.js] +includes: [atomicsHelper.js, asyncHelpers.js] features: [Atomics.waitAsync, Atomics, BigInt] ---*/ assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); @@ -44,7 +44,7 @@ $262.agent.start(` `); -(async () => { +asyncTest(async () => { const outcomes = []; for (let i = 0; i < 3; i++) { @@ -67,4 +67,4 @@ $262.agent.start(` 'C not-equal,not-equal,not-equal,not-equal,not-equal', 'The value of outcomes[2] is "C not-equal,not-equal,not-equal,not-equal,not-equal"' ); -})().then($DONE, $DONE); +}); diff --git a/test/built-ins/Atomics/waitAsync/good-views.js b/test/built-ins/Atomics/waitAsync/good-views.js index ddb1c3600b..cbe2cf31a0 100644 --- a/test/built-ins/Atomics/waitAsync/good-views.js +++ b/test/built-ins/Atomics/waitAsync/good-views.js @@ -6,7 +6,7 @@ esid: sec-atomics.waitasync description: > Test Atomics.waitAsync on arrays that allow atomic operations flags: [async] -includes: [atomicsHelper.js] +includes: [atomicsHelper.js, asyncHelpers.js] features: [Atomics.waitAsync, Atomics] ---*/ assert.sameValue(typeof Atomics.waitAsync, 'function', 'The value of `typeof Atomics.waitAsync` is "function"'); @@ -43,7 +43,7 @@ $262.agent.start(` `); -(async () => { +asyncTest(async () => { const outcomes = []; for (let i = 0; i < 3; i++) { @@ -66,4 +66,4 @@ $262.agent.start(` 'C not-equal,not-equal,not-equal,not-equal,not-equal', 'The value of outcomes[2] is "C not-equal,not-equal,not-equal,not-equal,not-equal"' ); -})().then($DONE, $DONE); +}); diff --git a/test/language/expressions/await/await-awaits-thenable-not-callable.js b/test/language/expressions/await/await-awaits-thenable-not-callable.js index 1737c55c4d..0e573a4171 100644 --- a/test/language/expressions/await/await-awaits-thenable-not-callable.js +++ b/test/language/expressions/await/await-awaits-thenable-not-callable.js @@ -8,6 +8,7 @@ description: > Await can await any thenable. If the thenable's then is not callable, await evaluates to the thenable flags: [async] +includes: [asyncHelpers.js] ---*/ async function foo() { @@ -16,5 +17,5 @@ async function foo() { assert.sameValue(res, thenable); } -foo().then($DONE, $DONE); +asyncTest(foo); diff --git a/test/language/expressions/await/await-awaits-thenables-that-throw.js b/test/language/expressions/await/await-awaits-thenables-that-throw.js index f00302d7e0..682ce5748d 100644 --- a/test/language/expressions/await/await-awaits-thenables-that-throw.js +++ b/test/language/expressions/await/await-awaits-thenables-that-throw.js @@ -7,6 +7,7 @@ esid: pending description: > Await can await any thenable. flags: [async] +includes: [asyncHelpers.js] ---*/ var error = {}; @@ -27,5 +28,5 @@ async function foo() { assert(caught); } -foo().then($DONE, $DONE); +asyncTest(foo); diff --git a/test/language/expressions/await/await-awaits-thenables.js b/test/language/expressions/await/await-awaits-thenables.js index 1f0aafa5ab..a2d8001ad3 100644 --- a/test/language/expressions/await/await-awaits-thenables.js +++ b/test/language/expressions/await/await-awaits-thenables.js @@ -7,6 +7,7 @@ esid: pending description: > Await can await any thenable. flags: [async] +includes: [asyncHelpers.js] ---*/ var thenable = { @@ -18,4 +19,4 @@ async function foo() { assert.sameValue(await thenable, 42); } -foo().then($DONE, $DONE); +asyncTest(foo); diff --git a/test/language/expressions/await/await-throws-rejections.js b/test/language/expressions/await/await-throws-rejections.js index 82229be0bb..ee41c726ab 100644 --- a/test/language/expressions/await/await-throws-rejections.js +++ b/test/language/expressions/await/await-throws-rejections.js @@ -7,6 +7,7 @@ esid: pending description: > Await throws errors from rejected promises flags: [async] +includes: [asyncHelpers.js] ---*/ async function foo() { @@ -22,4 +23,4 @@ async function foo() { assert(caught); } -foo().then($DONE, $DONE); +asyncTest(foo); diff --git a/test/language/expressions/await/syntax-await-has-UnaryExpression-with-MultiplicativeExpression.js b/test/language/expressions/await/syntax-await-has-UnaryExpression-with-MultiplicativeExpression.js index 27cbbe28b6..567b2aa9d2 100644 --- a/test/language/expressions/await/syntax-await-has-UnaryExpression-with-MultiplicativeExpression.js +++ b/test/language/expressions/await/syntax-await-has-UnaryExpression-with-MultiplicativeExpression.js @@ -7,6 +7,7 @@ esid: pending description: > Await's operand is a UnaryExpression flags: [async] +includes: [asyncHelpers.js] ---*/ async function foo() { @@ -14,4 +15,4 @@ async function foo() { let y = await Promise.resolve(2) * x assert.sameValue(y, 4); } -foo().then($DONE, $DONE); +asyncTest(foo); diff --git a/test/language/expressions/await/syntax-await-has-UnaryExpression.js b/test/language/expressions/await/syntax-await-has-UnaryExpression.js index 688b28ec2e..8cdc88503f 100644 --- a/test/language/expressions/await/syntax-await-has-UnaryExpression.js +++ b/test/language/expressions/await/syntax-await-has-UnaryExpression.js @@ -7,6 +7,7 @@ esid: pending description: > Await's operand is a UnaryExpression flags: [async] +includes: [asyncHelpers.js] ---*/ async function foo() { @@ -15,4 +16,4 @@ async function foo() { assert.sameValue(y, 1); assert.sameValue(x, 2); } -foo().then($DONE, $DONE); +asyncTest(foo); diff --git a/test/language/expressions/dynamic-import/assignment-expression/additive-expr.js b/test/language/expressions/dynamic-import/assignment-expression/additive-expr.js index ba1397507f..668f255ada 100644 --- a/test/language/expressions/dynamic-import/assignment-expression/additive-expr.js +++ b/test/language/expressions/dynamic-import/assignment-expression/additive-expr.js @@ -17,6 +17,7 @@ info: | LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] flags: [async] features: [dynamic-import] +includes: [asyncHelpers.js] ---*/ let x = './module-code'; @@ -37,4 +38,4 @@ async function fn() { assert.sameValue(ns2.default, 1612); } -fn().then($DONE, $DONE).catch($DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/assignment-expression/array-literal.js b/test/language/expressions/dynamic-import/assignment-expression/array-literal.js index 12ae65a44b..614cf3fc35 100644 --- a/test/language/expressions/dynamic-import/assignment-expression/array-literal.js +++ b/test/language/expressions/dynamic-import/assignment-expression/array-literal.js @@ -17,6 +17,7 @@ info: | LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] flags: [async] features: [dynamic-import] +includes: [asyncHelpers.js] ---*/ const a = './module-code_FIXTURE.js'; @@ -35,4 +36,4 @@ async function fn() { assert.sameValue(ns2.default, 1612); } -fn().then($DONE, $DONE).catch($DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/assignment-expression/arrow-function.js b/test/language/expressions/dynamic-import/assignment-expression/arrow-function.js index 9f79983e6e..04b4efe59b 100644 --- a/test/language/expressions/dynamic-import/assignment-expression/arrow-function.js +++ b/test/language/expressions/dynamic-import/assignment-expression/arrow-function.js @@ -17,6 +17,7 @@ info: | LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] flags: [async] features: [dynamic-import] +includes: [asyncHelpers.js] ---*/ Function.prototype.toString = () => './module-code_FIXTURE.js'; @@ -28,4 +29,4 @@ async function fn() { assert.sameValue(ns.default, 42); } -fn().then($DONE, $DONE).catch($DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/assignment-expression/await-expr.js b/test/language/expressions/dynamic-import/assignment-expression/await-expr.js index 998d7f6a36..7576645413 100644 --- a/test/language/expressions/dynamic-import/assignment-expression/await-expr.js +++ b/test/language/expressions/dynamic-import/assignment-expression/await-expr.js @@ -17,6 +17,7 @@ info: | LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] flags: [async] features: [dynamic-import] +includes: [asyncHelpers.js] ---*/ const a = './module-code_FIXTURE.js'; @@ -34,4 +35,4 @@ async function fn() { assert.sameValue(ns2.default, 1612); } -fn().then($DONE, $DONE).catch($DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/assignment-expression/await-identifier.js b/test/language/expressions/dynamic-import/assignment-expression/await-identifier.js index 7ceeaa2ce4..9d912579f1 100644 --- a/test/language/expressions/dynamic-import/assignment-expression/await-identifier.js +++ b/test/language/expressions/dynamic-import/assignment-expression/await-identifier.js @@ -17,6 +17,7 @@ info: | LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] flags: [async] features: [dynamic-import] +includes: [asyncHelpers.js] ---*/ const await = './module-code_FIXTURE.js'; @@ -30,4 +31,4 @@ async function fn() { assert.sameValue(ns1.default, 42); } -fn().then($DONE, $DONE).catch($DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/assignment-expression/call-expr-arguments.js b/test/language/expressions/dynamic-import/assignment-expression/call-expr-arguments.js index 408da815c0..e47eb3ae04 100644 --- a/test/language/expressions/dynamic-import/assignment-expression/call-expr-arguments.js +++ b/test/language/expressions/dynamic-import/assignment-expression/call-expr-arguments.js @@ -25,6 +25,7 @@ info: | CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await, +Tagged] flags: [async] features: [dynamic-import] +includes: [asyncHelpers.js] ---*/ const a = () => () => './module-code_FIXTURE.js'; @@ -42,4 +43,4 @@ async function fn() { assert.sameValue(ns2.default, 1612); } -fn().then($DONE, $DONE).catch($DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/assignment-expression/call-expr-expr.js b/test/language/expressions/dynamic-import/assignment-expression/call-expr-expr.js index 12d29ee378..93361546a9 100644 --- a/test/language/expressions/dynamic-import/assignment-expression/call-expr-expr.js +++ b/test/language/expressions/dynamic-import/assignment-expression/call-expr-expr.js @@ -25,6 +25,7 @@ info: | CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await, +Tagged] flags: [async] features: [dynamic-import] +includes: [asyncHelpers.js] ---*/ const a = () => ['./module-code_FIXTURE.js', './module-code-other_FIXTURE.js']; @@ -41,4 +42,4 @@ async function fn() { assert.sameValue(ns2.default, 1612); } -fn().then($DONE, $DONE).catch($DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/assignment-expression/call-expr-identifier.js b/test/language/expressions/dynamic-import/assignment-expression/call-expr-identifier.js index 8e0ed7f419..e8325fc731 100644 --- a/test/language/expressions/dynamic-import/assignment-expression/call-expr-identifier.js +++ b/test/language/expressions/dynamic-import/assignment-expression/call-expr-identifier.js @@ -25,6 +25,7 @@ info: | CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await, +Tagged] flags: [async] features: [dynamic-import] +includes: [asyncHelpers.js] ---*/ const a = () => ({ @@ -44,4 +45,4 @@ async function fn() { assert.sameValue(ns2.default, 1612); } -fn().then($DONE, $DONE).catch($DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/assignment-expression/cover-call-expr.js b/test/language/expressions/dynamic-import/assignment-expression/cover-call-expr.js index 46a4b4a90f..2b03333076 100644 --- a/test/language/expressions/dynamic-import/assignment-expression/cover-call-expr.js +++ b/test/language/expressions/dynamic-import/assignment-expression/cover-call-expr.js @@ -25,6 +25,7 @@ info: | CallExpression[?Yield, ?Await]TemplateLiteral[?Yield, ?Await, +Tagged] flags: [async] features: [dynamic-import] +includes: [asyncHelpers.js] ---*/ const a = () => './module-code_FIXTURE.js'; @@ -42,4 +43,4 @@ async function fn() { assert.sameValue(ns2.default, 1612); } -fn().then($DONE, $DONE).catch($DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/assignment-expression/cover-parenthesized-expr.js b/test/language/expressions/dynamic-import/assignment-expression/cover-parenthesized-expr.js index 029c1fff66..4157578d03 100644 --- a/test/language/expressions/dynamic-import/assignment-expression/cover-parenthesized-expr.js +++ b/test/language/expressions/dynamic-import/assignment-expression/cover-parenthesized-expr.js @@ -20,6 +20,7 @@ info: | (Expression[+In, ?Yield, ?Await]) flags: [async] features: [dynamic-import] +includes: [asyncHelpers.js] ---*/ async function fn() { @@ -34,4 +35,4 @@ async function fn() { assert.sameValue(ns2.default, 1612); } -fn().then($DONE, $DONE).catch($DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/assignment-expression/identifier.js b/test/language/expressions/dynamic-import/assignment-expression/identifier.js index 00fca55e4d..167fef9c46 100644 --- a/test/language/expressions/dynamic-import/assignment-expression/identifier.js +++ b/test/language/expressions/dynamic-import/assignment-expression/identifier.js @@ -17,6 +17,7 @@ info: | LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] flags: [async] features: [dynamic-import] +includes: [asyncHelpers.js] ---*/ const a = './module-code_FIXTURE.js'; @@ -34,4 +35,4 @@ async function fn() { assert.sameValue(ns2.default, 1612); } -fn().then($DONE, $DONE).catch($DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/assignment-expression/lhs-assign-operator-assign-expr.js b/test/language/expressions/dynamic-import/assignment-expression/lhs-assign-operator-assign-expr.js index a4ce9102c5..cb8301b5f9 100644 --- a/test/language/expressions/dynamic-import/assignment-expression/lhs-assign-operator-assign-expr.js +++ b/test/language/expressions/dynamic-import/assignment-expression/lhs-assign-operator-assign-expr.js @@ -17,6 +17,7 @@ info: | LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] flags: [async] features: [dynamic-import] +includes: [asyncHelpers.js] ---*/ let x = './module-code'; @@ -37,4 +38,4 @@ async function fn() { assert.sameValue(ns2.default, 1612); } -fn().then($DONE, $DONE).catch($DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/assignment-expression/lhs-eq-assign-expr-nostrict.js b/test/language/expressions/dynamic-import/assignment-expression/lhs-eq-assign-expr-nostrict.js index ed95de271e..cc017788d0 100644 --- a/test/language/expressions/dynamic-import/assignment-expression/lhs-eq-assign-expr-nostrict.js +++ b/test/language/expressions/dynamic-import/assignment-expression/lhs-eq-assign-expr-nostrict.js @@ -18,6 +18,7 @@ info: | LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] flags: [async, noStrict] features: [dynamic-import] +includes: [asyncHelpers.js] ---*/ const y = { @@ -33,4 +34,4 @@ async function fn() { assert.sameValue(ns2.default, 1612); } -fn().then($DONE, $DONE).catch($DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/assignment-expression/lhs-eq-assign-expr.js b/test/language/expressions/dynamic-import/assignment-expression/lhs-eq-assign-expr.js index 1c86637ecc..6fb208403c 100644 --- a/test/language/expressions/dynamic-import/assignment-expression/lhs-eq-assign-expr.js +++ b/test/language/expressions/dynamic-import/assignment-expression/lhs-eq-assign-expr.js @@ -17,6 +17,7 @@ info: | LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] flags: [async] features: [dynamic-import] +includes: [asyncHelpers.js] ---*/ let x = 'foo'; @@ -38,4 +39,4 @@ async function fn() { assert.sameValue(ns2.default, 1612); } -fn().then($DONE, $DONE).catch($DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/assignment-expression/logical-and-expr.js b/test/language/expressions/dynamic-import/assignment-expression/logical-and-expr.js index c3dafff48e..a7a04ae373 100644 --- a/test/language/expressions/dynamic-import/assignment-expression/logical-and-expr.js +++ b/test/language/expressions/dynamic-import/assignment-expression/logical-and-expr.js @@ -17,6 +17,7 @@ info: | LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] flags: [async] features: [dynamic-import] +includes: [asyncHelpers.js] ---*/ const a = './module-code_FIXTURE.js'; @@ -35,4 +36,4 @@ async function fn() { assert.sameValue(ns2.default, 1612); } -fn().then($DONE, $DONE).catch($DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/assignment-expression/logical-or-expr.js b/test/language/expressions/dynamic-import/assignment-expression/logical-or-expr.js index ef21597dbe..1d9cfc0206 100644 --- a/test/language/expressions/dynamic-import/assignment-expression/logical-or-expr.js +++ b/test/language/expressions/dynamic-import/assignment-expression/logical-or-expr.js @@ -17,6 +17,7 @@ info: | LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] flags: [async] features: [dynamic-import] +includes: [asyncHelpers.js] ---*/ const a = './module-code_FIXTURE.js'; @@ -34,4 +35,4 @@ async function fn() { assert.sameValue(ns2.default, 1612); } -fn().then($DONE, $DONE).catch($DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/assignment-expression/member-expr.js b/test/language/expressions/dynamic-import/assignment-expression/member-expr.js index dc08539f4d..6232cfb7fa 100644 --- a/test/language/expressions/dynamic-import/assignment-expression/member-expr.js +++ b/test/language/expressions/dynamic-import/assignment-expression/member-expr.js @@ -17,6 +17,7 @@ info: | LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] flags: [async] features: [dynamic-import] +includes: [asyncHelpers.js] ---*/ const obj = { @@ -38,4 +39,4 @@ async function fn() { assert.sameValue(ns2.default, 1612); } -fn().then($DONE, $DONE).catch($DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/assignment-expression/new-target.js b/test/language/expressions/dynamic-import/assignment-expression/new-target.js index 4151107b14..20c646910a 100644 --- a/test/language/expressions/dynamic-import/assignment-expression/new-target.js +++ b/test/language/expressions/dynamic-import/assignment-expression/new-target.js @@ -17,6 +17,7 @@ info: | LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] flags: [async] features: [dynamic-import, new.target] +includes: [asyncHelpers.js] ---*/ function ctor() { @@ -32,4 +33,4 @@ async function fn() { assert.sameValue(ns.default, 42); } -fn().then($DONE, $DONE).catch($DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/assignment-expression/object-literal.js b/test/language/expressions/dynamic-import/assignment-expression/object-literal.js index 2da6a88674..6f29e99e81 100644 --- a/test/language/expressions/dynamic-import/assignment-expression/object-literal.js +++ b/test/language/expressions/dynamic-import/assignment-expression/object-literal.js @@ -17,6 +17,7 @@ info: | LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] flags: [async] features: [dynamic-import] +includes: [asyncHelpers.js] ---*/ const a = './module-code_FIXTURE.js'; @@ -35,4 +36,4 @@ async function fn() { assert.sameValue(ns2.default, 1612); } -fn().then($DONE, $DONE).catch($DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/assignment-expression/tagged-function-call.js b/test/language/expressions/dynamic-import/assignment-expression/tagged-function-call.js index 5358593582..5286bde522 100644 --- a/test/language/expressions/dynamic-import/assignment-expression/tagged-function-call.js +++ b/test/language/expressions/dynamic-import/assignment-expression/tagged-function-call.js @@ -17,6 +17,7 @@ info: | LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] flags: [async] features: [dynamic-import] +includes: [asyncHelpers.js] ---*/ function tag(arg) { @@ -31,4 +32,4 @@ async function fn() { assert.sameValue(ns.default, 1612); } -fn().then($DONE, $DONE).catch($DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/assignment-expression/ternary.js b/test/language/expressions/dynamic-import/assignment-expression/ternary.js index 1494ba394d..520c8d54f1 100644 --- a/test/language/expressions/dynamic-import/assignment-expression/ternary.js +++ b/test/language/expressions/dynamic-import/assignment-expression/ternary.js @@ -17,6 +17,7 @@ info: | LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] flags: [async] features: [dynamic-import] +includes: [asyncHelpers.js] ---*/ const a = './module-code_FIXTURE.js'; @@ -34,4 +35,4 @@ async function fn() { assert.sameValue(ns2.default, 1612); } -fn().then($DONE, $DONE).catch($DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/assignment-expression/yield-assign-expr.js b/test/language/expressions/dynamic-import/assignment-expression/yield-assign-expr.js index be3749f82a..5475bf9e9e 100644 --- a/test/language/expressions/dynamic-import/assignment-expression/yield-assign-expr.js +++ b/test/language/expressions/dynamic-import/assignment-expression/yield-assign-expr.js @@ -17,6 +17,7 @@ info: | LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] flags: [async] features: [dynamic-import] +includes: [asyncHelpers.js] ---*/ const a = './module-code_FIXTURE.js'; @@ -44,4 +45,4 @@ async function fn() { assert.sameValue(ns2.default, 1612); } -fn().then($DONE, $DONE).catch($DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/assignment-expression/yield-expr.js b/test/language/expressions/dynamic-import/assignment-expression/yield-expr.js index 655b58ce99..575338a738 100644 --- a/test/language/expressions/dynamic-import/assignment-expression/yield-expr.js +++ b/test/language/expressions/dynamic-import/assignment-expression/yield-expr.js @@ -17,6 +17,7 @@ info: | LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] flags: [async] features: [dynamic-import] +includes: [asyncHelpers.js] ---*/ const a = './module-code_FIXTURE.js'; @@ -44,4 +45,4 @@ async function fn() { assert.sameValue(ns2.default, 1612); } -fn().then($DONE, $DONE).catch($DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/assignment-expression/yield-identifier.js b/test/language/expressions/dynamic-import/assignment-expression/yield-identifier.js index 09c761e225..fd69e288ef 100644 --- a/test/language/expressions/dynamic-import/assignment-expression/yield-identifier.js +++ b/test/language/expressions/dynamic-import/assignment-expression/yield-identifier.js @@ -17,6 +17,7 @@ info: | LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] flags: [async, noStrict] features: [dynamic-import] +includes: [asyncHelpers.js] ---*/ const yield = './module-code_FIXTURE.js'; @@ -28,4 +29,4 @@ async function fn() { assert.sameValue(ns1.default, 42); } -fn().then($DONE, $DONE).catch($DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/custom-primitive.js b/test/language/expressions/dynamic-import/custom-primitive.js index eee1707be5..74af503c0c 100644 --- a/test/language/expressions/dynamic-import/custom-primitive.js +++ b/test/language/expressions/dynamic-import/custom-primitive.js @@ -16,6 +16,7 @@ info: | f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). flags: [async] features: [dynamic-import] +includes: [asyncHelpers.js] ---*/ async function fn() { @@ -29,4 +30,4 @@ async function fn() { assert.sameValue(String(value), '42', 'namespace fallsback to valueOf as its prototype is null'); } -fn().then($DONE, $DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/for-await-resolution-and-error-agen-yield.js b/test/language/expressions/dynamic-import/for-await-resolution-and-error-agen-yield.js index cc6f1fce68..fde21b9166 100644 --- a/test/language/expressions/dynamic-import/for-await-resolution-and-error-agen-yield.js +++ b/test/language/expressions/dynamic-import/for-await-resolution-and-error-agen-yield.js @@ -16,6 +16,7 @@ info: | f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). flags: [async] features: [dynamic-import, async-iteration] +includes: [asyncHelpers.js] ---*/ async function * agen1() { @@ -66,4 +67,4 @@ async function fn() { assert.sameValue(error, 'foo', 'f'); } -fn().then($DONE, $DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/for-await-resolution-and-error-agen.js b/test/language/expressions/dynamic-import/for-await-resolution-and-error-agen.js index ca393f5b8a..03bcbe1b32 100644 --- a/test/language/expressions/dynamic-import/for-await-resolution-and-error-agen.js +++ b/test/language/expressions/dynamic-import/for-await-resolution-and-error-agen.js @@ -16,6 +16,7 @@ info: | f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). flags: [async] features: [dynamic-import, async-iteration] +includes: [asyncHelpers.js] ---*/ async function * agen() { @@ -48,4 +49,4 @@ async function fn() { assert.sameValue(error, 'foo'); } -fn().then($DONE, $DONE); +asyncTest(fn); diff --git a/test/language/expressions/dynamic-import/imported-self-update.js b/test/language/expressions/dynamic-import/imported-self-update.js index 0af479b614..02a26857bb 100644 --- a/test/language/expressions/dynamic-import/imported-self-update.js +++ b/test/language/expressions/dynamic-import/imported-self-update.js @@ -29,4 +29,5 @@ async function fn() { assert.sameValue(imported.y, 1, 'updated value, indirect binding'); } +// Do not use asyncTest: when self imported, $DONE is not defined, asyncTest will throw fn().then($DONE, $DONE); diff --git a/test/language/expressions/dynamic-import/update-to-dynamic-import.js b/test/language/expressions/dynamic-import/update-to-dynamic-import.js index d7ea33d6b3..dff1d95f1c 100644 --- a/test/language/expressions/dynamic-import/update-to-dynamic-import.js +++ b/test/language/expressions/dynamic-import/update-to-dynamic-import.js @@ -16,6 +16,7 @@ info: | f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). flags: [async] features: [dynamic-import] +includes: [asyncHelpers.js] ---*/ async function fn() { @@ -28,4 +29,4 @@ async function fn() { assert.sameValue(other.default, 42); } -fn().then($DONE, $DONE); +asyncTest(fn); diff --git a/test/language/expressions/new.target/unary-expr.js b/test/language/expressions/new.target/unary-expr.js index 0e3592c50d..9af940f504 100644 --- a/test/language/expressions/new.target/unary-expr.js +++ b/test/language/expressions/new.target/unary-expr.js @@ -15,6 +15,7 @@ info: | NewTarget features: [new.target, async-functions] flags: [async] +includes: [asyncHelpers.js] ---*/ (function() { assert.sameValue(delete (new.target), true); })(); @@ -26,6 +27,6 @@ new function() { assert.sameValue(~new.target, -1); }; (function() { assert.sameValue(!new.target, true); })(); new function() { assert.sameValue(delete void typeof +-~!(new.target), true); }; -(async function() { +asyncTest(async function() { assert.sameValue(await new.target, undefined); -})().then($DONE, $DONE); +}); diff --git a/test/language/expressions/optional-chaining/iteration-statement-for-await-of.js b/test/language/expressions/optional-chaining/iteration-statement-for-await-of.js index 6d414965ab..f28673d14c 100644 --- a/test/language/expressions/optional-chaining/iteration-statement-for-await-of.js +++ b/test/language/expressions/optional-chaining/iteration-statement-for-await-of.js @@ -9,6 +9,7 @@ info: | for await (LeftHandSideExpression of AssignmentExpression) Statement features: [optional-chaining] flags: [async] +includes: [asyncHelpers.js] ---*/ const obj = { iterable: { @@ -32,4 +33,4 @@ async function checkAssertions() { } assert.sameValue(3, count); } -checkAssertions().then($DONE, $DONE); +asyncTest(checkAssertions); diff --git a/test/language/expressions/optional-chaining/member-expression-async-identifier.js b/test/language/expressions/optional-chaining/member-expression-async-identifier.js index 19f9385eb5..e4836fe695 100644 --- a/test/language/expressions/optional-chaining/member-expression-async-identifier.js +++ b/test/language/expressions/optional-chaining/member-expression-async-identifier.js @@ -10,6 +10,7 @@ info: | MemberExpression [PrimaryExpression identifier] OptionalChain features: [optional-chaining] flags: [async] +includes: [asyncHelpers.js] ---*/ const a = undefined; @@ -29,4 +30,4 @@ async function checkAssertions() { c.e = Promise.resolve(39); assert.sameValue(await c?.e, 39, 'await unwraps the promise given after the evaluation of the OCE'); } -checkAssertions().then($DONE, $DONE); +asyncTest(checkAssertions); diff --git a/test/language/expressions/optional-chaining/member-expression-async-literal.js b/test/language/expressions/optional-chaining/member-expression-async-literal.js index 90cb7da026..a436722ba5 100644 --- a/test/language/expressions/optional-chaining/member-expression-async-literal.js +++ b/test/language/expressions/optional-chaining/member-expression-async-literal.js @@ -10,10 +10,11 @@ info: | MemberExpression [PrimaryExpression literal] OptionalChain features: [optional-chaining] flags: [async] +includes: [asyncHelpers.js] ---*/ async function checkAssertions() { assert.sameValue(await "hello"?.[0], 'h'); assert.sameValue(await null?.a, undefined); } -checkAssertions().then($DONE, $DONE); +asyncTest(checkAssertions); diff --git a/test/language/expressions/optional-chaining/optional-chain-async-optional-chain-square-brackets.js b/test/language/expressions/optional-chaining/optional-chain-async-optional-chain-square-brackets.js index 5d64ad4d0f..f15b0e1bd6 100644 --- a/test/language/expressions/optional-chaining/optional-chain-async-optional-chain-square-brackets.js +++ b/test/language/expressions/optional-chaining/optional-chain-async-optional-chain-square-brackets.js @@ -11,6 +11,7 @@ info: | OptionalChain OptionalChain ?.[Expression] features: [optional-chaining] flags: [async] +includes: [asyncHelpers.js] ---*/ async function checkAssertions() { @@ -25,4 +26,4 @@ async function checkAssertions() { await Promise.reject(new Error('unreachable')) ], undefined); } -checkAssertions().then($DONE, $DONE); +asyncTest(checkAssertions); diff --git a/test/language/expressions/optional-chaining/optional-chain-async-square-brackets.js b/test/language/expressions/optional-chaining/optional-chain-async-square-brackets.js index 0930d2eaf4..29bc214894 100644 --- a/test/language/expressions/optional-chaining/optional-chain-async-square-brackets.js +++ b/test/language/expressions/optional-chaining/optional-chain-async-square-brackets.js @@ -11,6 +11,7 @@ info: | OptionalChain ?.[Expression] features: [optional-chaining] flags: [async] +includes: [asyncHelpers.js] ---*/ async function checkAssertions() { @@ -21,4 +22,4 @@ async function checkAssertions() { await Promise.reject(new Error('unreachable')) ], undefined); } -checkAssertions().then($DONE, $DONE); +asyncTest(checkAssertions); diff --git a/test/language/statements/async-function/evaluation-this-value-global.js b/test/language/statements/async-function/evaluation-this-value-global.js index 7ba9e89350..abb191a851 100644 --- a/test/language/statements/async-function/evaluation-this-value-global.js +++ b/test/language/statements/async-function/evaluation-this-value-global.js @@ -7,6 +7,7 @@ esid: pending description: > The this value is set to the global object when not passed in sloppy mode. flags: [noStrict, async] +includes: [asyncHelpers.js] ---*/ var glob = this; @@ -14,4 +15,4 @@ async function foo() { assert.sameValue(this, glob); } -foo().then($DONE, $DONE); +asyncTest(foo); diff --git a/test/language/statements/for-await-of/iterator-close-non-throw-get-method-is-null.js b/test/language/statements/for-await-of/iterator-close-non-throw-get-method-is-null.js index bb60c757a1..06926f2996 100644 --- a/test/language/statements/for-await-of/iterator-close-non-throw-get-method-is-null.js +++ b/test/language/statements/for-await-of/iterator-close-non-throw-get-method-is-null.js @@ -21,6 +21,7 @@ info: | 3. If func is either undefined or null, return undefined. features: [Symbol.asyncIterator, async-iteration] flags: [async] +includes: [asyncHelpers.js] ---*/ var iterationCount = 0; @@ -39,7 +40,7 @@ iterable[Symbol.asyncIterator] = function() { }; }; -(async function() { +asyncTest(async function() { for await (var _ of iterable) { iterationCount += 1; break; @@ -47,4 +48,4 @@ iterable[Symbol.asyncIterator] = function() { assert.sameValue(iterationCount, 1); assert.sameValue(returnGets, 1); -}()).then($DONE, $DONE); +});