Use verifyProperty in language/arguments-object tests

This commit is contained in:
André Bargull 2023-09-11 14:17:20 +02:00 committed by Ms2ger
parent f2275d23f4
commit a7ee7473b7
21 changed files with 206 additions and 159 deletions

View File

@ -4,13 +4,14 @@
/*--- /*---
es5id: 10.6-6-2 es5id: 10.6-6-2
description: "'length' property of arguments object has correct attributes" description: "'length' property of arguments object has correct attributes"
includes: [propertyHelper.js]
---*/ ---*/
function testcase() { function testcase() {
var desc = Object.getOwnPropertyDescriptor(arguments,"length"); verifyProperty(arguments, "length", {
writable: true,
assert.sameValue(desc.configurable, true, 'desc.configurable'); enumerable: false,
assert.sameValue(desc.enumerable, false, 'desc.enumerable'); configurable: true,
assert.sameValue(desc.writable, true, 'desc.writable'); });
} }
testcase(); testcase();

View File

@ -11,11 +11,10 @@ features: [Symbol.iterator]
---*/ ---*/
(function() { (function() {
var descriptor = Object.getOwnPropertyDescriptor(arguments, Symbol.iterator); verifyProperty(arguments, Symbol.iterator, {
value: [][Symbol.iterator],
assert.sameValue(arguments[Symbol.iterator], [][Symbol.iterator]); writable: true,
enumerable: false,
verifyNotEnumerable(Array.prototype, Symbol.iterator); configurable: true,
verifyWritable(Array.prototype, Symbol.iterator); });
verifyConfigurable(Array.prototype, Symbol.iterator);
}()); }());

View File

@ -13,10 +13,11 @@ includes: [propertyHelper.js]
function argumentsNonConfigurable(a) { function argumentsNonConfigurable(a) {
Object.defineProperty(arguments, "0", {configurable: false}); Object.defineProperty(arguments, "0", {configurable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); verifyProperty(arguments, "0", {
assert.sameValue(propertyDescriptor.value, 1); value: 1,
verifyEnumerable(arguments, "0"); writable: true,
verifyWritable(arguments, "0"); enumerable: true,
verifyNotConfigurable(arguments, "0"); configurable: false,
});
} }
argumentsNonConfigurable(1); argumentsNonConfigurable(1);

View File

@ -16,12 +16,14 @@ function argumentsAndSetByIndex(a) {
arguments[0] = 2; arguments[0] = 2;
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 2);
assert.sameValue(a, 2); assert.sameValue(a, 2);
verifyEnumerable(arguments, "0");
verifyWritable(arguments, "0"); verifyProperty(arguments, "0", {
verifyNotConfigurable(arguments, "0"); value: 2,
writable: true,
enumerable: true,
configurable: false,
});
} }
argumentsAndSetByIndex(1); argumentsAndSetByIndex(1);

View File

@ -16,12 +16,14 @@ function setArgumentValueWithDefineOwnProperty(a) {
Object.defineProperty(arguments, "0", {value: 2}); Object.defineProperty(arguments, "0", {value: 2});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 2);
assert.sameValue(a, 2); assert.sameValue(a, 2);
verifyEnumerable(arguments, "0");
verifyWritable(arguments, "0"); verifyProperty(arguments, "0", {
verifyNotConfigurable(arguments, "0"); value: 2,
writable: true,
enumerable: true,
configurable: false,
});
} }
setArgumentValueWithDefineOwnProperty(1); setArgumentValueWithDefineOwnProperty(1);

View File

@ -15,11 +15,13 @@ function argumentsAndSetMutableBinding(a) {
Object.defineProperty(arguments, "0", {configurable: false}); Object.defineProperty(arguments, "0", {configurable: false});
a = 2; a = 2;
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 2); verifyProperty(arguments, "0", {
verifyEnumerable(arguments, "0"); value: 2,
verifyWritable(arguments, "0"); writable: true,
verifyNotConfigurable(arguments, "0"); enumerable: true,
configurable: false,
});
} }
argumentsAndSetMutableBinding(1); argumentsAndSetMutableBinding(1);

View File

