Skip to content

Commit

Permalink
Update tests in built-ins/Object/defineProperty to use verifyProperty
Browse files Browse the repository at this point in the history
  • Loading branch information
anba authored and ljharb committed Feb 28, 2024
1 parent 50a3c9b commit 86e02df
Show file tree
Hide file tree
Showing 14 changed files with 84 additions and 363 deletions.
32 changes: 6 additions & 26 deletions test/built-ins/Object/defineProperty/15.2.3.6-4-611.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,11 @@ es5id: 15.2.3.6-4-611
description: >
ES5 Attributes - all attributes in Function.prototype.bind are
correct
includes: [propertyHelper.js]
---*/

var desc = Object.getOwnPropertyDescriptor(Function.prototype, "bind");

var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true);

var temp = Function.prototype.bind;

Function.prototype.bind = "2010";

var isWritable = (Function.prototype.bind === "2010");

var isEnumerable = false;

for (var prop in Function.prototype) {
if (prop === "bind") {
isEnumerable = true;
}
}

delete Function.prototype.bind;

var isConfigurable = !Function.prototype.hasOwnProperty("bind");

assert(propertyAreCorrect, 'propertyAreCorrect !== true');
assert(isWritable, 'isWritable !== true');
assert.sameValue(isEnumerable, false, 'isEnumerable');
assert(isConfigurable, 'isConfigurable !== true');
verifyProperty(Function.prototype, "bind", {
writable: true,
enumerable: false,
configurable: true,
});
32 changes: 6 additions & 26 deletions test/built-ins/Object/defineProperty/15.2.3.6-4-612.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,11 @@ es5id: 15.2.3.6-4-612
description: >
ES5 Attributes - all attributes in Array.prototype.indexOf are
correct
includes: [propertyHelper.js]
---*/

var desc = Object.getOwnPropertyDescriptor(Array.prototype, "indexOf");

var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true);

var temp = Array.prototype.indexOf;

Array.prototype.indexOf = "2010";

var isWritable = (Array.prototype.indexOf === "2010");

var isEnumerable = false;

for (var prop in Array.prototype) {
if (prop === "indexOf") {
isEnumerable = true;
}
}

delete Array.prototype.indexOf;

var isConfigurable = !Array.prototype.hasOwnProperty("indexOf");

assert(propertyAreCorrect, 'propertyAreCorrect !== true');
assert(isWritable, 'isWritable !== true');
assert.sameValue(isEnumerable, false, 'isEnumerable');
assert(isConfigurable, 'isConfigurable !== true');
verifyProperty(Array.prototype, "indexOf", {
writable: true,
enumerable: false,
configurable: true,
});
32 changes: 6 additions & 26 deletions test/built-ins/Object/defineProperty/15.2.3.6-4-613.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,11 @@
/*---
es5id: 15.2.3.6-4-613
description: ES5 Attributes - all attributes in Object.lastIndexOf are correct
includes: [propertyHelper.js]
---*/

var desc = Object.getOwnPropertyDescriptor(Array.prototype, "lastIndexOf");

var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true);

var temp = Array.prototype.lastIndexOf;

Array.prototype.lastIndexOf = "2010";

var isWritable = (Array.prototype.lastIndexOf === "2010");

var isEnumerable = false;

for (var prop in Array.prototype) {
if (prop === "lastIndexOf") {
isEnumerable = true;
}
}

delete Array.prototype.lastIndexOf;

var isConfigurable = !Array.prototype.hasOwnProperty("lastIndexOf");

assert(propertyAreCorrect, 'propertyAreCorrect !== true');
assert(isWritable, 'isWritable !== true');
assert.sameValue(isEnumerable, false, 'isEnumerable');
assert(isConfigurable, 'isConfigurable !== true');
verifyProperty(Array.prototype, "lastIndexOf", {
writable: true,
enumerable: false,
configurable: true,
});
32 changes: 6 additions & 26 deletions test/built-ins/Object/defineProperty/15.2.3.6-4-614.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,11 @@ es5id: 15.2.3.6-4-614
description: >
ES5 Attributes - all attributes in Array.prototype.every are
correct
includes: [propertyHelper.js]
---*/

