diff options
Diffstat (limited to 'test/built-ins/Object/freeze/15.2.3.9-2-b-i-2.js')
-rw-r--r-- | test/built-ins/Object/freeze/15.2.3.9-2-b-i-2.js | 85 |
1 files changed, 54 insertions, 31 deletions
diff --git a/test/built-ins/Object/freeze/15.2.3.9-2-b-i-2.js b/test/built-ins/Object/freeze/15.2.3.9-2-b-i-2.js index f985e57df..561832fa2 100644 --- a/test/built-ins/Object/freeze/15.2.3.9-2-b-i-2.js +++ b/test/built-ins/Object/freeze/15.2.3.9-2-b-i-2.js @@ -10,36 +10,59 @@ description: > Object.freeze - The [[Wrtiable]] attribute of all own data property of 'O' is set to false while other attributes are unchanged -includes: - - runTestCase.js - - dataPropertyAttributesAreCorrect.js +includes: [propertyHelper.js] ---*/ -function testcase() { - var obj = {}; - - Object.defineProperty(obj, "foo1", { - value: 10, - writable: false, - enumerable: true, - configurable: false - }); - - Object.defineProperty(obj, "foo2", { - value: 20, - writable: true, - enumerable: false, - configurable: false - }); - - Object.freeze(obj); - - var desc1 = Object.getOwnPropertyDescriptor(obj, "foo1"); - var desc2 = Object.getOwnPropertyDescriptor(obj, "foo2"); - - return dataPropertyAttributesAreCorrect(obj, "foo1", 10, false, true, false) && - dataPropertyAttributesAreCorrect(obj, "foo2", 20, false, false, false) && - desc1.configurable === false && desc1.writable === false && - desc2.configurable === false && desc2.writable === false; - } -runTestCase(testcase); +var obj = {}; + +Object.defineProperty(obj, "foo1", { + value: 10, + writable: false, + enumerable: true, + configurable: false +}); + +Object.defineProperty(obj, "foo2", { + value: 20, + writable: true, + enumerable: false, + configurable: false +}); + +Object.freeze(obj); + +var desc1 = Object.getOwnPropertyDescriptor(obj, "foo1"); +var desc2 = Object.getOwnPropertyDescriptor(obj, "foo2"); + +verifyEqualTo(obj, "foo1", 10); + +verifyNotWritable(obj, "foo1"); + +verifyEnumerable(obj, "foo1"); + +verifyNotConfigurable(obj, "foo1"); + +verifyEqualTo(obj, "foo2", 20); + +verifyNotWritable(obj, "foo2"); + +verifyNotEnumerable(obj, "foo2"); + +verifyNotConfigurable(obj, "foo2"); + +if (desc1.configurable !== false) { + $ERROR('Expected desc1.configurable === false, actually ' + desc1.configurable); +} + +if (desc1.writable !== false) { + $ERROR('Expected desc1.writable === false, actually ' + desc1.writable); +} + +if (desc2.configurable !== false) { + $ERROR('Expected desc2.configurable === false, actually ' + desc2.configurable); +} + +if (desc2.writable !== false) { + $ERROR('Expected desc2.writable === false, actually ' + desc2.writable); +} + |