@ -17,11 +17,12 @@ function fn(a) {
// Postcondition: Arguments mapping is removed. // Postcondition: Arguments mapping is removed.
a = 2; a = 2;
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); verifyProperty(arguments, "0", {
assert.sameValue(propertyDescriptor.value, 1); value: 1,
verifyNotEnumerable(arguments, "0"); writable: false,
verifyNotWritable(arguments, "0"); enumerable: false,
verifyNotConfigurable(arguments, "0"); configurable: false,
});
} }
fn(1); fn(1);

View File

@ -17,20 +17,24 @@ function fn(a) {
arguments[0] = 2; arguments[0] = 2;
Object.defineProperty(arguments, "0", {writable: false}); Object.defineProperty(arguments, "0", {writable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 2);
assert.sameValue(a, 2); assert.sameValue(a, 2);
verifyNotEnumerable(arguments, "0");
verifyNotWritable(arguments, "0"); verifyProperty(arguments, "0", {
verifyNotConfigurable(arguments, "0"); value: 2,
writable: false,
enumerable: false,
configurable: false,
});
// Postcondition: Arguments mapping is removed. // Postcondition: Arguments mapping is removed.
a = 3; a = 3;
propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 2); verifyProperty(arguments, "0", {
verifyNotEnumerable(arguments, "0"); value: 2,
verifyNotWritable(arguments, "0"); writable: false,
verifyNotConfigurable(arguments, "0"); enumerable: false,
configurable: false,
});
} }
fn(1); fn(1);

View File

@ -18,19 +18,22 @@ function fn(a) {
a = 2; a = 2;
Object.defineProperty(arguments, "0", {writable: false}); Object.defineProperty(arguments, "0", {writable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); verifyProperty(arguments, "0", {
assert.sameValue(propertyDescriptor.value, 2); value: 2,
verifyNotEnumerable(arguments, "0"); writable: false,
verifyNotWritable(arguments, "0"); enumerable: false,
verifyNotConfigurable(arguments, "0"); configurable: false,
});
// Postcondition: Arguments mapping is removed. // Postcondition: Arguments mapping is removed.
a = 3; a = 3;
propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 2); verifyProperty(arguments, "0", {
verifyNotEnumerable(arguments, "0"); value: 2,
verifyNotWritable(arguments, "0"); writable: false,
verifyNotConfigurable(arguments, "0"); enumerable: false,
configurable: false,
});
} }
fn(1); fn(1);

View File

@ -18,11 +18,12 @@ function fn(a) {
// Postcondition: Arguments mapping is removed. // Postcondition: Arguments mapping is removed.
a = 2; a = 2;
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); verifyProperty(arguments, "0", {
assert.sameValue(propertyDescriptor.value, 1); value: 1,
verifyEnumerable(arguments, "0"); writable: false,
verifyNotWritable(arguments, "0"); enumerable: true,
verifyNotConfigurable(arguments, "0"); configurable: false,
});
} }
fn(1); fn(1);

View File

@ -16,19 +16,22 @@ function fn(a) {
Object.defineProperty(arguments, "0", {configurable: false}); Object.defineProperty(arguments, "0", {configurable: false});
Object.defineProperty(arguments, "0", {writable: false}); Object.defineProperty(arguments, "0", {writable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); verifyProperty(arguments, "0", {
assert.sameValue(propertyDescriptor.value, 1); value: 1,
verifyEnumerable(arguments, "0"); writable: false,
verifyNotWritable(arguments, "0"); enumerable: true,
verifyNotConfigurable(arguments, "0"); configurable: false,
});
// Postcondition: Arguments mapping is removed. // Postcondition: Arguments mapping is removed.
a = 2; a = 2;
propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 1); verifyProperty(arguments, "0", {
verifyEnumerable(arguments, "0"); value: 1,
verifyNotWritable(arguments, "0"); writable: false,
verifyNotConfigurable(arguments, "0"); enumerable: true,
configurable: false,
});
} }
fn(1); fn(1);

View File

@ -18,20 +18,25 @@ function fn(a) {
Object.defineProperty(arguments, "0", {configurable: false}); Object.defineProperty(arguments, "0", {configurable: false});
arguments[0] = 2; arguments[0] = 2;
Object.defineProperty(arguments, "0", {writable: false}); Object.defineProperty(arguments, "0", {writable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 2);
assert.sameValue(a, 2) assert.sameValue(a, 2)
verifyEnumerable(arguments, "0");
verifyNotWritable(arguments, "0"); verifyProperty(arguments, "0", {
verifyNotConfigurable(arguments, "0"); value: 2,
writable: false,
enumerable: true,
configurable: false,
});
// Postcondition: Arguments mapping is removed. // Postcondition: Arguments mapping is removed.
a = 3; a = 3;
propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 2); verifyProperty(arguments, "0", {
verifyEnumerable(arguments, "0"); value: 2,
verifyNotWritable(arguments, "0"); writable: false,
verifyNotConfigurable(arguments, "0"); enumerable: true,
configurable: false,
});
} }
fn(1); fn(1);