var desc = Object.getOwnPropertyDescriptor(Array.prototype, "every");

var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true);

var temp = Array.prototype.every;

Array.prototype.every = "2010";

var isWritable = (Array.prototype.every === "2010");

var isEnumerable = false;

for (var prop in Array.prototype) {
if (prop === "every") {
isEnumerable = true;
}
}

delete Array.prototype.every;

var isConfigurable = !Array.prototype.hasOwnProperty("every");

assert(propertyAreCorrect, 'propertyAreCorrect !== true');
assert(isWritable, 'isWritable !== true');
assert.sameValue(isEnumerable, false, 'isEnumerable');
assert(isConfigurable, 'isConfigurable !== true');
verifyProperty(Array.prototype, "every", {
writable: true,
enumerable: false,
configurable: true,
});
32 changes: 6 additions & 26 deletions test/built-ins/Object/defineProperty/15.2.3.6-4-615.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,11 @@
/*---
es5id: 15.2.3.6-4-615
description: ES5 Attributes - all attributes in Array.prototype.some are correct
includes: [propertyHelper.js]
---*/

var desc = Object.getOwnPropertyDescriptor(Array.prototype, "some");

var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true);

var temp = Array.prototype.some;

Array.prototype.some = "2010";

var isWritable = (Array.prototype.some === "2010");

var isEnumerable = false;

for (var prop in Array.prototype) {
if (prop === "some") {
isEnumerable = true;
}
}

delete Array.prototype.some;

var isConfigurable = !Array.prototype.hasOwnProperty("some");

assert(propertyAreCorrect, 'propertyAreCorrect !== true');
assert(isWritable, 'isWritable !== true');
assert.sameValue(isEnumerable, false, 'isEnumerable');
assert(isConfigurable, 'isConfigurable !== true');
verifyProperty(Array.prototype, "some", {
writable: true,
enumerable: false,
configurable: true,
});
32 changes: 6 additions & 26 deletions test/built-ins/Object/defineProperty/15.2.3.6-4-616.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,11 @@ es5id: 15.2.3.6-4-616
description: >
ES5 Attributes - all attributes in Array.prototype.forEach are
correct
includes: [propertyHelper.js]
---*/

var desc = Object.getOwnPropertyDescriptor(Array.prototype, "forEach");

var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true);

var temp = Array.prototype.forEach;

Array.prototype.forEach = "2010";

var isWritable = (Array.prototype.forEach === "2010");

var isEnumerable = false;

for (var prop in Array.prototype) {
if (prop === "forEach") {
isEnumerable = true;
}
}

delete Array.prototype.forEach;

var isConfigurable = !Array.prototype.hasOwnProperty("forEach");

assert(propertyAreCorrect, 'propertyAreCorrect !== true');
assert(isWritable, 'isWritable !== true');
assert.sameValue(isEnumerable, false, 'isEnumerable');
assert(isConfigurable, 'isConfigurable !== true');
verifyProperty(Array.prototype, "forEach", {
writable: true,
enumerable: false,
configurable: true,
});
32 changes: 6 additions & 26 deletions test/built-ins/Object/defineProperty/15.2.3.6-4-617.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,11 @@
/*---
es5id: 15.2.3.6-4-617
description: ES5 Attributes - all attributes in Array.prototype.map are correct
includes: [propertyHelper.js]
---*/

var desc = Object.getOwnPropertyDescriptor(Array.prototype, "map");

var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true);

var temp = Array.prototype.map;

Array.prototype.map = "2010";

var isWritable = (Array.prototype.map === "2010");

var isEnumerable = false;

for (var prop in Array.prototype) {
if (prop === "map") {
isEnumerable = true;
}
}

delete Array.prototype.map;

