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 80c16c8b41..e40412daf7 100644 --- a/test/built-ins/RegExp/match-indices/indices-groups-object.js +++ b/test/built-ins/RegExp/match-indices/indices-groups-object.js @@ -3,7 +3,7 @@ /*--- description: The groups object of indices is created with CreateDataProperty -includes: [compareArray.js] +includes: [propertyHelper.js, compareArray.js] esid: sec-makeindicesarray features: [regexp-named-groups, regexp-match-indices] info: | @@ -15,6 +15,23 @@ info: | 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; diff --git a/test/built-ins/RegExp/named-groups/groups-object.js b/test/built-ins/RegExp/named-groups/groups-object.js index 80eb0cd27f..32a85bf759 100644 --- a/test/built-ins/RegExp/named-groups/groups-object.js +++ b/test/built-ins/RegExp/named-groups/groups-object.js @@ -3,6 +3,7 @@ /*--- description: Properties of the groups object are created with CreateDataProperty +includes: [propertyHelper.js] esid: sec-regexpbuiltinexec features: [regexp-named-groups] info: | @@ -14,6 +15,23 @@ info: | 26. Perform ! CreateDataProperty(_A_, `"groups"`, _groups_). ---*/ +// `groups` is created with Define, not Set. +let counter = 0; +Object.defineProperty(Array.prototype, "groups", { + set() { counter++; } +}); + +let match = /(?.)/.exec("a"); +assert.sameValue(counter, 0); + +// `groups` is writable, enumerable and configurable +// (from CreateDataProperty). +verifyProperty(match, "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");