From 76cd14cf50269df3074e2904224db59b81802138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Wed, 30 Apr 2025 14:16:09 +0200 Subject: [PATCH] Rename non262-shell.js and remove no longer used non262.js --- harness/sm/assertThrowsValue.js | 24 ++++++++ harness/sm/non262-shell.js | 32 ----------- harness/sm/non262.js | 56 ------------------- test/staging/sm/Array/from_errors.js | 2 +- test/staging/sm/Array/to-length.js | 2 +- ...oString-arguments-before-parsing-params.js | 2 +- .../sm/Number/20.1.3.2-toExponential.js | 2 +- .../staging/sm/Number/20.1.3.2-toPrecision.js | 2 +- test/staging/sm/Proxy/getPrototypeOf.js | 2 +- test/staging/sm/Proxy/setPrototypeOf.js | 2 +- test/staging/sm/Reflect/apply.js | 2 +- test/staging/sm/Reflect/argumentsList.js | 2 +- test/staging/sm/Reflect/defineProperty.js | 2 +- test/staging/sm/Reflect/deleteProperty.js | 2 +- test/staging/sm/Reflect/isExtensible.js | 2 +- test/staging/sm/Reflect/preventExtensions.js | 2 +- test/staging/sm/Reflect/propertyKeys.js | 2 +- test/staging/sm/Reflect/set.js | 2 +- test/staging/sm/TypedArray/from_errors.js | 2 +- test/staging/sm/class/compPropNames.js | 2 +- .../sm/destructuring/array-iterator-close.js | 2 +- .../computed-property-side-effects.js | 2 +- .../sm/generators/delegating-yield-10.js | 2 +- .../sm/generators/delegating-yield-2.js | 2 +- .../sm/generators/yield-iterator-close.js | 2 +- .../generators/yield-star-iterator-close.js | 2 +- .../statements/for-of-iterator-close-throw.js | 2 +- .../sm/statements/for-of-iterator-close.js | 2 +- 28 files changed, 49 insertions(+), 113 deletions(-) create mode 100644 harness/sm/assertThrowsValue.js delete mode 100644 harness/sm/non262-shell.js delete mode 100644 harness/sm/non262.js diff --git a/harness/sm/assertThrowsValue.js b/harness/sm/assertThrowsValue.js new file mode 100644 index 0000000000..3058fe4f1b --- /dev/null +++ b/harness/sm/assertThrowsValue.js @@ -0,0 +1,24 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/*--- +defines: [assertThrowsValue] +---*/ + +function assertThrowsValue(f, val, msg) { + try { + f(); + } catch (exc) { + assert.sameValue(exc, val, msg); + return; + } + + var fullmsg = "Assertion failed: expected exception, no exception thrown"; + if (msg !== void 0) { + fullmsg += " - " + msg; + } + throw new Test262Error(fullmsg); +} diff --git a/harness/sm/non262-shell.js b/harness/sm/non262-shell.js deleted file mode 100644 index a14a3f1645..0000000000 --- a/harness/sm/non262-shell.js +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/*--- -defines: [assertThrowsValue] -allow_unused: True ----*/ - -(function() { - const undefined = void 0; - - if (typeof globalThis.assertThrowsValue === 'undefined') { - globalThis.assertThrowsValue = function assertThrowsValue(f, val, msg) { - var fullmsg; - try { - f(); - } catch (exc) { - if ((exc === val) === (val === val) && (val !== 0 || 1 / exc === 1 / val)) - return; - fullmsg = "Assertion failed: expected exception " + val + ", got " + exc; - } - if (fullmsg === undefined) - fullmsg = "Assertion failed: expected exception " + val + ", no exception thrown"; - if (msg !== undefined) - fullmsg += " - " + msg; - throw new Error(fullmsg); - }; - } -})(); diff --git a/harness/sm/non262.js b/harness/sm/non262.js deleted file mode 100644 index 89df923246..0000000000 --- a/harness/sm/non262.js +++ /dev/null @@ -1,56 +0,0 @@ -/*--- -defines: [assertThrownErrorContains, assertThrowsInstanceOfWithMessageCheck, newGlobal, print, assertEq, reportCompare, createIsHTMLDDA, createExternalArrayBuffer] ----*/ - -function assertThrownErrorContains(f, substr) { - try { - f(); - } catch (exc) { - // Do not test error messages - return; - } - throw new Test262Error("Expected error containing " + substr + ", no exception thrown"); -} - -function assertThrowsInstanceOfWithMessageCheck(f, ctor, _check, msg) { - var fullmsg; - try { - f(); - } catch (exc) { - if (exc instanceof ctor) - return; - fullmsg = `Assertion failed: expected exception ${ctor.name}, got ${exc}`; - } - - if (fullmsg === undefined) - fullmsg = `Assertion failed: expected exception ${ctor.name}, no exception thrown`; - if (msg !== undefined) - fullmsg += " - " + msg; - - throw new Error(fullmsg); -} - -globalThis.createNewGlobal = function() { - return $262.createRealm().global -} - -function print(...args) { -} -function assertEq(...args) { - assert.sameValue(...args) -} -function reportCompare(...args) { - assert.sameValue(...args) -} - -if (globalThis.createIsHTMLDDA === undefined) { - globalThis.createIsHTMLDDA = function createIsHTMLDDA() { - return $262.IsHTMLDDA; - } -} - -if (globalThis.createExternalArrayBuffer === undefined) { - globalThis.createExternalArrayBuffer = function createExternalArrayBuffer(size) { - return new ArrayBuffer(size); - } -} diff --git a/test/staging/sm/Array/from_errors.js b/test/staging/sm/Array/from_errors.js index b9eac3c410..6e6d86e533 100644 --- a/test/staging/sm/Array/from_errors.js +++ b/test/staging/sm/Array/from_errors.js @@ -4,7 +4,7 @@ */ /*--- -includes: [sm/non262-shell.js, deepEqual.js] +includes: [sm/assertThrowsValue.js, deepEqual.js] flags: - noStrict description: | diff --git a/test/staging/sm/Array/to-length.js b/test/staging/sm/Array/to-length.js index 32fbcbeb85..d53f6ca293 100644 --- a/test/staging/sm/Array/to-length.js +++ b/test/staging/sm/Array/to-length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -includes: [sm/non262-shell.js] +includes: [sm/assertThrowsValue.js] flags: - noStrict description: | diff --git a/test/staging/sm/Function/function-constructor-toString-arguments-before-parsing-params.js b/test/staging/sm/Function/function-constructor-toString-arguments-before-parsing-params.js index 17c983f27c..13f6a6efb7 100644 --- a/test/staging/sm/Function/function-constructor-toString-arguments-before-parsing-params.js +++ b/test/staging/sm/Function/function-constructor-toString-arguments-before-parsing-params.js @@ -4,7 +4,7 @@ */ /*--- -includes: [sm/non262-shell.js] +includes: [sm/assertThrowsValue.js] flags: - noStrict description: | diff --git a/test/staging/sm/Number/20.1.3.2-toExponential.js b/test/staging/sm/Number/20.1.3.2-toExponential.js index 13b1610cbe..20e3c3e0c1 100644 --- a/test/staging/sm/Number/20.1.3.2-toExponential.js +++ b/test/staging/sm/Number/20.1.3.2-toExponential.js @@ -4,7 +4,7 @@ */ /*--- -includes: [sm/non262-shell.js] +includes: [sm/assertThrowsValue.js] flags: - noStrict description: | diff --git a/test/staging/sm/Number/20.1.3.2-toPrecision.js b/test/staging/sm/Number/20.1.3.2-toPrecision.js index 92cacbf2ee..5e0bd99918 100644 --- a/test/staging/sm/Number/20.1.3.2-toPrecision.js +++ b/test/staging/sm/Number/20.1.3.2-toPrecision.js @@ -4,7 +4,7 @@ */ /*--- -includes: [sm/non262-shell.js] +includes: [sm/assertThrowsValue.js] flags: - noStrict description: | diff --git a/test/staging/sm/Proxy/getPrototypeOf.js b/test/staging/sm/Proxy/getPrototypeOf.js index 42d20b9828..5905cbe0a0 100644 --- a/test/staging/sm/Proxy/getPrototypeOf.js +++ b/test/staging/sm/Proxy/getPrototypeOf.js @@ -4,7 +4,7 @@ */ /*--- -includes: [sm/non262-shell.js] +includes: [sm/assertThrowsValue.js] flags: - noStrict description: | diff --git a/test/staging/sm/Proxy/setPrototypeOf.js b/test/staging/sm/Proxy/setPrototypeOf.js index 56c32beb21..1cdbf4c88a 100644 --- a/test/staging/sm/Proxy/setPrototypeOf.js +++ b/test/staging/sm/Proxy/setPrototypeOf.js @@ -4,7 +4,7 @@ */ /*--- -includes: [sm/non262-shell.js] +includes: [sm/assertThrowsValue.js] flags: - noStrict description: | diff --git a/test/staging/sm/Reflect/apply.js b/test/staging/sm/Reflect/apply.js index 9e08359152..d7003a5854 100644 --- a/test/staging/sm/Reflect/apply.js +++ b/test/staging/sm/Reflect/apply.js @@ -4,7 +4,7 @@ */ /*--- -includes: [sm/non262-shell.js] +includes: [sm/assertThrowsValue.js] flags: - noStrict description: | diff --git a/test/staging/sm/Reflect/argumentsList.js b/test/staging/sm/Reflect/argumentsList.js index b285241074..aba365d081 100644 --- a/test/staging/sm/Reflect/argumentsList.js +++ b/test/staging/sm/Reflect/argumentsList.js @@ -4,7 +4,7 @@ */ /*--- -includes: [sm/non262-shell.js, sm/non262-Reflect-shell.js, compareArray.js] +includes: [sm/assertThrowsValue.js, sm/non262-Reflect-shell.js, compareArray.js] flags: - noStrict description: | diff --git a/test/staging/sm/Reflect/defineProperty.js b/test/staging/sm/Reflect/defineProperty.js index 4fe60ad0d1..1a39a81be4 100644 --- a/test/staging/sm/Reflect/defineProperty.js +++ b/test/staging/sm/Reflect/defineProperty.js @@ -6,7 +6,7 @@ /*--- features: - IsHTMLDDA -includes: [sm/non262-shell.js, sm/non262-Reflect-shell.js, deepEqual.js] +includes: [sm/assertThrowsValue.js, sm/non262-Reflect-shell.js, deepEqual.js] flags: - noStrict description: | diff --git a/test/staging/sm/Reflect/deleteProperty.js b/test/staging/sm/Reflect/deleteProperty.js index 802009caee..1e68609c57 100644 --- a/test/staging/sm/Reflect/deleteProperty.js +++ b/test/staging/sm/Reflect/deleteProperty.js @@ -4,7 +4,7 @@ */ /*--- -includes: [sm/non262-shell.js, deepEqual.js] +includes: [sm/assertThrowsValue.js, deepEqual.js] flags: - noStrict description: | diff --git a/test/staging/sm/Reflect/isExtensible.js b/test/staging/sm/Reflect/isExtensible.js index 02f0bea207..a8bbd0a76d 100644 --- a/test/staging/sm/Reflect/isExtensible.js +++ b/test/staging/sm/Reflect/isExtensible.js @@ -4,7 +4,7 @@ */ /*--- -includes: [sm/non262-shell.js] +includes: [sm/assertThrowsValue.js] flags: - noStrict description: | diff --git a/test/staging/sm/Reflect/preventExtensions.js b/test/staging/sm/Reflect/preventExtensions.js index a17d834b81..6be0250ee0 100644 --- a/test/staging/sm/Reflect/preventExtensions.js +++ b/test/staging/sm/Reflect/preventExtensions.js @@ -4,7 +4,7 @@ */ /*--- -includes: [sm/non262-shell.js] +includes: [sm/assertThrowsValue.js] flags: - noStrict description: | diff --git a/test/staging/sm/Reflect/propertyKeys.js b/test/staging/sm/Reflect/propertyKeys.js index 9b4054b337..8a080f3863 100644 --- a/test/staging/sm/Reflect/propertyKeys.js +++ b/test/staging/sm/Reflect/propertyKeys.js @@ -4,7 +4,7 @@ */ /*--- -includes: [sm/non262-shell.js, compareArray.js, deepEqual.js] +includes: [sm/assertThrowsValue.js, compareArray.js, deepEqual.js] flags: - noStrict description: | diff --git a/test/staging/sm/Reflect/set.js b/test/staging/sm/Reflect/set.js index b2ae22225a..455a658365 100644 --- a/test/staging/sm/Reflect/set.js +++ b/test/staging/sm/Reflect/set.js @@ -4,7 +4,7 @@ */ /*--- -includes: [sm/non262-shell.js, sm/non262-Reflect-shell.js, deepEqual.js] +includes: [sm/assertThrowsValue.js, sm/non262-Reflect-shell.js, deepEqual.js] flags: - noStrict description: | diff --git a/test/staging/sm/TypedArray/from_errors.js b/test/staging/sm/TypedArray/from_errors.js index 5493fce31a..4b6e160d31 100644 --- a/test/staging/sm/TypedArray/from_errors.js +++ b/test/staging/sm/TypedArray/from_errors.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -includes: [sm/non262-shell.js, sm/non262-TypedArray-shell.js, deepEqual.js] +includes: [sm/assertThrowsValue.js, sm/non262-TypedArray-shell.js, deepEqual.js] flags: - noStrict description: | diff --git a/test/staging/sm/class/compPropNames.js b/test/staging/sm/class/compPropNames.js index ecfe992611..e9e5b6d5bc 100644 --- a/test/staging/sm/class/compPropNames.js +++ b/test/staging/sm/class/compPropNames.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -includes: [sm/non262-shell.js] +includes: [sm/assertThrowsValue.js] flags: - noStrict description: | diff --git a/test/staging/sm/destructuring/array-iterator-close.js b/test/staging/sm/destructuring/array-iterator-close.js index c7947373df..3dc6652650 100644 --- a/test/staging/sm/destructuring/array-iterator-close.js +++ b/test/staging/sm/destructuring/array-iterator-close.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -includes: [sm/non262-shell.js] +includes: [sm/assertThrowsValue.js] flags: - noStrict description: | diff --git a/test/staging/sm/expressions/computed-property-side-effects.js b/test/staging/sm/expressions/computed-property-side-effects.js index 3ba76f1f2c..5e6371daf0 100644 --- a/test/staging/sm/expressions/computed-property-side-effects.js +++ b/test/staging/sm/expressions/computed-property-side-effects.js @@ -4,7 +4,7 @@ */ /*--- -includes: [sm/non262-shell.js] +includes: [sm/assertThrowsValue.js] flags: - noStrict description: | diff --git a/test/staging/sm/generators/delegating-yield-10.js b/test/staging/sm/generators/delegating-yield-10.js index fc7444606b..ad5fc0c29d 100644 --- a/test/staging/sm/generators/delegating-yield-10.js +++ b/test/staging/sm/generators/delegating-yield-10.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -includes: [sm/non262-shell.js] +includes: [sm/assertThrowsValue.js] flags: - noStrict description: | diff --git a/test/staging/sm/generators/delegating-yield-2.js b/test/staging/sm/generators/delegating-yield-2.js index d0f31efda4..7849021f2d 100644 --- a/test/staging/sm/generators/delegating-yield-2.js +++ b/test/staging/sm/generators/delegating-yield-2.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -includes: [sm/non262-shell.js, sm/non262-generators-shell.js] +includes: [sm/assertThrowsValue.js, sm/non262-generators-shell.js] flags: - noStrict description: | diff --git a/test/staging/sm/generators/yield-iterator-close.js b/test/staging/sm/generators/yield-iterator-close.js index 5eed1f8b58..ee11d2e009 100644 --- a/test/staging/sm/generators/yield-iterator-close.js +++ b/test/staging/sm/generators/yield-iterator-close.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -includes: [sm/non262-shell.js] +includes: [sm/assertThrowsValue.js] flags: - noStrict description: | diff --git a/test/staging/sm/generators/yield-star-iterator-close.js b/test/staging/sm/generators/yield-star-iterator-close.js index 8ff469fa72..10c97dab13 100644 --- a/test/staging/sm/generators/yield-star-iterator-close.js +++ b/test/staging/sm/generators/yield-star-iterator-close.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -includes: [sm/non262-shell.js] +includes: [sm/assertThrowsValue.js] flags: - noStrict description: | diff --git a/test/staging/sm/statements/for-of-iterator-close-throw.js b/test/staging/sm/statements/for-of-iterator-close-throw.js index 7abd07f95d..30d6043c9e 100644 --- a/test/staging/sm/statements/for-of-iterator-close-throw.js +++ b/test/staging/sm/statements/for-of-iterator-close-throw.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -includes: [sm/non262-shell.js] +includes: [sm/assertThrowsValue.js] flags: - noStrict description: | diff --git a/test/staging/sm/statements/for-of-iterator-close.js b/test/staging/sm/statements/for-of-iterator-close.js index 5851d39a02..ae0443b0d5 100644 --- a/test/staging/sm/statements/for-of-iterator-close.js +++ b/test/staging/sm/statements/for-of-iterator-close.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -includes: [sm/non262-shell.js] +includes: [sm/assertThrowsValue.js] flags: - noStrict description: |