Skip to content

Commit

Permalink
Use verifyProperty in language/global-code tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anba authored and Ms2ger committed Sep 13, 2023
1 parent 8ff30c7 commit e6f1feb
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 32 deletions.
8 changes: 5 additions & 3 deletions test/language/global-code/decl-func.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ includes: [propertyHelper.js]
assert.sameValue(
typeof brandNew, 'function', 'new binding on an extensible global object'
);
verifyEnumerable(this, 'brandNew');
verifyWritable(this, 'brandNew');
verifyNotConfigurable(this, 'brandNew');
verifyProperty(this, 'brandNew', {
writable: true,
enumerable: true,
configurable: false,
});

function brandNew() {}
12 changes: 6 additions & 6 deletions test/language/global-code/decl-var.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ info: |
includes: [propertyHelper.js]
---*/

assert.sameValue(
this.brandNew, undefined, 'new binding on an extensible global object'
);
verifyEnumerable(this, 'brandNew');
verifyWritable(this, 'brandNew');
verifyNotConfigurable(this, 'brandNew');
verifyProperty(this, "brandNew", {
value: undefined,
writable: true,
enumerable: true,
configurable: false,
});

var brandNew;
24 changes: 15 additions & 9 deletions test/language/global-code/script-decl-func.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ $262.evalScript('function brandNew() {}');
assert.sameValue(
typeof brandNew, 'function', 'new binding on an extensible global object'
);
verifyEnumerable(this, 'brandNew');
verifyWritable(this, 'brandNew');
verifyNotConfigurable(this, 'brandNew');
verifyProperty(this, 'brandNew', {
writable: true,
enumerable: true,
configurable: false,
});

Object.defineProperty(this, 'configurable', { configurable: true, value: 0 });
Object.defineProperty(
Expand All @@ -63,9 +65,11 @@ $262.evalScript('function configurable() {}');
assert.sameValue(
typeof configurable, 'function', 'like-named configurable property'
);
verifyEnumerable(this, 'configurable')
verifyWritable(this, 'configurable');
verifyNotConfigurable(this, 'configurable');
verifyProperty(this, 'configurable', {
writable: true,
enumerable: true,
configurable: false,
});

$262.evalScript('function nonConfigurable() {}');

Expand All @@ -74,6 +78,8 @@ assert.sameValue(
'function',
'like-named non-configurable data property that is writable and enumerable'
);
verifyEnumerable(this, 'nonConfigurable');
verifyWritable(this, 'nonConfigurable');
verifyNotConfigurable(this, 'nonConfigurable');
verifyProperty(this, 'nonConfigurable', {
writable: true,
enumerable: true,
configurable: false,
});
32 changes: 18 additions & 14 deletions test/language/global-code/script-decl-var.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ includes: [propertyHelper.js]

$262.evalScript('var brandNew;');

assert.sameValue(
this.brandNew, undefined, 'new binding on an extensible global object'
);
verifyEnumerable(this, 'brandNew');
verifyWritable(this, 'brandNew');
verifyNotConfigurable(this, 'brandNew');
verifyProperty(this, 'brandNew', {
value: undefined,
writable: true,
enumerable: true,
configurable: false,
});

Object.defineProperty(
this,
Expand All @@ -58,14 +58,18 @@ Object.preventExtensions(this);

$262.evalScript('var configurable;');

assert.sameValue(configurable, 0, 'like-named configurable property');
verifyNotEnumerable(this, 'configurable');
verifyNotWritable(this, 'configurable');
verifyConfigurable(this, 'configurable');
verifyProperty(this, 'configurable', {
value: 0,
writable: false,
enumerable: false,
configurable: true,
});

$262.evalScript('var nonConfigurable;');

assert.sameValue(nonConfigurable, 0, 'like-named non-configurable property');
verifyNotEnumerable(this, 'nonConfigurable');
verifyNotWritable(this, 'nonConfigurable');
verifyNotConfigurable(this, 'nonConfigurable');
verifyProperty(this, 'nonConfigurable', {
value: 0,
writable: false,
enumerable: false,
configurable: false,
});

0 comments on commit e6f1feb

Please sign in to comment.