View File

@ -18,19 +18,22 @@ function fn(a) {
a = 2; a = 2;
Object.defineProperty(arguments, "0", {writable: false}); Object.defineProperty(arguments, "0", {writable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); verifyProperty(arguments, "0", {
assert.sameValue(propertyDescriptor.value, 2); value: 2,
verifyEnumerable(arguments, "0"); writable: false,
verifyNotWritable(arguments, "0"); enumerable: true,
verifyNotConfigurable(arguments, "0"); configurable: false,
});
// Postcondition: Arguments mapping is removed. // Postcondition: Arguments mapping is removed.
a = 3; a = 3;
propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 2); verifyProperty(arguments, "0", {
verifyEnumerable(arguments, "0"); value: 2,
verifyNotWritable(arguments, "0"); writable: false,
verifyNotConfigurable(arguments, "0"); enumerable: true,
configurable: false,
});
} }
fn(1); fn(1);

View File

@ -17,20 +17,24 @@ includes: [propertyHelper.js]
function fn(a) { function fn(a) {
Object.defineProperty(arguments, "0", {writable: false}); Object.defineProperty(arguments, "0", {writable: false});
Object.defineProperty(arguments, "0", {configurable: false}); Object.defineProperty(arguments, "0", {configurable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 1); verifyProperty(arguments, "0", {
verifyEnumerable(arguments, "0"); value: 1,
verifyNotWritable(arguments, "0"); writable: false,
verifyNotConfigurable(arguments, "0"); enumerable: true,
configurable: false,
});
// Postcondition: Arguments mapping is removed. Descriptors need to be the same // Postcondition: Arguments mapping is removed. Descriptors need to be the same
// as above. // as above.
a = 2; a = 2;
propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 1); verifyProperty(arguments, "0", {
verifyEnumerable(arguments, "0"); value: 1,
verifyNotWritable(arguments, "0"); writable: false,
verifyNotConfigurable(arguments, "0"); enumerable: true,
configurable: false,
});
} }
fn(1); fn(1);

View File

@ -18,20 +18,25 @@ function fn(a) {
Object.defineProperty(arguments, "0", {writable: false}); Object.defineProperty(arguments, "0", {writable: false});
arguments[0] = 2; arguments[0] = 2;
Object.defineProperty(arguments, "0", {configurable: false}); Object.defineProperty(arguments, "0", {configurable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 1);
assert.sameValue(a, 1); assert.sameValue(a, 1);
verifyEnumerable(arguments, "0");
verifyNotWritable(arguments, "0"); verifyProperty(arguments, "0", {
verifyNotConfigurable(arguments, "0"); value: 1,
writable: false,
enumerable: true,
configurable: false,
});
// Postcondition: Arguments mapping is removed. // Postcondition: Arguments mapping is removed.
a = 3; a = 3;
propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 1); verifyProperty(arguments, "0", {
verifyEnumerable(arguments, "0"); value: 1,
verifyNotWritable(arguments, "0"); writable: false,
verifyNotConfigurable(arguments, "0"); enumerable: true,
configurable: false,
});
} }
fn(1); fn(1);

View File

@ -18,11 +18,13 @@ function fn(a) {
Object.defineProperty(arguments, "0", {writable: false}); Object.defineProperty(arguments, "0", {writable: false});
a = 2; a = 2;
Object.defineProperty(arguments, "0", {configurable: false}); Object.defineProperty(arguments, "0", {configurable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 1); verifyProperty(arguments, "0", {
verifyEnumerable(arguments, "0"); value: 1,
verifyNotWritable(arguments, "0"); writable: false,
verifyNotConfigurable(arguments, "0"); enumerable: true,
configurable: false,
});
} }
fn(1); fn(1);

View File

