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
description: "'length' property of arguments object has correct attributes"
includes: [propertyHelper.js]
---*/
function testcase() {
var desc = Object.getOwnPropertyDescriptor(arguments,"length");
assert.sameValue(desc.configurable, true, 'desc.configurable');
assert.sameValue(desc.enumerable, false, 'desc.enumerable');
assert.sameValue(desc.writable, true, 'desc.writable');
verifyProperty(arguments, "length", {
writable: true,
enumerable: false,
configurable: true,
});
}
testcase();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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