Update other test/language tests to use verifyProperty

This commit is contained in:
André Bargull 2023-09-11 14:30:58 +02:00 committed by Ms2ger
parent a7ee7473b7
commit c140af3cb3
5 changed files with 32 additions and 91 deletions

View File

@ -7,6 +7,7 @@ description: >
Arguments Object has index property '0' as its own property, it
shoulde be writable, enumerable, configurable and does not invoke
the setter defined on Object.prototype[0] (Step 11.b)
includes: [propertyHelper.js]
---*/
var data = "data";
@ -26,26 +27,11 @@ description: >
var argObj = (function () { return arguments })(1);
var verifyValue = false;
verifyValue = (argObj[0] === 1);
verifyProperty(argObj, "0", {
value: 1,
writable: true,
enumerable: true,
configurable: true,
});
var verifyEnumerable = false;
for (var p in argObj) {
if (p === "0" && argObj.hasOwnProperty("0")) {
verifyEnumerable = true;
}
}
var verifyWritable = false;
argObj[0] = 1001;
verifyWritable = (argObj[0] === 1001);
var verifyConfigurable = false;
delete argObj[0];
verifyConfigurable = argObj.hasOwnProperty("0");
assert(verifyValue, 'verifyValue !== true');
assert(verifyWritable, 'verifyWritable !== true');
assert(verifyEnumerable, 'verifyEnumerable !== true');
assert.sameValue(verifyConfigurable, false, 'verifyConfigurable');
assert.sameValue(data, "data", 'data');

View File

@ -6,6 +6,7 @@ es5id: 10.6-13-a-1
description: >
In non-strict mode, arguments object should have its own 'callee'
property defined (Step 13.a)
includes: [propertyHelper.js]
flags: [noStrict]
---*/
@ -17,25 +18,10 @@ flags: [noStrict]
var argObj = (function () { return arguments })();
var verifyValue = false;
verifyValue = typeof argObj.callee === "function";
var verifyWritable = false;
argObj.callee = 1001;
verifyWritable = (argObj.callee === 1001);
assert.sameValue(typeof argObj.callee, "function");
var verifyEnumerable = false;
for (var p in argObj) {
if (p === "callee" && argObj.hasOwnProperty("callee")) {
verifyEnumerable = true;
}
}
var verifyConfigurable = false;
delete argObj.callee;
verifyConfigurable = argObj.hasOwnProperty("callee");
assert(verifyValue, 'verifyValue !== true');
assert(verifyWritable, 'verifyWritable !== true');
assert.sameValue(verifyEnumerable, false, 'verifyEnumerable');
assert.sameValue(verifyConfigurable, false, 'verifyConfigurable');
verifyProperty(argObj, "callee", {
writable: true,
enumerable: false,
configurable: true,
});

View File

@ -5,18 +5,13 @@
es5id: 10.6-14-c-1-s
description: >
[[Enumerable]] attribute value in 'callee' is false
includes: [propertyHelper.js]
---*/
var argObj = function () {
return arguments;
} ();
var verifyEnumerable = false;
for (var _10_6_14_c_1 in argObj) {
if (argObj.hasOwnProperty(_10_6_14_c_1) && _10_6_14_c_1 === "callee") {
verifyEnumerable = true;
}
}
assert.sameValue(verifyEnumerable, false, 'verifyEnumerable');
assert(argObj.hasOwnProperty("callee"), 'argObj.hasOwnProperty("callee") !== true');
verifyProperty(argObj, "callee", {
enumerable: false,
});

View File

@ -6,6 +6,7 @@ es5id: 10.6-7-1
description: >
Arguments Object has length as its own property and does not
invoke the setter defined on Object.prototype.length (Step 7)
includes: [propertyHelper.js]
---*/
var data = "data";
@ -23,27 +24,13 @@ description: >
configurable: true
});
var verifyValue = false;
var argObj = (function () { return arguments })();
verifyValue = (argObj.length === 0);
var verifyWritable = false;
argObj.length = 1001;
verifyWritable = (argObj.length === 1001);
verifyProperty(argObj, "length", {
value: 0,
writable: true,
enumerable: false,
configurable: true,
});
var verifyEnumerable = false;
for (var p in argObj) {
if (p === "length") {
verifyEnumerable = true;
}
}
var verifyConfigurable = false;
delete argObj.length;
verifyConfigurable = argObj.hasOwnProperty("length");
assert(verifyValue, 'verifyValue !== true');
assert(verifyWritable, 'verifyWritable !== true');
assert.sameValue(verifyEnumerable, false, 'verifyEnumerable');
assert.sameValue(verifyConfigurable, false, 'verifyConfigurable');
assert.sameValue(data, "data", 'data');

View File

@ -7,6 +7,7 @@ description: >
Function Object has 'constructor' as its own property, it is not
enumerable and does not invoke the setter defined on
Function.prototype.constructor (Step 17)
includes: [propertyHelper.js]
---*/
var desc = Object.getOwnPropertyDescriptor(Object.prototype, "constructor");
@ -28,26 +29,12 @@ description: >
var fun = function () {};
var verifyValue = false;
verifyValue = typeof fun.prototype.constructor === "function";
assert.sameValue(typeof fun.prototype.constructor, "function");
var verifyEnumerable = false;
for (var p in fun.prototype) {
if (p === "constructor" && fun.prototype.hasOwnProperty("constructor")) {
verifyEnumerable = true;
}
}
verifyProperty(fun.prototype, "constructor", {
writable: true,
enumerable: false,
configurable: true,
});
var verifyWritable = false;
fun.prototype.constructor = 12;
verifyWritable = (fun.prototype.constructor === 12);
var verifyConfigurable = false;
delete fun.prototype.constructor;
verifyConfigurable = fun.hasOwnProperty("constructor");
assert(verifyValue, 'verifyValue !== true');
assert(verifyWritable, 'verifyWritable !== true');
assert.sameValue(verifyEnumerable, false, 'verifyEnumerable');
assert.sameValue(verifyConfigurable, false, 'verifyConfigurable');
assert.sameValue(data, "data", 'data');