@ -18,18 +18,21 @@ function fn(a) {
Object.defineProperty(arguments, "0", {writable: false, enumerable: false}); Object.defineProperty(arguments, "0", {writable: false, enumerable: false});
Object.defineProperty(arguments, "0", {configurable: false}); Object.defineProperty(arguments, "0", {configurable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); verifyProperty(arguments, "0", {
assert.sameValue(propertyDescriptor.value, 1); value: 1,
verifyNotEnumerable(arguments, "0"); writable: false,
verifyNotWritable(arguments, "0"); enumerable: false,
verifyNotConfigurable(arguments, "0"); configurable: false,
});
// Postcondition: Arguments mapping is removed. // Postcondition: Arguments mapping is removed.
a = 2; a = 2;
propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 1); verifyProperty(arguments, "0", {
verifyNotEnumerable(arguments, "0"); value: 1,
verifyNotWritable(arguments, "0"); writable: false,
verifyNotConfigurable(arguments, "0"); enumerable: false,
configurable: false,
});
} }
fn(1); fn(1);

View File

@ -17,18 +17,21 @@ function fn(a) {
arguments[0] = 2; arguments[0] = 2;
Object.defineProperty(arguments, "0", {configurable: false}); Object.defineProperty(arguments, "0", {configurable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); verifyProperty(arguments, "0", {
assert.sameValue(propertyDescriptor.value, 1); value: 1,
verifyNotEnumerable(arguments, "0"); writable: false,
verifyNotWritable(arguments, "0"); enumerable: false,
verifyNotConfigurable(arguments, "0"); configurable: false,
});
// Postcondition: Arguments mapping is removed. // Postcondition: Arguments mapping is removed.
a = 3; a = 3;
propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 1); verifyProperty(arguments, "0", {
verifyNotEnumerable(arguments, "0"); value: 1,
verifyNotWritable(arguments, "0"); writable: false,
verifyNotConfigurable(arguments, "0"); enumerable: false,
configurable: false,
});
} }
fn(1); fn(1);

View File

@ -17,11 +17,11 @@ includes: [propertyHelper.js]
function fn(a) { function fn(a) {
Object.defineProperty(arguments, "0", {writable: false, enumerable: false, value: 2, configurable: false}); Object.defineProperty(arguments, "0", {writable: false, enumerable: false, value: 2, configurable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); verifyProperty(arguments, "0", {
assert.sameValue(propertyDescriptor.value, 2); value: 2,
assert.sameValue(arguments[0], 2); writable: false,
verifyNotEnumerable(arguments, "0"); enumerable: false,
verifyNotWritable(arguments, "0"); configurable: false,
verifyNotConfigurable(arguments, "0"); });
} }
fn(1); fn(1);

View File

@ -18,18 +18,21 @@ function fn(a) {
a = 2; a = 2;
Object.defineProperty(arguments, "0", {configurable: false}); Object.defineProperty(arguments, "0", {configurable: false});
let propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0"); verifyProperty(arguments, "0", {
assert.sameValue(propertyDescriptor.value, 1); value: 1,
verifyNotEnumerable(arguments, "0"); writable: false,
verifyNotWritable(arguments, "0"); enumerable: false,
verifyNotConfigurable(arguments, "0"); configurable: false,
});
// Postcondition: Arguments mapping is removed. // Postcondition: Arguments mapping is removed.
a = 3; a = 3;
propertyDescriptor = Object.getOwnPropertyDescriptor(arguments, "0");
assert.sameValue(propertyDescriptor.value, 1); verifyProperty(arguments, "0", {
verifyNotEnumerable(arguments, "0"); value: 1,
verifyNotWritable(arguments, "0"); writable: false,
verifyNotConfigurable(arguments, "0"); enumerable: false,
configurable: false,
});
} }
fn(1); fn(1);

View File

@ -12,11 +12,11 @@ features: [Symbol.iterator]
(function() { (function() {
'use strict'; 'use strict';
var descriptor = Object.getOwnPropertyDescriptor(arguments, Symbol.iterator);
assert.sameValue(arguments[Symbol.iterator], [][Symbol.iterator]); verifyProperty(arguments, Symbol.iterator, {
value: [][Symbol.iterator],
verifyNotEnumerable(Array.prototype, Symbol.iterator); writable: true,
verifyWritable(Array.prototype, Symbol.iterator); enumerable: false,
verifyConfigurable(Array.prototype, Symbol.iterator); configurable: true,
});
}()); }());