mirror of https://github.com/tc39/test262.git
Add tests for property descriptors of legacy RegExp accessors
This commit is contained in:
parent
391cd16f1f
commit
d06c21c03a
|
@ -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
|
||||
});
|
||||
}
|
|
@ -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
|
||||
});
|
|
@ -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
|
||||
});
|
|
@ -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
|
||||
});
|
|
@ -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
|
||||
});
|
|
@ -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
|
||||
});
|
Loading…
Reference in New Issue