From d06c21c03a91662c055826a5de2a5557f0a20e25 Mon Sep 17 00:00:00 2001 From: ExE Boss <3889017+ExE-Boss@users.noreply.github.com> Date: Sun, 7 Jun 2020 18:40:00 +0200 Subject: [PATCH] =?UTF-8?q?Add=C2=A0tests=20for=C2=A0property=C2=A0descrip?= =?UTF-8?q?tors=20of=C2=A0legacy=C2=A0RegExp=C2=A0accessors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legacy-accessors/index/prop-desc.js | 32 ++++++++++++++ .../legacy-accessors/input/prop-desc.js | 42 +++++++++++++++++++ .../legacy-accessors/lastMatch/prop-desc.js | 39 +++++++++++++++++ .../legacy-accessors/lastParen/prop-desc.js | 39 +++++++++++++++++ .../legacy-accessors/leftContext/prop-desc.js | 39 +++++++++++++++++ .../rightContext/prop-desc.js | 39 +++++++++++++++++ 6 files changed, 230 insertions(+) create mode 100644 test/annexB/built-ins/RegExp/legacy-accessors/index/prop-desc.js create mode 100644 test/annexB/built-ins/RegExp/legacy-accessors/input/prop-desc.js create mode 100644 test/annexB/built-ins/RegExp/legacy-accessors/lastMatch/prop-desc.js create mode 100644 test/annexB/built-ins/RegExp/legacy-accessors/lastParen/prop-desc.js create mode 100644 test/annexB/built-ins/RegExp/legacy-accessors/leftContext/prop-desc.js create mode 100644 test/annexB/built-ins/RegExp/legacy-accessors/rightContext/prop-desc.js diff --git a/test/annexB/built-ins/RegExp/legacy-accessors/index/prop-desc.js b/test/annexB/built-ins/RegExp/legacy-accessors/index/prop-desc.js new file mode 100644 index 0000000000..2ed08f5ce8 --- /dev/null +++ b/test/annexB/built-ins/RegExp/legacy-accessors/index/prop-desc.js @@ -0,0 +1,32 @@ +// Copyright (C) 2020 ExE Boss. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: pending +description: Property descriptor for RegExp.$1-$9 +info: | + RegExp.$1-$9 are accessor properties with attributes + { + [[Enumerable]]: false, + [[Configurable]]: true, + [[Set]]: undefined, + } + + get RegExp.$1-$9 + + 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpParen1-9]]). +includes: [propertyHelper.js] +features: [legacy-regexp] +---*/ + +for (let i = 1; i <= 9; i++) { + const property = "$" + i; + const desc = Object.getOwnPropertyDescriptor(RegExp, property); + + assert.sameValue(desc.set, undefined, property + " setter"); + assert.sameValue(typeof desc.get, "function", property + " getter"); + + verifyProperty(RegExp, property, { + enumerable: false, + configurable: true + }); +} diff --git a/test/annexB/built-ins/RegExp/legacy-accessors/input/prop-desc.js b/test/annexB/built-ins/RegExp/legacy-accessors/input/prop-desc.js new file mode 100644 index 0000000000..37a60dd51e --- /dev/null +++ b/test/annexB/built-ins/RegExp/legacy-accessors/input/prop-desc.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 ExE Boss. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: pending +description: Property descriptor for RegExp.input +info: | + RegExp.input is an accessor property with attributes: + { + [[Enumerable]]: false, + [[Configurable]]: true, + } + + get RegExp.input + + 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpInput]]). + + set RegExp.input = val + + 1. Return ? SetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpInput]], val). +includes: [propertyHelper.js] +features: [legacy-regexp] +---*/ + +var desc = Object.getOwnPropertyDescriptor(RegExp, "input"); + +assert.sameValue(typeof desc.get, "function", "`get` property"); +assert.sameValue(typeof desc.set, "function", "`set` property"); + +verifyProperty(RegExp, "input", { + enumerable: false, + configurable: true +}); + +desc = Object.getOwnPropertyDescriptor(RegExp, "$_"); + +assert.sameValue(typeof desc.get, "function", "`get` property"); +assert.sameValue(typeof desc.set, "function", "`set` property"); + +verifyProperty(RegExp, "$_", { + enumerable: false, + configurable: true +}); diff --git a/test/annexB/built-ins/RegExp/legacy-accessors/lastMatch/prop-desc.js b/test/annexB/built-ins/RegExp/legacy-accessors/lastMatch/prop-desc.js new file mode 100644 index 0000000000..4aae87e79e --- /dev/null +++ b/test/annexB/built-ins/RegExp/legacy-accessors/lastMatch/prop-desc.js @@ -0,0 +1,39 @@ +// Copyright (C) 2020 ExE Boss. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: pending +description: Property descriptor for RegExp.lastMatch +info: | + RegExp.lastMatch is an accessor property with attributes: + { + [[Enumerable]]: false, + [[Configurable]]: true, + [[Set]]: undefined, + } + + get RegExp.lastMatch + + 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpLastMatch]]). +includes: [propertyHelper.js] +features: [legacy-regexp] +---*/ + +var desc = Object.getOwnPropertyDescriptor(RegExp, "lastMatch"); + +assert.sameValue(desc.set, undefined, "`set` property"); +assert.sameValue(typeof desc.get, "function", "`get` property"); + +verifyProperty(RegExp, "lastMatch", { + enumerable: false, + configurable: true +}); + +desc = Object.getOwnPropertyDescriptor(RegExp, "$&"); + +assert.sameValue(desc.set, undefined, "`set` property"); +assert.sameValue(typeof desc.get, "function", "`get` property"); + +verifyProperty(RegExp, "$&", { + enumerable: false, + configurable: true +}); diff --git a/test/annexB/built-ins/RegExp/legacy-accessors/lastParen/prop-desc.js b/test/annexB/built-ins/RegExp/legacy-accessors/lastParen/prop-desc.js new file mode 100644 index 0000000000..c4f76a3a56 --- /dev/null +++ b/test/annexB/built-ins/RegExp/legacy-accessors/lastParen/prop-desc.js @@ -0,0 +1,39 @@ +// Copyright (C) 2020 ExE Boss. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: pending +description: Property descriptor for RegExp.lastParen +info: | + RegExp.lastParen is an accessor property with attributes: + { + [[Enumerable]]: false, + [[Configurable]]: true, + [[Set]]: undefined, + } + + get RegExp.lastParen + + 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpLastParen]]). +includes: [propertyHelper.js] +features: [legacy-regexp] +---*/ + +var desc = Object.getOwnPropertyDescriptor(RegExp, "lastParen"); + +assert.sameValue(desc.set, undefined, "`set` property"); +assert.sameValue(typeof desc.get, "function", "`get` property"); + +verifyProperty(RegExp, "lastParen", { + enumerable: false, + configurable: true +}); + +desc = Object.getOwnPropertyDescriptor(RegExp, "$+"); + +assert.sameValue(desc.set, undefined, "`set` property"); +assert.sameValue(typeof desc.get, "function", "`get` property"); + +verifyProperty(RegExp, "$+", { + enumerable: false, + configurable: true +}); diff --git a/test/annexB/built-ins/RegExp/legacy-accessors/leftContext/prop-desc.js b/test/annexB/built-ins/RegExp/legacy-accessors/leftContext/prop-desc.js new file mode 100644 index 0000000000..1d76ca6011 --- /dev/null +++ b/test/annexB/built-ins/RegExp/legacy-accessors/leftContext/prop-desc.js @@ -0,0 +1,39 @@ +// Copyright (C) 2020 ExE Boss. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: pending +description: Property descriptor for RegExp.leftContext +info: | + RegExp.leftContext is an accessor property with attributes: + { + [[Enumerable]]: false, + [[Configurable]]: true, + [[Set]]: undefined, + } + + get RegExp.leftContext + + 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpLeftContext]]). +includes: [propertyHelper.js] +features: [legacy-regexp] +---*/ + +var desc = Object.getOwnPropertyDescriptor(RegExp, "leftContext"); + +assert.sameValue(desc.set, undefined, "`set` property"); +assert.sameValue(typeof desc.get, "function", "`get` property"); + +verifyProperty(RegExp, "leftContext", { + enumerable: false, + configurable: true +}); + +desc = Object.getOwnPropertyDescriptor(RegExp, "$`"); + +assert.sameValue(desc.set, undefined, "`set` property"); +assert.sameValue(typeof desc.get, "function", "`get` property"); + +verifyProperty(RegExp, "$`", { + enumerable: false, + configurable: true +}); diff --git a/test/annexB/built-ins/RegExp/legacy-accessors/rightContext/prop-desc.js b/test/annexB/built-ins/RegExp/legacy-accessors/rightContext/prop-desc.js new file mode 100644 index 0000000000..d154c5de3d --- /dev/null +++ b/test/annexB/built-ins/RegExp/legacy-accessors/rightContext/prop-desc.js @@ -0,0 +1,39 @@ +// Copyright (C) 2020 ExE Boss. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: pending +description: Property descriptor for RegExp.rightContext +info: | + RegExp.rightContext is an accessor property with attributes: + { + [[Enumerable]]: false, + [[Configurable]]: true, + [[Set]]: undefined, + } + + get RegExp.rightContext + + 1. Return ? GetLegacyRegExpStaticProperty(%RegExp%, this value, [[RegExpRightContext]]). +includes: [propertyHelper.js] +features: [legacy-regexp] +---*/ + +var desc = Object.getOwnPropertyDescriptor(RegExp, "rightContext"); + +assert.sameValue(desc.set, undefined, "`set` property"); +assert.sameValue(typeof desc.get, "function", "`get` property"); + +verifyProperty(RegExp, "rightContext", { + enumerable: false, + configurable: true +}); + +desc = Object.getOwnPropertyDescriptor(RegExp, "$'"); + +assert.sameValue(desc.set, undefined, "`set` property"); +assert.sameValue(typeof desc.get, "function", "`get` property"); + +verifyProperty(RegExp, "$'", { + enumerable: false, + configurable: true +});