diff --git a/test/built-ins/RegExp/match-indices/indices-groups-object-undefined.js b/test/built-ins/RegExp/match-indices/indices-groups-object-undefined.js index a11d6d60e3..816edcd23b 100644 --- a/test/built-ins/RegExp/match-indices/indices-groups-object-undefined.js +++ b/test/built-ins/RegExp/match-indices/indices-groups-object-undefined.js @@ -5,7 +5,7 @@ description: The groups object of indices is created unconditionally. includes: [propertyHelper.js] esid: sec-makeindicesarray -features: [regexp-named-groups] +features: [regexp-named-groups, regexp-match-indices] info: | MakeIndicesArray ( S, indices, groupNames ) 8. If _groupNames_ is not *undefined*, then diff --git a/test/built-ins/RegExp/match-indices/indices-groups-object-unmatched.js b/test/built-ins/RegExp/match-indices/indices-groups-object-unmatched.js index 3f9d1cefa9..d34ef4020b 100644 --- a/test/built-ins/RegExp/match-indices/indices-groups-object-unmatched.js +++ b/test/built-ins/RegExp/match-indices/indices-groups-object-unmatched.js @@ -1,20 +1,20 @@ -// Copyright 2019 Ron Buckton. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -description: Test the groups object of indices with matched and unmatched named captures. -includes: [compareArray.js] -esid: sec-makeindicesarray -features: [regexp-named-groups] -info: | - MakeIndicesArray ( S, indices, groupNames ) - 11. For each integer _i_ such that _i_ >= 0 and _i_ < _n_, do - e. If _groupNames_ is not *undfined* and _groupNames_[_i_] is not *undefined*, then - i. Perform ! CreateDataProperty(_groups_, _groupNames_[_i_], _matchIndicesArray_). ----*/ - - -const re = /(?a).|(?x)/; -const result = re.exec("ab").indices; -assert.compareArray([0, 1], result.groups.a); -assert.sameValue(undefined, result.groups.x); +// Copyright 2019 Ron Buckton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Test the groups object of indices with matched and unmatched named captures. +includes: [compareArray.js] +esid: sec-makeindicesarray +features: [regexp-named-groups, regexp-match-indices] +info: | + MakeIndicesArray ( S, indices, groupNames ) + 11. For each integer _i_ such that _i_ >= 0 and _i_ < _n_, do + e. If _groupNames_ is not *undfined* and _groupNames_[_i_] is not *undefined*, then + i. Perform ! CreateDataProperty(_groups_, _groupNames_[_i_], _matchIndicesArray_). +---*/ + + +const re = /(?a).|(?x)/; +const result = re.exec("ab").indices; +assert.compareArray([0, 1], result.groups.a); +assert.sameValue(undefined, result.groups.x); diff --git a/test/built-ins/RegExp/match-indices/indices-groups-object.js b/test/built-ins/RegExp/match-indices/indices-groups-object.js index b9d9e75c78..5d02e1de90 100644 --- a/test/built-ins/RegExp/match-indices/indices-groups-object.js +++ b/test/built-ins/RegExp/match-indices/indices-groups-object.js @@ -1,40 +1,40 @@ -// Copyright 2019 Ron Buckton. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -description: The groups object of indices is created with CreateDataProperty -includes: [compareArray.js, propertyHelper.js] -esid: sec-makeindicesarray -features: [regexp-named-groups] -info: | - MakeIndicesArray ( S, indices, groupNames ) - 8. If _groupNames_ is not *undefined*, then - a. Let _groups_ be ! ObjectCreate(*null*). - 9. Else, - a. Let _groups_ be *undefined*. - 10. Perform ! CreateDataProperty(_A_, `"groups"`, _groups_). ----*/ - - -// `groups` is created with Define, not Set. -let counter = 0; -Object.defineProperty(Array.prototype, "groups", { - set() { counter++; } -}); - -let indices = /(?.)/.exec("a").indices; -assert.sameValue(counter, 0); - -// `groups` is writable, enumerable and configurable -// (from CreateDataProperty). -verifyProperty(indices, 'groups', { - writable: true, - enumerable: true, - configurable: true -}); - -// The `__proto__` property on the groups object is not special, -// and does not affect the [[Prototype]] of the resulting groups object. -let {groups} = /(?<__proto__>.)/.exec("a").indices; -assert.compareArray([0, 1], groups.__proto__); -assert.sameValue(null, Object.getPrototypeOf(groups)); +// Copyright 2019 Ron Buckton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: The groups object of indices is created with CreateDataProperty +includes: [compareArray.js, propertyHelper.js] +esid: sec-makeindicesarray +features: [regexp-named-groups, regexp-match-indices] +info: | + MakeIndicesArray ( S, indices, groupNames ) + 8. If _groupNames_ is not *undefined*, then + a. Let _groups_ be ! ObjectCreate(*null*). + 9. Else, + a. Let _groups_ be *undefined*. + 10. Perform ! CreateDataProperty(_A_, `"groups"`, _groups_). +---*/ + + +// `groups` is created with Define, not Set. +let counter = 0; +Object.defineProperty(Array.prototype, "groups", { + set() { counter++; } +}); + +let indices = /(?.)/.exec("a").indices; +assert.sameValue(counter, 0); + +// `groups` is writable, enumerable and configurable +// (from CreateDataProperty). +verifyProperty(indices, 'groups', { + writable: true, + enumerable: true, + configurable: true +}); + +// The `__proto__` property on the groups object is not special, +// and does not affect the [[Prototype]] of the resulting groups object. +let {groups} = /(?<__proto__>.)/.exec("a").indices; +assert.compareArray([0, 1], groups.__proto__); +assert.sameValue(null, Object.getPrototypeOf(groups)); diff --git a/test/built-ins/RegExp/match-indices/indices-groups-properties.js b/test/built-ins/RegExp/match-indices/indices-groups-properties.js index 1b2262a31c..f942195d9c 100644 --- a/test/built-ins/RegExp/match-indices/indices-groups-properties.js +++ b/test/built-ins/RegExp/match-indices/indices-groups-properties.js @@ -1,35 +1,35 @@ -// Copyright 2019 Ron Buckton. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -description: Properties of the groups object of indices are created with CreateDataProperty -includes: [compareArray.js, propertyHelper.js] -esid: sec-makeindicesarray -features: [regexp-named-groups] -info: | - MakeIndicesArray ( S, indices, groupNames ) - 11. For each integer _i_ such that _i_ >= 0 and _i_ < _n_, do - e. If _groupNames_ is not *undfined* and _groupNames_[_i_] is not *undefined*, then - i. Perform ! CreateDataProperty(_groups_, _groupNames_[_i_], _matchIndicesArray_). ----*/ - - -// Properties created on result.groups in textual order. -let groupNames = Object.getOwnPropertyNames(/(?.)|(?.)/u.exec("abcd").indices.groups); -assert.compareArray(groupNames, ["fst", "snd"]); - -// // Properties are created with Define, not Set -// let counter = 0; -// Object.defineProperty(Object.prototype, 'x', {set() { counter++; }}); - -let indices = /(?.)/.exec('a').indices; -let groups = indices.groups; -// assert.sameValue(counter, 0); - -// Properties are writable, enumerable and configurable -// (from CreateDataProperty) -verifyProperty(groups, 'x', { - writable: true, - enumerable: true, - configurable: true -}); +// Copyright 2019 Ron Buckton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Properties of the groups object of indices are created with CreateDataProperty +includes: [compareArray.js, propertyHelper.js] +esid: sec-makeindicesarray +features: [regexp-named-groups, regexp-match-indices] +info: | + MakeIndicesArray ( S, indices, groupNames ) + 11. For each integer _i_ such that _i_ >= 0 and _i_ < _n_, do + e. If _groupNames_ is not *undfined* and _groupNames_[_i_] is not *undefined*, then + i. Perform ! CreateDataProperty(_groups_, _groupNames_[_i_], _matchIndicesArray_). +---*/ + + +// Properties created on result.groups in textual order. +let groupNames = Object.getOwnPropertyNames(/(?.)|(?.)/u.exec("abcd").indices.groups); +assert.compareArray(groupNames, ["fst", "snd"]); + +// // Properties are created with Define, not Set +// let counter = 0; +// Object.defineProperty(Object.prototype, 'x', {set() { counter++; }}); + +let indices = /(?.)/.exec('a').indices; +let groups = indices.groups; +// assert.sameValue(counter, 0); + +// Properties are writable, enumerable and configurable +// (from CreateDataProperty) +verifyProperty(groups, 'x', { + writable: true, + enumerable: true, + configurable: true +});