Use verifyProperty in language/global-code tests

This commit is contained in:
André Bargull 2023-09-11 14:16:16 +02:00 committed by Ms2ger
parent 8ff30c73ce
commit e6f1feb04d
4 changed files with 44 additions and 32 deletions

View File

@ -41,8 +41,10 @@ includes: [propertyHelper.js]
assert.sameValue( assert.sameValue(
typeof brandNew, 'function', 'new binding on an extensible global object' typeof brandNew, 'function', 'new binding on an extensible global object'
); );
verifyEnumerable(this, 'brandNew'); verifyProperty(this, 'brandNew', {
verifyWritable(this, 'brandNew'); writable: true,
verifyNotConfigurable(this, 'brandNew'); enumerable: true,
configurable: false,
});
function brandNew() {} function brandNew() {}

View File

@ -32,11 +32,11 @@ info: |
includes: [propertyHelper.js] includes: [propertyHelper.js]
---*/ ---*/
assert.sameValue( verifyProperty(this, "brandNew", {
this.brandNew, undefined, 'new binding on an extensible global object' value: undefined,
); writable: true,
verifyEnumerable(this, 'brandNew'); enumerable: true,
verifyWritable(this, 'brandNew'); configurable: false,
verifyNotConfigurable(this, 'brandNew'); });
var brandNew; var brandNew;

View File

@ -43,9 +43,11 @@ $262.evalScript('function brandNew() {}');
assert.sameValue( assert.sameValue(
typeof brandNew, 'function', 'new binding on an extensible global object' typeof brandNew, 'function', 'new binding on an extensible global object'
); );
verifyEnumerable(this, 'brandNew'); verifyProperty(this, 'brandNew', {
verifyWritable(this, 'brandNew'); writable: true,
verifyNotConfigurable(this, 'brandNew'); enumerable: true,
configurable: false,
});
Object.defineProperty(this, 'configurable', { configurable: true, value: 0 }); Object.defineProperty(this, 'configurable', { configurable: true, value: 0 });
Object.defineProperty( Object.defineProperty(
@ -63,9 +65,11 @@ $262.evalScript('function configurable() {}');
assert.sameValue( assert.sameValue(
typeof configurable, 'function', 'like-named configurable property' typeof configurable, 'function', 'like-named configurable property'
); );
verifyEnumerable(this, 'configurable') verifyProperty(this, 'configurable', {
verifyWritable(this, 'configurable'); writable: true,
verifyNotConfigurable(this, 'configurable'); enumerable: true,
configurable: false,
});
$262.evalScript('function nonConfigurable() {}'); $262.evalScript('function nonConfigurable() {}');
@ -74,6 +78,8 @@ assert.sameValue(
'function', 'function',
'like-named non-configurable data property that is writable and enumerable' 'like-named non-configurable data property that is writable and enumerable'
); );
verifyEnumerable(this, 'nonConfigurable'); verifyProperty(this, 'nonConfigurable', {
verifyWritable(this, 'nonConfigurable'); writable: true,
verifyNotConfigurable(this, 'nonConfigurable'); enumerable: true,
configurable: false,
});

View File

@ -34,12 +34,12 @@ includes: [propertyHelper.js]
$262.evalScript('var brandNew;'); $262.evalScript('var brandNew;');
assert.sameValue( verifyProperty(this, 'brandNew', {
this.brandNew, undefined, 'new binding on an extensible global object' value: undefined,
); writable: true,
verifyEnumerable(this, 'brandNew'); enumerable: true,
verifyWritable(this, 'brandNew'); configurable: false,
verifyNotConfigurable(this, 'brandNew'); });
Object.defineProperty( Object.defineProperty(
this, this,
@ -58,14 +58,18 @@ Object.preventExtensions(this);
$262.evalScript('var configurable;'); $262.evalScript('var configurable;');
assert.sameValue(configurable, 0, 'like-named configurable property'); verifyProperty(this, 'configurable', {
verifyNotEnumerable(this, 'configurable'); value: 0,
verifyNotWritable(this, 'configurable'); writable: false,
verifyConfigurable(this, 'configurable'); enumerable: false,
configurable: true,
});
$262.evalScript('var nonConfigurable;'); $262.evalScript('var nonConfigurable;');
assert.sameValue(nonConfigurable, 0, 'like-named non-configurable property'); verifyProperty(this, 'nonConfigurable', {
verifyNotEnumerable(this, 'nonConfigurable'); value: 0,
verifyNotWritable(this, 'nonConfigurable'); writable: false,
verifyNotConfigurable(this, 'nonConfigurable'); enumerable: false,
configurable: false,
});