var isConfigurable = !Array.prototype.hasOwnProperty("map");

assert(propertyAreCorrect, 'propertyAreCorrect !== true');
assert(isWritable, 'isWritable !== true');
assert.sameValue(isEnumerable, false, 'isEnumerable');
assert(isConfigurable, 'isConfigurable !== true');
verifyProperty(Array.prototype, "map", {
writable: true,
enumerable: false,
configurable: true,
});
32 changes: 6 additions & 26 deletions test/built-ins/Object/defineProperty/15.2.3.6-4-618.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,11 @@ es5id: 15.2.3.6-4-618
description: >
ES5 Attributes - all attributes in Array.prototype.filter are
correct
includes: [propertyHelper.js]
---*/

var desc = Object.getOwnPropertyDescriptor(Array.prototype, "filter");

var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true);

var temp = Array.prototype.filter;

Array.prototype.filter = "2010";

var isWritable = (Array.prototype.filter === "2010");

var isEnumerable = false;

for (var prop in Array.prototype) {
if (prop === "filter") {
isEnumerable = true;
}
}

delete Array.prototype.filter;

var isConfigurable = !Array.prototype.hasOwnProperty("filter");

assert(propertyAreCorrect, 'propertyAreCorrect !== true');
assert(isWritable, 'isWritable !== true');
assert.sameValue(isEnumerable, false, 'isEnumerable');
assert(isConfigurable, 'isConfigurable !== true');
verifyProperty(Array.prototype, "filter", {
writable: true,
enumerable: false,
configurable: true,
});
32 changes: 6 additions & 26 deletions test/built-ins/Object/defineProperty/15.2.3.6-4-619.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,11 @@ es5id: 15.2.3.6-4-619
description: >
ES5 Attributes - all attributes in Array.prototype.reduce are
correct
includes: [propertyHelper.js]
---*/

var desc = Object.getOwnPropertyDescriptor(Array.prototype, "reduce");

var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true);

var temp = Array.prototype.reduce;

Array.prototype.reduce = "2010";

var isWritable = (Array.prototype.reduce === "2010");

var isEnumerable = false;

for (var prop in Array.prototype) {
if (prop === "reduce") {
isEnumerable = true;
}
}

delete Array.prototype.reduce;

var isConfigurable = !Array.prototype.hasOwnProperty("reduce");

assert(propertyAreCorrect, 'propertyAreCorrect !== true');
assert(isWritable, 'isWritable !== true');
assert.sameValue(isEnumerable, false, 'isEnumerable');
assert(isConfigurable, 'isConfigurable !== true');
verifyProperty(Array.prototype, "reduce", {
writable: true,
enumerable: false,
configurable: true,
});
32 changes: 6 additions & 26 deletions test/built-ins/Object/defineProperty/15.2.3.6-4-620.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,11 @@ es5id: 15.2.3.6-4-620
description: >
ES5 Attributes - all attributes in Array.prototype.reduceRight are
correct
includes: [propertyHelper.js]
---*/

var desc = Object.getOwnPropertyDescriptor(Array.prototype, "reduceRight");

var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true);

var temp = Array.prototype.reduceRight;

Array.prototype.reduceRight = "2010";

var isWritable = (Array.prototype.reduceRight === "2010");

var isEnumerable = false;

for (var prop in Array.prototype) {
if (prop === "reduceRight") {
isEnumerable = true;
}
}

delete Array.prototype.reduceRight;

var isConfigurable = !Array.prototype.hasOwnProperty("reduceRight");

assert(propertyAreCorrect, 'propertyAreCorrect !== true');
assert(isWritable, 'isWritable !== true');
assert.sameValue(isEnumerable, false, 'isEnumerable');
assert(isConfigurable, 'isConfigurable !== true');
verifyProperty(Array.prototype, "reduceRight", {
writable: true,
enumerable: false,
configurable: true,
});
Loading

0 comments on commit 86e02df

Please sign in to comment.