mirror of https://github.com/tc39/test262.git
Add missing `regexp-match-indices` feature tags (#2395)
This commit is contained in:
parent
8688c4ab79
commit
a898fe9826
|
@ -5,7 +5,7 @@
|
||||||
description: The groups object of indices is created unconditionally.
|
description: The groups object of indices is created unconditionally.
|
||||||
includes: [propertyHelper.js]
|
includes: [propertyHelper.js]
|
||||||
esid: sec-makeindicesarray
|
esid: sec-makeindicesarray
|
||||||
features: [regexp-named-groups]
|
features: [regexp-named-groups, regexp-match-indices]
|
||||||
info: |
|
info: |
|
||||||
MakeIndicesArray ( S, indices, groupNames )
|
MakeIndicesArray ( S, indices, groupNames )
|
||||||
8. If _groupNames_ is not *undefined*, then
|
8. If _groupNames_ is not *undefined*, then
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
// Copyright 2019 Ron Buckton. All rights reserved.
|
// Copyright 2019 Ron Buckton. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// 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.
|
description: Test the groups object of indices with matched and unmatched named captures.
|
||||||
includes: [compareArray.js]
|
includes: [compareArray.js]
|
||||||
esid: sec-makeindicesarray
|
esid: sec-makeindicesarray
|
||||||
features: [regexp-named-groups]
|
features: [regexp-named-groups, regexp-match-indices]
|
||||||
info: |
|
info: |
|
||||||
MakeIndicesArray ( S, indices, groupNames )
|
MakeIndicesArray ( S, indices, groupNames )
|
||||||
11. For each integer _i_ such that _i_ >= 0 and _i_ < _n_, do
|
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
|
e. If _groupNames_ is not *undfined* and _groupNames_[_i_] is not *undefined*, then
|
||||||
i. Perform ! CreateDataProperty(_groups_, _groupNames_[_i_], _matchIndicesArray_).
|
i. Perform ! CreateDataProperty(_groups_, _groupNames_[_i_], _matchIndicesArray_).
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
|
||||||
const re = /(?<a>a).|(?<x>x)/;
|
const re = /(?<a>a).|(?<x>x)/;
|
||||||
const result = re.exec("ab").indices;
|
const result = re.exec("ab").indices;
|
||||||
assert.compareArray([0, 1], result.groups.a);
|
assert.compareArray([0, 1], result.groups.a);
|
||||||
assert.sameValue(undefined, result.groups.x);
|
assert.sameValue(undefined, result.groups.x);
|
||||||
|
|
|
@ -1,40 +1,40 @@
|
||||||
// Copyright 2019 Ron Buckton. All rights reserved.
|
// Copyright 2019 Ron Buckton. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
description: The groups object of indices is created with CreateDataProperty
|
description: The groups object of indices is created with CreateDataProperty
|
||||||
includes: [compareArray.js, propertyHelper.js]
|
includes: [compareArray.js, propertyHelper.js]
|
||||||
esid: sec-makeindicesarray
|
esid: sec-makeindicesarray
|
||||||
features: [regexp-named-groups]
|
features: [regexp-named-groups, regexp-match-indices]
|
||||||
info: |
|
info: |
|
||||||
MakeIndicesArray ( S, indices, groupNames )
|
MakeIndicesArray ( S, indices, groupNames )
|
||||||
8. If _groupNames_ is not *undefined*, then
|
8. If _groupNames_ is not *undefined*, then
|
||||||
a. Let _groups_ be ! ObjectCreate(*null*).
|
a. Let _groups_ be ! ObjectCreate(*null*).
|
||||||
9. Else,
|
9. Else,
|
||||||
a. Let _groups_ be *undefined*.
|
a. Let _groups_ be *undefined*.
|
||||||
10. Perform ! CreateDataProperty(_A_, `"groups"`, _groups_).
|
10. Perform ! CreateDataProperty(_A_, `"groups"`, _groups_).
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
|
||||||
// `groups` is created with Define, not Set.
|
// `groups` is created with Define, not Set.
|
||||||
let counter = 0;
|
let counter = 0;
|
||||||
Object.defineProperty(Array.prototype, "groups", {
|
Object.defineProperty(Array.prototype, "groups", {
|
||||||
set() { counter++; }
|
set() { counter++; }
|
||||||
});
|
});
|
||||||
|
|
||||||
let indices = /(?<x>.)/.exec("a").indices;
|
let indices = /(?<x>.)/.exec("a").indices;
|
||||||
assert.sameValue(counter, 0);
|
assert.sameValue(counter, 0);
|
||||||
|
|
||||||
// `groups` is writable, enumerable and configurable
|
// `groups` is writable, enumerable and configurable
|
||||||
// (from CreateDataProperty).
|
// (from CreateDataProperty).
|
||||||
verifyProperty(indices, 'groups', {
|
verifyProperty(indices, 'groups', {
|
||||||
writable: true,
|
writable: true,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
|
||||||
// The `__proto__` property on the groups object is not special,
|
// The `__proto__` property on the groups object is not special,
|
||||||
// and does not affect the [[Prototype]] of the resulting groups object.
|
// and does not affect the [[Prototype]] of the resulting groups object.
|
||||||
let {groups} = /(?<__proto__>.)/.exec("a").indices;
|
let {groups} = /(?<__proto__>.)/.exec("a").indices;
|
||||||
assert.compareArray([0, 1], groups.__proto__);
|
assert.compareArray([0, 1], groups.__proto__);
|
||||||
assert.sameValue(null, Object.getPrototypeOf(groups));
|
assert.sameValue(null, Object.getPrototypeOf(groups));
|
||||||
|
|
|
@ -1,35 +1,35 @@
|
||||||
// Copyright 2019 Ron Buckton. All rights reserved.
|
// Copyright 2019 Ron Buckton. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// 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
|
description: Properties of the groups object of indices are created with CreateDataProperty
|
||||||
includes: [compareArray.js, propertyHelper.js]
|
includes: [compareArray.js, propertyHelper.js]
|
||||||
esid: sec-makeindicesarray
|
esid: sec-makeindicesarray
|
||||||
features: [regexp-named-groups]
|
features: [regexp-named-groups, regexp-match-indices]
|
||||||
info: |
|
info: |
|
||||||
MakeIndicesArray ( S, indices, groupNames )
|
MakeIndicesArray ( S, indices, groupNames )
|
||||||
11. For each integer _i_ such that _i_ >= 0 and _i_ < _n_, do
|
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
|
e. If _groupNames_ is not *undfined* and _groupNames_[_i_] is not *undefined*, then
|
||||||
i. Perform ! CreateDataProperty(_groups_, _groupNames_[_i_], _matchIndicesArray_).
|
i. Perform ! CreateDataProperty(_groups_, _groupNames_[_i_], _matchIndicesArray_).
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
|
||||||
// Properties created on result.groups in textual order.
|
// Properties created on result.groups in textual order.
|
||||||
let groupNames = Object.getOwnPropertyNames(/(?<fst>.)|(?<snd>.)/u.exec("abcd").indices.groups);
|
let groupNames = Object.getOwnPropertyNames(/(?<fst>.)|(?<snd>.)/u.exec("abcd").indices.groups);
|
||||||
assert.compareArray(groupNames, ["fst", "snd"]);
|
assert.compareArray(groupNames, ["fst", "snd"]);
|
||||||
|
|
||||||
// // Properties are created with Define, not Set
|
// // Properties are created with Define, not Set
|
||||||
// let counter = 0;
|
// let counter = 0;
|
||||||
// Object.defineProperty(Object.prototype, 'x', {set() { counter++; }});
|
// Object.defineProperty(Object.prototype, 'x', {set() { counter++; }});
|
||||||
|
|
||||||
let indices = /(?<x>.)/.exec('a').indices;
|
let indices = /(?<x>.)/.exec('a').indices;
|
||||||
let groups = indices.groups;
|
let groups = indices.groups;
|
||||||
// assert.sameValue(counter, 0);
|
// assert.sameValue(counter, 0);
|
||||||
|
|
||||||
// Properties are writable, enumerable and configurable
|
// Properties are writable, enumerable and configurable
|
||||||
// (from CreateDataProperty)
|
// (from CreateDataProperty)
|
||||||
verifyProperty(groups, 'x', {
|
verifyProperty(groups, 'x', {
|
||||||
writable: true,
|
writable: true,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue