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 Arguments Object has index property '0' as its own property, it
shoulde be writable, enumerable, configurable and does not invoke shoulde be writable, enumerable, configurable and does not invoke
the setter defined on Object.prototype[0] (Step 11.b) the setter defined on Object.prototype[0] (Step 11.b)
includes: [propertyHelper.js]
---*/ ---*/
var data = "data"; var data = "data";
@ -26,26 +27,11 @@ description: >
var argObj = (function () { return arguments })(1); var argObj = (function () { return arguments })(1);
var verifyValue = false; verifyProperty(argObj, "0", {
verifyValue = (argObj[0] === 1); 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'); assert.sameValue(data, "data", 'data');

View File

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

View File

@ -5,18 +5,13 @@
es5id: 10.6-14-c-1-s es5id: 10.6-14-c-1-s
description: > description: >
[[Enumerable]] attribute value in 'callee' is false [[Enumerable]] attribute value in 'callee' is false
includes: [propertyHelper.js]
---*/ ---*/
var argObj = function () { var argObj = function () {
return arguments; return arguments;
} (); } ();
var verifyEnumerable = false; verifyProperty(argObj, "callee", {
for (var _10_6_14_c_1 in argObj) { enumerable: false,
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');

View File

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

View File

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