From 62626e083bd506124aac6c799464d76c2c42851b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 28 Sep 2023 15:21:39 +0200 Subject: [PATCH] Update tests in built-ins/Object/defineProperty to use verifyProperty --- .../Object/defineProperty/15.2.3.6-4-611.js | 32 ++++--------------- .../Object/defineProperty/15.2.3.6-4-612.js | 32 ++++--------------- .../Object/defineProperty/15.2.3.6-4-613.js | 32 ++++--------------- .../Object/defineProperty/15.2.3.6-4-614.js | 32 ++++--------------- .../Object/defineProperty/15.2.3.6-4-615.js | 32 ++++--------------- .../Object/defineProperty/15.2.3.6-4-616.js | 32 ++++--------------- .../Object/defineProperty/15.2.3.6-4-617.js | 32 ++++--------------- .../Object/defineProperty/15.2.3.6-4-618.js | 32 ++++--------------- .../Object/defineProperty/15.2.3.6-4-619.js | 32 ++++--------------- .../Object/defineProperty/15.2.3.6-4-620.js | 32 ++++--------------- .../Object/defineProperty/15.2.3.6-4-621.js | 32 ++++--------------- .../Object/defineProperty/15.2.3.6-4-622.js | 31 ++++-------------- .../Object/defineProperty/15.2.3.6-4-623.js | 32 ++++--------------- .../Object/defineProperty/15.2.3.6-4-624.js | 32 ++++--------------- 14 files changed, 84 insertions(+), 363 deletions(-) diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-611.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-611.js index 65d279313c..f7811a088b 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-611.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-611.js @@ -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, +}); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-612.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-612.js index d643c1b208..704b67cea5 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-612.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-612.js @@ -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, +}); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-613.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-613.js index b775e09e94..e9f7a93304 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-613.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-613.js @@ -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, +}); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-614.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-614.js index 1a4b20786f..c3187e5110 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-614.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-614.js @@ -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, +}); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-615.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-615.js index 837e8922f6..b45d414f5e 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-615.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-615.js @@ -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, +}); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-616.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-616.js index 73a58e8dd6..a1b91ff8d9 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-616.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-616.js @@ -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, +}); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-617.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-617.js index 64509a0a09..7d7a89cac4 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-617.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-617.js @@ -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, +}); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-618.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-618.js index 1bac706cdc..fe625b6003 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-618.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-618.js @@ -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, +}); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-619.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-619.js index 7a16d04bd1..cec19397e2 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-619.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-619.js @@ -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, +}); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-620.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-620.js index dc134044bc..2e682eff43 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-620.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-620.js @@ -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, +}); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-621.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-621.js index 547d0f7f29..276140db7d 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-621.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-621.js @@ -6,31 +6,11 @@ es5id: 15.2.3.6-4-621 description: > ES5 Attributes - all attributes in String.prototype.trim are correct +includes: [propertyHelper.js] ---*/ -var desc = Object.getOwnPropertyDescriptor(String.prototype, "trim"); - -var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); - -var temp = String.prototype.trim; - -String.prototype.trim = "2010"; - -var isWritable = (String.prototype.trim === "2010"); - -var isEnumerable = false; - -for (var prop in String.prototype) { - if (prop === "trim") { - isEnumerable = true; - } -} - -delete String.prototype.trim; - -var isConfigurable = !String.prototype.hasOwnProperty("trim"); - -assert(propertyAreCorrect, 'propertyAreCorrect !== true'); -assert(isWritable, 'isWritable !== true'); -assert.sameValue(isEnumerable, false, 'isEnumerable'); -assert(isConfigurable, 'isConfigurable !== true'); +verifyProperty(String.prototype, "trim", { + writable: true, + enumerable: false, + configurable: true, +}); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-622.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-622.js index 6a537f6b99..aaeab02b13 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-622.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-622.js @@ -4,31 +4,12 @@ /*--- es5id: 15.2.3.6-4-622 description: ES5 Attributes - all attributes in Date.now are correct +includes: [propertyHelper.js] ---*/ -var desc = Object.getOwnPropertyDescriptor(Date, "now"); +verifyProperty(Date, "now", { + writable: true, + enumerable: false, + configurable: true, +}); -var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); - -var temp = Date.now; - -Date.now = "2010"; - -var isWritable = (Date.now === "2010"); - -var isEnumerable = false; - -for (var prop in Date) { - if (prop === "now") { - isEnumerable = true; - } -} - -delete Date.now; - -var isConfigurable = !Date.hasOwnProperty("now"); - -assert(propertyAreCorrect, 'propertyAreCorrect !== true'); -assert(isWritable, 'isWritable !== true'); -assert.sameValue(isEnumerable, false, 'isEnumerable'); -assert(isConfigurable, 'isConfigurable !== true'); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-623.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-623.js index d36c2cb57e..c719ac4bb1 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-623.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-623.js @@ -6,31 +6,11 @@ es5id: 15.2.3.6-4-623 description: > ES5 Attributes - all attributes in Date.prototype.toISOString are correct +includes: [propertyHelper.js] ---*/ -var desc = Object.getOwnPropertyDescriptor(Date.prototype, "toISOString"); - -var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); - -var temp = Date.prototype.toISOString; - -Date.prototype.toISOString = "2010"; - -var isWritable = (Date.prototype.toISOString === "2010"); - -var isEnumerable = false; - -for (var prop in Date.prototype) { - if (prop === "toISOString") { - isEnumerable = true; - } -} - -delete Date.prototype.toISOString; - -var isConfigurable = !Date.prototype.hasOwnProperty("toISOString"); - -assert(propertyAreCorrect, 'propertyAreCorrect !== true'); -assert(isWritable, 'isWritable !== true'); -assert.sameValue(isEnumerable, false, 'isEnumerable'); -assert(isConfigurable, 'isConfigurable !== true'); +verifyProperty(Date.prototype, "toISOString", { + writable: true, + enumerable: false, + configurable: true, +}); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-624.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-624.js index e95f78499b..9500661c96 100644 --- a/test/built-ins/Object/defineProperty/15.2.3.6-4-624.js +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-624.js @@ -6,31 +6,11 @@ es5id: 15.2.3.6-4-624 description: > ES5 Attributes - all attributes in Date.prototype.toJSON are correct +includes: [propertyHelper.js] ---*/ -var desc = Object.getOwnPropertyDescriptor(Date.prototype, "toJSON"); - -var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); - -var temp = Date.prototype.toJSON; - -Date.prototype.toJSON = "2010"; - -var isWritable = (Date.prototype.toJSON === "2010"); - -var isEnumerable = false; - -for (var prop in Date.prototype) { - if (prop === "toJSON") { - isEnumerable = true; - } -} - -delete Date.prototype.toJSON; - -var isConfigurable = !Date.prototype.hasOwnProperty("toJSON"); - -assert(propertyAreCorrect, 'propertyAreCorrect !== true'); -assert(isWritable, 'isWritable !== true'); -assert.sameValue(isEnumerable, false, 'isEnumerable'); -assert(isConfigurable, 'isConfigurable !== true'); +verifyProperty(Date.prototype, "toJSON", { + writable: true, + enumerable: false, + configurable: true, +});