Skip to content

Commit

Permalink
Use verifyProperty in language/eval-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 08a7b9d commit 8ff30c7
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ var initial;

eval('initial = f; function f() { return 234; }');

verifyEnumerable(this, 'f');
verifyWritable(this, 'f');
verifyConfigurable(this, 'f');
verifyProperty(this, 'f', {
writable: true,
enumerable: true,
configurable: true,
});

assert.sameValue(typeof initial, 'function');
assert.sameValue(initial(), 234);
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ Object.defineProperty(this, 'f', {

eval('initial = f; function f() { return 345; }');

verifyEnumerable(this, 'f');
verifyWritable(this, 'f');
verifyConfigurable(this, 'f');
verifyProperty(this, 'f', {
writable: true,
enumerable: true,
configurable: true,
});

assert.sameValue(typeof initial, 'function');
assert.sameValue(initial(), 345);
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ Object.defineProperty(this, 'f', {

eval('initial = f; function f() { return 2222; }');

verifyEnumerable(this, 'f');
verifyWritable(this, 'f');
verifyNotConfigurable(this, 'f');
verifyProperty(this, 'f', {
writable: true,
enumerable: true,
configurable: false,
});

assert.sameValue(typeof initial, 'function');
assert.sameValue(initial(), 2222);
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ var x = 23;

eval('initial = x; var x = 45;');

verifyEnumerable(this, 'x');
verifyWritable(this, 'x');
verifyNotConfigurable(this, 'x');
verifyProperty(this, 'x', {
value: 45,
writable: true,
enumerable: true,
configurable: false,
});

assert.sameValue(initial, 23);
9 changes: 6 additions & 3 deletions test/language/eval-code/direct/var-env-var-init-global-new.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ var initial = null;

eval('initial = x; var x;');

verifyEnumerable(this, 'x');
verifyWritable(this, 'x');
verifyConfigurable(this, 'x');
verifyProperty(this, 'x', {
value: undefined,
writable: true,
enumerable: true,
configurable: true,
});

assert.sameValue(initial, undefined);
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ var initial;

(0, eval)('initial = f; function f() { return 234; }');

verifyEnumerable(this, 'f');
verifyWritable(this, 'f');
verifyConfigurable(this, 'f');
verifyProperty(this, 'f', {
writable: true,
enumerable: true,
configurable: true,
});

assert.sameValue(typeof initial, 'function');
assert.sameValue(initial(), 234);
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ Object.defineProperty(this, 'f', {

(0, eval)('initial = f; function f() { return 345; }');

verifyEnumerable(this, 'f');
verifyWritable(this, 'f');
verifyConfigurable(this, 'f');
verifyProperty(this, 'f', {
writable: true,
enumerable: true,
configurable: true,
});

assert.sameValue(typeof initial, 'function');
assert.sameValue(initial(), 345);
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ Object.defineProperty(this, 'f', {

(0,eval)('initial = f; function f() { return 2222; }');

verifyEnumerable(this, 'f');
verifyWritable(this, 'f');
verifyNotConfigurable(this, 'f');
verifyProperty(this, 'f', {
writable: true,
enumerable: true,
configurable: false,
});

assert.sameValue(typeof initial, 'function');
assert.sameValue(initial(), 2222);
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ var x = 23;

(0, eval)('initial = x; var x = 45;');

verifyEnumerable(this, 'x');
verifyWritable(this, 'x');
verifyNotConfigurable(this, 'x');
verifyProperty(this, 'x', {
value: 45,
writable: true,
enumerable: true,
configurable: false,
});

assert.sameValue(initial, 23);
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ var initial = null;

(0, eval)('initial = x; var x = 9;');

verifyEnumerable(this, 'x');
verifyWritable(this, 'x');
verifyConfigurable(this, 'x');
verifyProperty(this, 'x', {
value: 9,
writable: true,
enumerable: true,
configurable: true,
});

assert.sameValue(initial, undefined);

0 comments on commit 8ff30c7

Please sign in to comment.