diff options
Diffstat (limited to 'test/built-ins/Object/defineProperties')
619 files changed, 22134 insertions, 0 deletions
diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-0-1.js b/test/built-ins/Object/defineProperties/15.2.3.7-0-1.js new file mode 100644 index 000000000..d768f488a --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-0-1.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-0-1 +description: Object.defineProperties must exist as a function +includes: [runTestCase.js] +---*/ + +function testcase() { + var f = Object.defineProperties; + if (typeof(f) === "function") { + return true; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-0-2.js b/test/built-ins/Object/defineProperties/15.2.3.7-0-2.js new file mode 100644 index 000000000..0323b6d92 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-0-2.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-0-2 +description: > + Object.defineProperties must exist as a function taking 2 + parameters +includes: [runTestCase.js] +---*/ + +function testcase() { + if (Object.defineProperties.length === 2) { + return true; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-1-1.js b/test/built-ins/Object/defineProperties/15.2.3.7-1-1.js new file mode 100644 index 000000000..b74713265 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-1-1.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-1-1 +description: Object.defineProperties throws TypeError if 'O' is undefined +includes: [runTestCase.js] +---*/ + +function testcase() { + + try { + Object.defineProperties(undefined, {}); + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-1-2.js b/test/built-ins/Object/defineProperties/15.2.3.7-1-2.js new file mode 100644 index 000000000..0cee4768c --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-1-2.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-1-2 +description: Object.defineProperties throws TypeError if 'O' is null +includes: [runTestCase.js] +---*/ + +function testcase() { + + try { + Object.defineProperties(null, {}); + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-1-3.js b/test/built-ins/Object/defineProperties/15.2.3.7-1-3.js new file mode 100644 index 000000000..dc47a003c --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-1-3.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-1-3 +description: Object.defineProperties throws TypeError if 'O' is a boolean +includes: [runTestCase.js] +---*/ + +function testcase() { + + try { + Object.defineProperties(true, {}); + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-1-4.js b/test/built-ins/Object/defineProperties/15.2.3.7-1-4.js new file mode 100644 index 000000000..a36d48341 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-1-4.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-1-4 +description: Object.defineProperties throws TypeError if 'O' is a string +includes: [runTestCase.js] +---*/ + +function testcase() { + + try { + Object.defineProperties("abc", {}); + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-1.js b/test/built-ins/Object/defineProperties/15.2.3.7-1.js new file mode 100644 index 000000000..d4f5cc12c --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-1.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-1 +description: > + Object.defineProperties throws TypeError if type of first param is + not Object +includes: [runTestCase.js] +---*/ + +function testcase() { + try { + Object.defineProperties(0, {}); + } + catch (e) { + if (e instanceof TypeError) { + return true; + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-2-1.js b/test/built-ins/Object/defineProperties/15.2.3.7-2-1.js new file mode 100644 index 000000000..40db6d8cb --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-2-1.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-2-1 +description: Object.defineProperties throws TypeError if 'Properties' is null +includes: [runTestCase.js] +---*/ + +function testcase() { + + try { + Object.defineProperties({}, null); + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-2-10.js b/test/built-ins/Object/defineProperties/15.2.3.7-2-10.js new file mode 100644 index 000000000..b4008e4c2 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-2-10.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-2-10 +description: Object.defineProperties - argument 'Properties' is an Array object +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var props = []; + var result = false; + + Object.defineProperty(props, "prop", { + get: function () { + result = this instanceof Array; + return {}; + }, + enumerable: true + }); + + Object.defineProperties(obj, props); + return result; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-2-11.js b/test/built-ins/Object/defineProperties/15.2.3.7-2-11.js new file mode 100644 index 000000000..5a8941fa3 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-2-11.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-2-11 +description: Object.defineProperties - argument 'Properties' is the Math object +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var result = false; + + try { + Object.defineProperty(Math, "prop", { + get: function () { + result = (this === Math); + return {}; + }, + enumerable: true, + configurable: true + }); + + Object.defineProperties(obj, Math); + return result; + } finally { + delete Math.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-2-12.js b/test/built-ins/Object/defineProperties/15.2.3.7-2-12.js new file mode 100644 index 000000000..34d26cd13 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-2-12.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-2-12 +description: Object.defineProperties - argument 'Properties' is a Date object +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var props = new Date(); + var result = false; + + Object.defineProperty(props, "prop", { + get: function () { + result = this instanceof Date; + return {}; + }, + enumerable: true + }); + + Object.defineProperties(obj, props); + return result; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-2-13.js b/test/built-ins/Object/defineProperties/15.2.3.7-2-13.js new file mode 100644 index 000000000..679e0ec6c --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-2-13.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-2-13 +description: Object.defineProperties - argument 'Properties' is a RegExp object +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var props = new RegExp(); + var result = false; + + Object.defineProperty(props, "prop", { + get: function () { + result = this instanceof RegExp; + return {}; + }, + enumerable: true + }); + + Object.defineProperties(obj, props); + return result; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-2-14.js b/test/built-ins/Object/defineProperties/15.2.3.7-2-14.js new file mode 100644 index 000000000..b4b2116f9 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-2-14.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-2-14 +description: Object.defineProperties - argument 'Properties' is the JSON object +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var result = false; + + try { + Object.defineProperty(JSON, "prop", { + get: function () { + result = (this === JSON); + return {}; + }, + enumerable: true, + configurable: true + }); + + Object.defineProperties(obj, JSON); + return result; + } finally { + delete JSON.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-2-15.js b/test/built-ins/Object/defineProperties/15.2.3.7-2-15.js new file mode 100644 index 000000000..a37820529 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-2-15.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-2-15 +description: Object.defineProperties - argument 'Properties' is an Error object +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var props = new Error("test"); + var obj1 = { + value: 11 + }; + props.description = obj1; + props.message = obj1; + props.name = obj1; + + var result = false; + + Object.defineProperty(props, "prop", { + get: function () { + result = this instanceof Error; + return {}; + }, + enumerable: true + }); + + Object.defineProperties(obj, props); + return result; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-2-16.js b/test/built-ins/Object/defineProperties/15.2.3.7-2-16.js new file mode 100644 index 000000000..574f6a664 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-2-16.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-2-16 +description: > + Object.defineProperties - argument 'Properties' is the Arguments + object +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var result = false; + + var Fun = function () { + return arguments; + }; + var props = new Fun(); + + Object.defineProperty(props, "prop", { + get: function () { + result = ('[object Arguments]' === Object.prototype.toString.call(this)); + return {}; + }, + enumerable: true + }); + + Object.defineProperties(obj, props); + return result; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-2-18.js b/test/built-ins/Object/defineProperties/15.2.3.7-2-18.js new file mode 100644 index 000000000..ab08ca928 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-2-18.js @@ -0,0 +1,40 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-2-18 +description: > + Object.defineProperties - argument 'Properties' is the global + object +includes: + - runTestCase.js + - fnGlobalObject.js +---*/ + +function testcase() { + + var obj = {}; + var result = false; + + try { + Object.defineProperty(fnGlobalObject(), "prop", { + get: function () { + result = (this === fnGlobalObject()); + return {}; + }, + enumerable: true, + configurable:true + }); + + Object.defineProperties(obj, fnGlobalObject()); + return result; + } catch (e) { + return (e instanceof TypeError); + } finally { + delete fnGlobalObject().prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-2-2.js b/test/built-ins/Object/defineProperties/15.2.3.7-2-2.js new file mode 100644 index 000000000..13131bd2d --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-2-2.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-2-2 +description: > + Object.defineProperties throws TypeError if 'Properties' is + undefined +includes: [runTestCase.js] +---*/ + +function testcase() { + + try { + Object.defineProperties({}, undefined); + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-2-3.js b/test/built-ins/Object/defineProperties/15.2.3.7-2-3.js new file mode 100644 index 000000000..7400f56a7 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-2-3.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-2-3 +description: > + Object.defineProperties - argument 'Properties' is a boolean whose + value is false +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var obj1 = Object.defineProperties(obj, false); + return obj === obj1; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-2-4.js b/test/built-ins/Object/defineProperties/15.2.3.7-2-4.js new file mode 100644 index 000000000..722ec3fca --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-2-4.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-2-4 +description: > + Object.defineProperties - argument 'Properties' is a Boolean + object whose primitive value is true +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var props = new Boolean(true); + var result = false; + + Object.defineProperty(props, "prop", { + get: function () { + result = this instanceof Boolean; + return {}; + }, + enumerable: true + }); + + Object.defineProperties(obj, props); + return result; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-2-5.js b/test/built-ins/Object/defineProperties/15.2.3.7-2-5.js new file mode 100644 index 000000000..46afc3084 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-2-5.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-2-5 +description: > + Object.defineProperties - argument 'Properties' is any interesting + number +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = { "123": 100 }; + var obj1 = Object.defineProperties(obj, -12); + return obj === obj1; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-2-6.js b/test/built-ins/Object/defineProperties/15.2.3.7-2-6.js new file mode 100644 index 000000000..eeca7b709 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-2-6.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-2-6 +description: > + Object.defineProperties - argument 'Properties' is a Number object + whose primitive value is any interesting number +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var props = new Number(-12); + var result = false; + + Object.defineProperty(props, "prop", { + get: function () { + result = this instanceof Number; + return {}; + }, + enumerable: true + }); + + Object.defineProperties(obj, props); + return result; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-2-7.js b/test/built-ins/Object/defineProperties/15.2.3.7-2-7.js new file mode 100644 index 000000000..480fc6fc8 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-2-7.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-2-7 +description: > + Object.defineProperties - argument 'Properties' is a string whose + value is any interesting string +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = { "123": 100 }; + var obj1 = Object.defineProperties(obj, ""); + return obj === obj1; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-2-8.js b/test/built-ins/Object/defineProperties/15.2.3.7-2-8.js new file mode 100644 index 000000000..09f84735f --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-2-8.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-2-8 +description: > + Object.defineProperties - argument 'Properties' is a String object + whose primitive value is any interesting string +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var props = new String(); + var result = false; + + Object.defineProperty(props, "prop", { + get: function () { + result = this instanceof String; + return {}; + }, + enumerable: true + }); + + Object.defineProperties(obj, props); + return result; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-2-9.js b/test/built-ins/Object/defineProperties/15.2.3.7-2-9.js new file mode 100644 index 000000000..58ef630f8 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-2-9.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-2-9 +description: > + Object.defineProperties - argument 'Properties' is a Function + object +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var props = function () { }; + var result = false; + + Object.defineProperty(props, "prop", { + get: function () { + result = this instanceof Function; + return {}; + }, + enumerable: true + }); + + Object.defineProperties(obj, props); + return result; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-3-1.js b/test/built-ins/Object/defineProperties/15.2.3.7-3-1.js new file mode 100644 index 000000000..09cda3f34 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-3-1.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-3-1 +description: > + Object.defineProperties - enumerable own data property of + 'Properties' is defined in 'O' +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var props = {}; + Object.defineProperty(props, "prop", { + value: {}, + enumerable: true + }); + + Object.defineProperties(obj, props); + + return obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-3-2.js b/test/built-ins/Object/defineProperties/15.2.3.7-3-2.js new file mode 100644 index 000000000..fa9fe59be --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-3-2.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-3-2 +description: > + Object.defineProperties - own data property of 'Properties' which + is not enumerable is not defined in 'O' +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var props = {}; + + Object.defineProperty(props, "prop", { + value: {}, + enumerable: false + }); + + Object.defineProperties(obj, props); + + return !obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-3-3.js b/test/built-ins/Object/defineProperties/15.2.3.7-3-3.js new file mode 100644 index 000000000..7728d401e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-3-3.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-3-3 +description: > + Object.defineProperties - enumerable inherited data property of + 'Properties' is not defined in 'O' +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + var proto = {}; + + Object.defineProperty(proto, "prop", { + value: {}, + enumerable: true + }); + + var Con = function () { }; + Con.prototype = proto; + var child = new Con(); + + Object.defineProperties(obj, child); + + return !obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-3-4.js b/test/built-ins/Object/defineProperties/15.2.3.7-3-4.js new file mode 100644 index 000000000..3d2265987 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-3-4.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-3-4 +description: > + Object.defineProperties - enumerable own accessor property of + 'Properties' is defined in 'O' +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + var props = {}; + + Object.defineProperty(props, "prop", { + get: function () { + return {}; + }, + enumerable: true + }); + + Object.defineProperties(obj, props); + + return obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-3-5.js b/test/built-ins/Object/defineProperties/15.2.3.7-3-5.js new file mode 100644 index 000000000..f09b305da --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-3-5.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-3-5 +description: > + Object.defineProperties - own accessor property of 'Properties' + which is not enumerable is not defined in 'O' +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + var props = {}; + + Object.defineProperty(props, "prop", { + get: function () { + return {}; + }, + enumerable: false + }); + + Object.defineProperties(obj, props); + + return !obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-3-6.js b/test/built-ins/Object/defineProperties/15.2.3.7-3-6.js new file mode 100644 index 000000000..ddd5c9bbc --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-3-6.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-3-6 +description: > + Object.defineProperties - enumerable inherited accessor property + of 'Properties' is not defined in 'O' +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var proto = {}; + + Object.defineProperty(proto, "prop", { + get: function () { + return {}; + }, + enumerable: true + }); + + var Con = function () { }; + Con.prototype = proto; + var child = new Con(); + + Object.defineProperties(obj, child); + + return !obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-3-7.js b/test/built-ins/Object/defineProperties/15.2.3.7-3-7.js new file mode 100644 index 000000000..e2744f2a0 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-3-7.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-3-7 +description: > + Object.defineProperties - no additional property is defined in 'O' + when 'Properties' doesn't contain enumerable own property +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + var props = {}; + + Object.defineProperty(props, "prop1", { + value: {}, + enumerable: false + }); + + Object.defineProperty(props, "prop2", { + get: function () { + return {}; + }, + enumerable: false + }); + + Object.defineProperties(obj, props); + + return !obj.hasOwnProperty("prop1") && !obj.hasOwnProperty("prop2"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-3-8.js b/test/built-ins/Object/defineProperties/15.2.3.7-3-8.js new file mode 100644 index 000000000..156cf58e4 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-3-8.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-3-8 +description: > + Object.defineProperties - no additional property is defined in 'O' + when 'Properties' doesn't contain enumerable own property +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + var props = {}; + + Object.defineProperty(props, "prop1", { + value: {}, + enumerable: false + }); + + Object.defineProperty(props, "prop2", { + get: function () { + return {}; + }, + enumerable: true + }); + + Object.defineProperties(obj, props); + + return !obj.hasOwnProperty("prop1") && obj.hasOwnProperty("prop2"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-a-1.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-1.js new file mode 100644 index 000000000..30df974e9 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-1.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-a-1 +description: > + Object.defineProperties - 'P' is own data property that overrides + enumerable inherited data property of 'Properties' is defined in + 'O' +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + var proto = {}; + + Object.defineProperty(proto, "prop", { + value: { + value: 9 + }, + enumerable: true + }); + + var Con = function () { }; + Con.prototype = proto; + + var child = new Con(); + Object.defineProperty(child, "prop", { + value: { + value: 12 + }, + enumerable: true + }); + + Object.defineProperties(obj, child); + + return obj.hasOwnProperty("prop") && obj.prop === 12; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-a-10.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-10.js new file mode 100644 index 000000000..8b1c94690 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-10.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-a-10 +description: > + Object.defineProperties - 'Properties' is a Boolean object which + implements its own [[Get]] method to get enumerable own property +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var props = new Boolean(false); + + Object.defineProperty(props, "prop", { + value: { + value: 10 + }, + enumerable: true + }); + Object.defineProperties(obj, props); + + return obj.hasOwnProperty("prop") && obj.prop === 10; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-a-11.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-11.js new file mode 100644 index 000000000..2cdc9b531 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-11.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-a-11 +description: > + Object.defineProperties - 'Properties' is a Number object which + implements its own [[Get]] method to get enumerable own property +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var props = new Number(-9); + + Object.defineProperty(props, "prop", { + value: { + value: 12 + }, + enumerable: true + }); + Object.defineProperties(obj, props); + + return obj.hasOwnProperty("prop") && obj.prop === 12; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-a-12.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-12.js new file mode 100644 index 000000000..e23f71a39 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-12.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-a-12 +description: > + Object.defineProperties - 'Properties' is the Math object which + implements its own [[Get]] method to get enumerable own property +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + try { + Math.prop = { + value: 12 + }; + Object.defineProperties(obj, Math); + + return obj.hasOwnProperty("prop") && obj.prop === 12; + } finally { + delete Math.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-a-13.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-13.js new file mode 100644 index 000000000..788d3913c --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-13.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-a-13 +description: > + Object.defineProperties - 'Properties' is a Date object which + implements its own [[Get]] method to get enumerable own property +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var props = new Date(); + + Object.defineProperty(props, "prop", { + value: { + value: 13 + }, + enumerable: true + }); + Object.defineProperties(obj, props); + + return obj.hasOwnProperty("prop") && obj.prop === 13; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-a-14.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-14.js new file mode 100644 index 000000000..f08d4ff88 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-14.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-a-14 +description: > + Object.defineProperties - 'Properties' is a RegExp object which + implements its own [[Get]] method to get enumerable own property +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var props = new RegExp(); + + Object.defineProperty(props, "prop", { + value: { + value: 14 + }, + enumerable: true + }); + Object.defineProperties(obj, props); + + return obj.hasOwnProperty("prop") && obj.prop === 14; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-a-15.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-15.js new file mode 100644 index 000000000..99d3f7b23 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-15.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-a-15 +description: > + Object.defineProperties - 'Properties' is the JSON object which + implements its own [[Get]] method to get enumerable own property +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + JSON.prop = { + value: 15 + }; + Object.defineProperties(obj, JSON); + + return obj.hasOwnProperty("prop") && obj.prop === 15; + } finally { + delete JSON.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-a-16.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-16.js new file mode 100644 index 000000000..b6d3bd74d --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-16.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-a-16 +description: > + Object.defineProperties - 'Properties' is an Error object which + implements its own [[Get]] method to get enumerable own property +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var props = new Error("test"); + var obj1 = { + value: 11 + }; + props.message = obj1; + props.name = obj1; + props.description = obj1; + + props.prop = { + value: 16 + }; + Object.defineProperties(obj, props); + + return obj.hasOwnProperty("prop") && obj.prop === 16; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-a-17.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-17.js new file mode 100644 index 000000000..7e78b2090 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-17.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-a-17 +description: > + Object.defineProperties - 'Properties' is the Arguments object + which implements its own [[Get]] method to get enumerable own + property +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var arg; + + (function fun() { + arg = arguments; + }()); + + Object.defineProperty(arg, "prop", { + value: { + value: 17 + }, + enumerable: true + }); + + Object.defineProperties(obj, arg); + + return obj.hasOwnProperty("prop") && obj.prop === 17; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-a-2.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-2.js new file mode 100644 index 000000000..9a6b6ff6e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-2.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-a-2 +description: > + Object.defineProperties - 'P' is own data property that overrides + enumerable inherited accessor property of 'Properties' is defined + in 'O' +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var proto = {}; + + Object.defineProperty(proto, "prop", { + get: function () { + return { + value: 9 + }; + }, + enumerable: true + }); + + var Con = function () { }; + Con.prototype = proto; + + var child = new Con(); + Object.defineProperty(child, "prop", { + value: { + value: 12 + }, + enumerable: true + }); + Object.defineProperties(obj, child); + + return obj.hasOwnProperty("prop") && obj.prop === 12; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-a-3.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-3.js new file mode 100644 index 000000000..6ce8de7ea --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-3.js @@ -0,0 +1,45 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-a-3 +description: > + Object.defineProperties - enumerable own accessor property of + 'Properties' that overrides enumerable inherited data property of + 'Properties' is defined in 'O' +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + var proto = {}; + + Object.defineProperty(proto, "prop", { + value: { + value: 9 + }, + enumerable: true + }); + + var Con = function () { }; + Con.prototype = proto; + + var child = new Con(); + Object.defineProperty(child, "prop", { + get: function () { + return { + value: 12 + }; + }, + enumerable: true + }); + Object.defineProperties(obj, child); + + return obj.hasOwnProperty("prop") && obj.prop === 12; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-a-4.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-4.js new file mode 100644 index 000000000..d8a06ed24 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-4.js @@ -0,0 +1,47 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-a-4 +description: > + Object.defineProperties - enumerable own accessor property of + 'Properties' that overrides enumerable inherited accessor property + of 'Properties' is defined in 'O' +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + var proto = {}; + + Object.defineProperty(proto, "prop", { + get: function () { + return { + value: 9 + }; + }, + enumerable: false + }); + + var Con = function () { }; + Con.prototype = proto; + + var child = new Con(); + Object.defineProperty(child, "prop", { + get: function () { + return { + value: 12 + }; + }, + enumerable: true + }); + Object.defineProperties(obj, child); + + return obj.hasOwnProperty("prop") && obj.prop === 12; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-a-5.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-5.js new file mode 100644 index 000000000..cb9d590bc --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-5.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-a-5 +description: > + Object.defineProperties - enumerable own accessor property of + 'Properties' without a get function is defined in 'O' +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + var props = {}; + Object.defineProperty(props, "prop", { + get: function () { + return { + set: function () { } + }; + }, + enumerable: true + }); + + Object.defineProperties(obj, props); + + return obj.hasOwnProperty("prop") && typeof obj.prop === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-a-6.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-6.js new file mode 100644 index 000000000..75d058352 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-6.js @@ -0,0 +1,45 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-a-6 +description: > + Object.defineProperties - enumerable own accessor property of + 'Properties' without a get function that overrides enumerable + inherited accessor property of 'Properties' is defined in 'O' +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + var proto = {}; + + Object.defineProperty(proto, "prop", { + get: function () { + return 12; + }, + enumerable: true + }); + + var Con = function () { }; + Con.prototype = proto; + + var child = new Con(); + Object.defineProperty(child, "prop", { + get: function () { + return { + set: function () { } + }; + }, + enumerable: true + }); + Object.defineProperties(obj, child); + + return obj.hasOwnProperty("prop") && typeof obj.prop === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-a-7.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-7.js new file mode 100644 index 000000000..58d57f95c --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-7.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-a-7 +description: > + Object.defineProperties - 'Properties' is a Function object which + implements its own [[Get]] method to get enumerable own property +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var props = function () { }; + + Object.defineProperty(props, "prop", { + value: { + value: 7 + }, + enumerable: true + }); + + Object.defineProperties(obj, props); + + return obj.hasOwnProperty("prop") && obj.prop === 7; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-a-8.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-8.js new file mode 100644 index 000000000..2b6773d90 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-8.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-a-8 +description: > + Object.defineProperties - 'Properties' is an Array object which + implements its own [[Get]] method to get enumerable own property +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var props = []; + var descObj = { + value: 8 + }; + + Object.defineProperty(props, "prop", { + value: descObj, + enumerable: true + }); + Object.defineProperties(obj, props); + + return obj.hasOwnProperty("prop") && obj.prop === 8; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-a-9.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-9.js new file mode 100644 index 000000000..d5258158b --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-a-9.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-a-9 +description: > + Object.defineProperties - 'Properties' is a String object which + implements its own [[Get]] method to get enumerable own property +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var props = new String(); + + Object.defineProperty(props, "prop", { + value: { + value: 9 + }, + enumerable: true + }); + Object.defineProperties(obj, props); + + return obj.hasOwnProperty("prop") && obj.prop === 9; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-1.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-1.js new file mode 100644 index 000000000..2edc9223b --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-1.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-1 +description: Object.defineProperties - 'descObj' is undefined (8.10.5 step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + try { + Object.defineProperties(obj, { + prop: undefined + }); + return false; + } catch (e) { + return e instanceof TypeError && !obj.hasOwnProperty("prop"); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-10.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-10.js new file mode 100644 index 000000000..822c8a20d --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-10.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-10 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + own data property that overrides an inherited data property + (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + var proto = { + enumerable: true + }; + + var Con = function () { }; + Con.prototype = proto; + var descObj = new Con(); + + Object.defineProperty(descObj, "enumerable", { + value: false + }); + + Object.defineProperties(obj, { + prop: descObj + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-100.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-100.js new file mode 100644 index 000000000..c0e5356f9 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-100.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-100 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is Boolean object (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + configurable: new Boolean(true) + } + }); + + var preCheck = obj.hasOwnProperty("property"); + delete obj.property; + + return preCheck && !obj.hasOwnProperty("property"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-101.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-101.js new file mode 100644 index 000000000..03b1fb1bf --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-101.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-101 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is Number object (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + configurable: new Number(-123) + } + }); + var preCheck = obj.hasOwnProperty("property"); + delete obj.property; + + return preCheck && !obj.hasOwnProperty("property"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-102.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-102.js new file mode 100644 index 000000000..7e8f22b47 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-102.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-102 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is the Math object (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + configurable: Math + } + }); + var preCheck = obj.hasOwnProperty("property"); + delete obj.property; + + return preCheck && !obj.hasOwnProperty("property"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-103.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-103.js new file mode 100644 index 000000000..3a8864736 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-103.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-103 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is Date object (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + configurable: new Date() + } + }); + var preCheck = obj.hasOwnProperty("property"); + delete obj.property; + + return preCheck && !obj.hasOwnProperty("property"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-104.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-104.js new file mode 100644 index 000000000..e18a2186f --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-104.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-104 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is RegExp object (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + configurable: new RegExp() + } + }); + var preCheck = obj.hasOwnProperty("property"); + delete obj.property; + + return preCheck && !obj.hasOwnProperty("property"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-105.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-105.js new file mode 100644 index 000000000..38707e07a --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-105.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-105 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is the JSON object (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + configurable: JSON + } + }); + var preCheck = obj.hasOwnProperty("property"); + delete obj.property; + + return preCheck && !obj.hasOwnProperty("property"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-106.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-106.js new file mode 100644 index 000000000..19e84761e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-106.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-106 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is Error object (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + configurable: new SyntaxError() + } + }); + var preCheck = obj.hasOwnProperty("property"); + delete obj.property; + + return preCheck && !obj.hasOwnProperty("property"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-107.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-107.js new file mode 100644 index 000000000..7c36792f4 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-107.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-107 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is the Argument object (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var func = function (a, b, c) { + return arguments; + }; + + var args = func(1, true, "a"); + + Object.defineProperties(obj, { + property: { + configurable: args + } + }); + var preCheck = obj.hasOwnProperty("property"); + delete obj.property; + + return preCheck && !obj.hasOwnProperty("property"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-109.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-109.js new file mode 100644 index 000000000..b84fabff7 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-109.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-109 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is the global object (8.10.5 step 4.b) +includes: + - runTestCase.js + - fnGlobalObject.js +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + configurable: fnGlobalObject() + } + }); + var preCheck = obj.hasOwnProperty("property"); + delete obj.property; + + return preCheck && !obj.hasOwnProperty("property"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-11.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-11.js new file mode 100644 index 000000000..c75474f93 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-11.js @@ -0,0 +1,47 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-11 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + own data property that overrides an inherited accessor property + (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var proto = {}; + var accessed = false; + + Object.defineProperty(proto, "enumerable", { + get: function () { + return true; + } + }); + + var Con = function () { }; + Con.prototype = proto; + var descObj = new Con(); + + Object.defineProperty(descObj, "enumerable", { + value: false + }); + + Object.defineProperties(obj, { + prop: descObj + }); + + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-110.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-110.js new file mode 100644 index 000000000..bec1545e1 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-110.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-110 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is a string (value is 'false') which is treated as true + value (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + configurable: "false" + } + }); + var preCheck = obj.hasOwnProperty("property"); + delete obj.property; + + return preCheck && !obj.hasOwnProperty("property"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-111.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-111.js new file mode 100644 index 000000000..40dae3905 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-111.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-111 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is new Boolean(false) which is treated as true value + (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + configurable: new Boolean(false) + } + }); + var preCheck = obj.hasOwnProperty("property"); + delete obj.property; + + return preCheck && !obj.hasOwnProperty("property"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-112.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-112.js new file mode 100644 index 000000000..c2af6381a --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-112.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-112 +description: > + Object.defineProperties - 'value' property of 'descObj' is present + (8.10.5 step 5) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + value: 300 + } + }); + + return obj.property === 300; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-113.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-113.js new file mode 100644 index 000000000..dc67ffecf --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-113.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-113 +description: > + Object.defineProperties - 'value' property of 'descObj' is not + present (8.10.5 step 5) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: true + } + }); + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-114.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-114.js new file mode 100644 index 000000000..601ac83ad --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-114.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-114 +description: > + Object.defineProperties - 'value' property of 'descObj' is own + data property (8.10.5 step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + value: "ownDataProperty" + } + }); + + return obj.property === "ownDataProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-115.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-115.js new file mode 100644 index 000000000..4500ddb1d --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-115.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-115 +description: > + Object.defineProperties - 'value' property of 'descObj' is + inherited data property (8.10.5 step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var proto = { + value: "inheritedDataProperty" + }; + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.property === "inheritedDataProperty"; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-116.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-116.js new file mode 100644 index 000000000..b9ab1bc8a --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-116.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-116 +description: > + Object.defineProperties - 'value' property of 'descObj' is own + data property that overrides an inherited data property (8.10.5 + step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var proto = { + value: "inheritedDataProperty" + }; + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + + descObj.value = "ownDataProperty"; + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.property === "ownDataProperty"; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-117.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-117.js new file mode 100644 index 000000000..9c27d8799 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-117.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-117 +description: > + Object.defineProperties - 'value' property of 'descObj' is own + data property that overrides an inherited accessor property + (8.10.5 step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var proto = {}; + + Object.defineProperty(proto, "value", { + get: function () { + return "inheritedAccessorProperty"; + } + }); + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + + Object.defineProperty(descObj, "value", { + value: "ownDataProperty" + }); + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.property === "ownDataProperty"; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-118.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-118.js new file mode 100644 index 000000000..6a7742f8a --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-118.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-118 +description: > + Object.defineProperties - 'value' property of 'descObj' is own + accessor property (8.10.5 step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var descObj = {}; + + Object.defineProperty(descObj, "value", { + get: function () { + return "ownAccessorProperty"; + } + }); + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.property === "ownAccessorProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-119.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-119.js new file mode 100644 index 000000000..693c573e5 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-119.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-119 +description: > + Object.defineProperties - 'value' property of 'descObj' is + inherited accessor property (8.10.5 step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var proto = {}; + + Object.defineProperty(proto, "value", { + get: function () { + return "inheritedAccessorProperty"; + } + }); + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.property === "inheritedAccessorProperty"; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-12.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-12.js new file mode 100644 index 000000000..62b2ad27c --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-12.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-12 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + own accessor property (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + var descObj = {}; + + Object.defineProperty(descObj, "enumerable", { + get: function () { + return true; + } + }); + + Object.defineProperties(obj, { + prop: descObj + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-120.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-120.js new file mode 100644 index 000000000..25cc0fc4e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-120.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-120 +description: > + Object.defineProperties - 'value' property of 'descObj' is own + accessor property that overrides an inherited data property + (8.10.5 step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var proto = { + value: "inheritedDataProperty" + }; + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + + Object.defineProperty(descObj, "value", { + get: function () { + return "ownAccessorProperty"; + } + }); + + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.property === "ownAccessorProperty"; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-121.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-121.js new file mode 100644 index 000000000..33efa395a --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-121.js @@ -0,0 +1,45 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-121 +description: > + Object.defineProperties - 'value' property of 'descObj' is own + accessor property that overrides an inherited accessor property + (8.10.5 step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var proto = {}; + + Object.defineProperty(proto, "value", { + get: function () { + return "inheritedAccessorProperty"; + } + }); + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + + Object.defineProperty(descObj, "value", { + get: function () { + return "ownAccessorProperty"; + } + }); + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.property === "ownAccessorProperty"; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-122.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-122.js new file mode 100644 index 000000000..e21797bd2 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-122.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-122 +description: > + Object.defineProperties - 'value' property of 'descObj' is own + accessor property without a get function (8.10.5 step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var descObj = {}; + + Object.defineProperty(descObj, "value", { + set: function () { } + }); + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-123.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-123.js new file mode 100644 index 000000000..c6e232d44 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-123.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-123 +description: > + Object.defineProperties - 'value' property of 'descObj' is own + accessor property without a get function that overrides an + inherited accessor property (8.10.5 step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var proto = {}; + + Object.defineProperty(proto, "value", { + get: function () { + return "inheritedAccessorProperty"; + } + }); + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + + Object.defineProperty(descObj, "value", { + set: function () { } + }); + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-124.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-124.js new file mode 100644 index 000000000..1265e929b --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-124.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-124 +description: > + Object.defineProperties - 'value' property of 'descObj' is + inherited accessor property without a get function (8.10.5 step + 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var proto = {}; + + Object.defineProperty(proto, "value", { + set: function () { } + }); + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-125.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-125.js new file mode 100644 index 000000000..06fcb0f6f --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-125.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-125 +description: > + Object.defineProperties - 'descObj' is a Function object which + implements its own [[Get]] method to get 'value' property (8.10.5 + step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var func = function (a, b) { + return a + b; + }; + + func.value = "Function"; + + Object.defineProperties(obj, { + property: func + }); + + return obj.property === "Function"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-126.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-126.js new file mode 100644 index 000000000..8062fd45b --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-126.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-126 +description: > + Object.defineProperties - 'descObj' is an Array object which + implements its own [[Get]] method to get 'value' property (8.10.5 + step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var arr = [1, 2, 3]; + + arr.value = "Array"; + + Object.defineProperties(obj, { + property: arr + }); + + return obj.property === "Array"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-127.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-127.js new file mode 100644 index 000000000..8356a3cd6 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-127.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-127 +description: > + Object.defineProperties - 'descObj' is a String object which + implements its own [[Get]] method to get 'value' property (8.10.5 + step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var str = new String("abc"); + + str.value = "String"; + + Object.defineProperties(obj, { + property: str + }); + + return obj.property === "String"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-128.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-128.js new file mode 100644 index 000000000..d40b6db0f --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-128.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-128 +description: > + Object.defineProperties - 'descObj' is a Boolean object which + implements its own [[Get]] method to get 'value' property (8.10.5 + step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var descObj = new Boolean(false); + + descObj.value = "Boolean"; + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.property === "Boolean"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-129.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-129.js new file mode 100644 index 000000000..b08b22005 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-129.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-129 +description: > + Object.defineProperties - 'descObj' is a Number object which + implements its own [[Get]] method to get 'value' property (8.10.5 + step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var descObj = new Number(-9); + + descObj.value = "Number"; + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.property === "Number"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-13.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-13.js new file mode 100644 index 000000000..a8922487a --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-13.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-13 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + inherited accessor property (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var proto = {}; + var accessed = false; + + Object.defineProperty(proto, "enumerable", { + get: function () { + return true; + } + }); + + var Con = function () { }; + Con.prototype = proto; + var descObj = new Con(); + + Object.defineProperties(obj, { + prop: descObj + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-130.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-130.js new file mode 100644 index 000000000..a6c8df172 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-130.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-130 +description: > + Object.defineProperties - 'descObj' is the Math object which + implements its own [[Get]] method to get 'value' property (8.10.5 + step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + Math.value = "Math"; + + Object.defineProperties(obj, { + property: Math + }); + + return obj.property === "Math"; + } finally { + delete Math.value; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-131.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-131.js new file mode 100644 index 000000000..929ad5054 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-131.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-131 +description: > + Object.defineProperties - 'descObj' is a Date object which + implements its own [[Get]] method to get 'value' property (8.10.5 + step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var descObj = new Date(); + + descObj.value = "Date"; + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.property === "Date"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-132.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-132.js new file mode 100644 index 000000000..4d63b2850 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-132.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-132 +description: > + Object.defineProperties - 'descObj' is a RegExp object which + implements its own [[Get]] method to get 'value' property (8.10.5 + step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var descObj = new RegExp(); + + descObj.value = "RegExp"; + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.property === "RegExp"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-133.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-133.js new file mode 100644 index 000000000..6decd3430 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-133.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-133 +description: > + Object.defineProperties - 'descObj' is the JSON object which + implements its own [[Get]] method to get 'value' property (8.10.5 + step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + JSON.value = "JSON"; + + Object.defineProperties(obj, { + property: JSON + }); + + return obj.property === "JSON"; + } finally { + delete JSON.value; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-134.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-134.js new file mode 100644 index 000000000..79bb76264 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-134.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-134 +description: > + Object.defineProperties - 'descObj' is an Error object which + implements its own [[Get]] method to get 'value' property (8.10.5 + step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var descObj = new Error(); + + descObj.value = "Error"; + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.property === "Error"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-135.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-135.js new file mode 100644 index 000000000..01e9404a8 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-135.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-135 +description: > + Object.defineProperties - 'descObj' is the Arguments object which + implements its own [[Get]] method to get 'value' property (8.10.5 + step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var func = function (a, b) { + arguments.value = "arguments"; + + Object.defineProperties(obj, { + property: arguments + }); + + return obj.property === "arguments"; + }; + + return func(); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-137.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-137.js new file mode 100644 index 000000000..597f0b2f6 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-137.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-137 +description: > + Object.defineProperties - 'descObj' is the global object which + implements its own [[Get]] method to get 'value' property (8.10.5 + step 5.a) +includes: + - runTestCase.js + - fnGlobalObject.js +---*/ + +function testcase() { + var obj = {}; + + try { + fnGlobalObject().value = "global"; + + Object.defineProperties(obj, { + property: fnGlobalObject() + }); + + return obj.property === "global"; + } finally { + delete fnGlobalObject().value; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-138.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-138.js new file mode 100644 index 000000000..90f74b537 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-138.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-138 +description: > + Object.defineProperties - 'writable' property of 'descObj' is + present (8.10.5 step 6) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: false + } + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-139.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-139.js new file mode 100644 index 000000000..bd4d829b3 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-139.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-139 +description: > + Object.defineProperties - 'writable' property of 'descObj' is not + present (8.10.5 step 6) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + value: "abc" + } + }); + + obj.property = "isWritable"; + + return obj.property === "abc"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-14.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-14.js new file mode 100644 index 000000000..dc9d25d9f --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-14.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-14 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + own accessor property that overrides an inherited data property + (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + var proto = { + enumerable: true + }; + + var Con = function () { }; + Con.prototype = proto; + var descObj = new Con(); + + Object.defineProperty(descObj, "enumerable", { + get: function () { + return false; + } + }); + + Object.defineProperties(obj, { + prop: descObj + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-140.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-140.js new file mode 100644 index 000000000..b4713fff3 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-140.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-140 +description: > + Object.defineProperties - 'writable' property of 'descObj' is own + data property (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: false + } + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-141.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-141.js new file mode 100644 index 000000000..3e96bb06b --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-141.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-141 +description: > + Object.defineProperties - 'writable' property of 'descObj' is + inherited data property (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var proto = { + writable: false + }; + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + + Object.defineProperties(obj, { + property: descObj + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-142.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-142.js new file mode 100644 index 000000000..c8d773512 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-142.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-142 +description: > + Object.defineProperties - 'writable' property of 'descObj' is own + data property that overrides an inherited data property (8.10.5 + step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var proto = { + writable: true + }; + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + + descObj.writable = false; + + Object.defineProperties(obj, { + property: descObj + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-143.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-143.js new file mode 100644 index 000000000..4d9c84a2f --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-143.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-143 +description: > + Object.defineProperties - 'writable' property of 'descObj' is own + data property that overrides an inherited accessor property + (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var proto = { value: 120 }; + + Object.defineProperty(proto, "writable", { + get: function () { + return true; + } + }); + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + + Object.defineProperty(descObj, "writable", { + value: false + }); + + Object.defineProperties(obj, { + property: descObj + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && obj.property === 120; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-144.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-144.js new file mode 100644 index 000000000..285610f21 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-144.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-144 +description: > + Object.defineProperties - 'writable' property of 'descObj' is own + accessor property (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var descObj = {}; + + Object.defineProperty(descObj, "writable", { + get: function () { + return false; + } + }); + + Object.defineProperties(obj, { + property: descObj + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-145.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-145.js new file mode 100644 index 000000000..4d8c8cd73 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-145.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-145 +description: > + Object.defineProperties - 'writable' property of 'descObj' is + inherited accessor property (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var proto = {}; + + Object.defineProperty(proto, "writable", { + get: function () { + return true; + } + }); + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + + Object.defineProperties(obj, { + property: descObj + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && obj.property === "isWritable"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-146.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-146.js new file mode 100644 index 000000000..abfba42d5 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-146.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-146 +description: > + Object.defineProperties - 'writable' property of 'descObj' is own + accessor property that overrides an inherited data property + (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var proto = { + writable: true + }; + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + + Object.defineProperty(descObj, "writable", { + get: function () { + return false; + } + }); + + Object.defineProperties(obj, { + property: descObj + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-147.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-147.js new file mode 100644 index 000000000..4db49aa11 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-147.js @@ -0,0 +1,46 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-147 +description: > + Object.defineProperties - 'writable' property of 'descObj' is own + accessor property that overrides an inherited accessor property + (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var proto = {}; + + Object.defineProperty(proto, "writable", { + get: function () { + return true; + } + }); + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + + Object.defineProperty(descObj, "writable", { + get: function () { + return false; + } + }); + + Object.defineProperties(obj, { + property: descObj + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-148.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-148.js new file mode 100644 index 000000000..72c5c9bda --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-148.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-148 +description: > + Object.defineProperties - 'writable' property of 'descObj' is own + accessor property without a get function (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var descObj = {}; + + Object.defineProperty(descObj, "writable", { + set: function () { } + }); + + Object.defineProperties(obj, { + property: descObj + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-149.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-149.js new file mode 100644 index 000000000..b984febec --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-149.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-149 +description: > + Object.defineProperties - 'writable' property of 'descObj' is own + accessor property without a get function that overrides an + inherited accessor property (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var proto = {}; + + Object.defineProperty(proto, "writable", { + get: function () { + return true; + } + }); + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + + Object.defineProperty(descObj, "writable", { + set: function () { } + }); + + Object.defineProperties(obj, { + property: descObj + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-15.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-15.js new file mode 100644 index 000000000..be87f59c3 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-15.js @@ -0,0 +1,47 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-15 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + own accessor property that overrides an inherited accessor + property (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var proto = {}; + var accessed = false; + Object.defineProperty(proto, "enumerable", { + get: function () { + return true; + } + }); + + var Con = function () { }; + Con.prototype = proto; + var descObj = new Con(); + + Object.defineProperty(descObj, "enumerable", { + get: function () { + return false; + } + }); + + Object.defineProperties(obj, { + prop: descObj + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-150.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-150.js new file mode 100644 index 000000000..283fe2c27 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-150.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-150 +description: > + Object.defineProperties - 'writable' property of 'descObj' is + inherited accessor property without a get function (8.10.5 step + 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var proto = {}; + + Object.defineProperty(proto, "writable", { + set: function () { } + }); + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + + Object.defineProperties(obj, { + property: descObj + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-151.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-151.js new file mode 100644 index 000000000..4efab8a00 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-151.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-151 +description: > + Object.defineProperties - 'descObj' is a Function object which + implements its own [[Get]] method to get 'writable' property + (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var func = function (a, b) { + return a + b; + }; + + func.writable = false; + + Object.defineProperties(obj, { + property: func + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-152.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-152.js new file mode 100644 index 000000000..512eda784 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-152.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-152 +description: > + Object.defineProperties - 'descObj' is an Array object which + implements its own [[Get]] method to get 'writable' property + (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var arr = [1, 2, 3]; + + arr.writable = false; + + Object.defineProperties(obj, { + property: arr + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-153.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-153.js new file mode 100644 index 000000000..a1e80ba2a --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-153.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-153 +description: > + Object.defineProperties - 'descObj' is a String object which + implements its own [[Get]] method to get 'writable' property + (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var str = new String("abc"); + + str.writable = false; + + Object.defineProperties(obj, { + property: str + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-154.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-154.js new file mode 100644 index 000000000..995f522e5 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-154.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-154 +description: > + Object.defineProperties - 'descObj' is a Boolean object which + implements its own [[Get]] method to get 'writable' property + (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var descObj = new Boolean(false); + + descObj.writable = false; + + Object.defineProperties(obj, { + property: descObj + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-155.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-155.js new file mode 100644 index 000000000..790b335ef --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-155.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-155 +description: > + Object.defineProperties - 'descObj' is a Number object which + implements its own [[Get]] method to get 'writable' property + (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var descObj = new Number(-9); + + descObj.writable = false; + + Object.defineProperties(obj, { + property: descObj + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-156.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-156.js new file mode 100644 index 000000000..33127f81a --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-156.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-156 +description: > + Object.defineProperties - 'descObj' is the Math object which + implements its own [[Get]] method to get 'writable' property + (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + try { + Math.writable = false; + + Object.defineProperties(obj, { + property: Math + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } finally { + delete Math.writable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-157.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-157.js new file mode 100644 index 000000000..a7bfc4745 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-157.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-157 +description: > + Object.defineProperties - 'descObj' is a Date object which + implements its own [[Get]] method to get 'writable' property + (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var descObj = new Date(); + + descObj.writable = false; + + Object.defineProperties(obj, { + property: descObj + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-158.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-158.js new file mode 100644 index 000000000..090aa0ff9 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-158.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-158 +description: > + Object.defineProperties - 'descObj' is a RegExp object which + implements its own [[Get]] method to get 'writable' property + (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var descObj = new RegExp(); + + descObj.writable = false; + + Object.defineProperties(obj, { + property: descObj + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-159.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-159.js new file mode 100644 index 000000000..75abd9a4b --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-159.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-159 +description: > + Object.defineProperties - 'descObj' is the JSON object which + implements its own [[Get]] method to get 'writable' property + (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + try { + JSON.writable = false; + + Object.defineProperties(obj, { + property: JSON + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } finally { + delete JSON.writable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-16.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-16.js new file mode 100644 index 000000000..dfa20d7c0 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-16.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-16 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + own accessor property without a get function (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + var descObj = {}; + + Object.defineProperty(descObj, "enumerable", { + set: function () { } + }); + + Object.defineProperties(obj, { + prop: descObj + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-160.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-160.js new file mode 100644 index 000000000..e1285a5f2 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-160.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-160 +description: > + Object.defineProperties - 'descObj' is an Error object which + implements its own [[Get]] method to get 'writable' property + (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var descObj = new Error(); + + descObj.writable = false; + + Object.defineProperties(obj, { + property: descObj + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-161.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-161.js new file mode 100644 index 000000000..506f36a79 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-161.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-161 +description: > + Object.defineProperties - 'descObj' is the Arguments object which + implements its own [[Get]] method to get 'writable' property + (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var func = function (a, b) { + arguments.writable = false; + + Object.defineProperties(obj, { + property: arguments + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + }; + + return func(); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-163.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-163.js new file mode 100644 index 000000000..d485dae30 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-163.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-163 +description: > + Object.defineProperties - 'descObj' is the global object which + implements its own [[Get]] method to get 'writable' property + (8.10.5 step 6.a) +includes: + - runTestCase.js + - fnGlobalObject.js +---*/ + +function testcase() { + + var obj = {}; + + try { + fnGlobalObject().writable = false; + + Object.defineProperties(obj, { + property: fnGlobalObject() + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } finally { + delete fnGlobalObject().writable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-164.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-164.js new file mode 100644 index 000000000..0ed8c7625 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-164.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-164 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is undefined (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: undefined + } + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-165.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-165.js new file mode 100644 index 000000000..93162ef63 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-165.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-165 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is null (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: null + } + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-166.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-166.js new file mode 100644 index 000000000..55243da22 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-166.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-166 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is true (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: true + } + }); + + obj.property = "isWritable"; + + return obj.property === "isWritable"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-167.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-167.js new file mode 100644 index 000000000..b4a58a8d8 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-167.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-167 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is false (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: false + } + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-168.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-168.js new file mode 100644 index 000000000..4cc9e32f7 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-168.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-168 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is 0 (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: 0 + } + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-169.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-169.js new file mode 100644 index 000000000..0642bd9fa --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-169.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-169 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is +0 (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: +0 + } + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-17.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-17.js new file mode 100644 index 000000000..9a5c60ecc --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-17.js @@ -0,0 +1,45 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-17 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + own accessor property without a get function that overrides an + inherited accessor property (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var proto = {}; + var accessed = false; + Object.defineProperty(proto, "enumerable", { + get: function () { + return false; + } + }); + + var Con = function () { }; + Con.prototype = proto; + var descObj = new Con(); + + Object.defineProperty(descObj, "enumerable", { + set: function () { } + }); + + Object.defineProperties(obj, { + prop: descObj + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-170.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-170.js new file mode 100644 index 000000000..06def7b7c --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-170.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-170 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is -0 (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: -0 + } + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-171.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-171.js new file mode 100644 index 000000000..ba567b9be --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-171.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-171 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is NaN (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: NaN + } + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-172.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-172.js new file mode 100644 index 000000000..829fc7bc4 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-172.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-172 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is positive number (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: 123 + } + }); + + obj.property = "isWritable"; + + return obj.property === "isWritable"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-173.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-173.js new file mode 100644 index 000000000..e4c4c14e9 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-173.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-173 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is negative number (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: -123 + } + }); + + obj.property = "isWritable"; + + return obj.property === "isWritable"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-174.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-174.js new file mode 100644 index 000000000..5dde2bfc0 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-174.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-174 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is empty string (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: "" + } + }); + + obj.property = "isWritable"; + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-175.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-175.js new file mode 100644 index 000000000..67078b285 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-175.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-175 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is non-empty string (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: "abc" + } + }); + + obj.property = "isWritable"; + + return obj.property === "isWritable"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-176.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-176.js new file mode 100644 index 000000000..11ef54510 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-176.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-176 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is Function object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: function () { } + } + }); + + obj.property = "isWritable"; + + return obj.property === "isWritable"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-177.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-177.js new file mode 100644 index 000000000..b50419e98 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-177.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-177 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is Array object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: [] + } + }); + + obj.property = "isWritable"; + + return obj.property === "isWritable"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-178.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-178.js new file mode 100644 index 000000000..34ea7c571 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-178.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-178 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is String object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: new String("abc") + } + }); + + obj.property = "isWritable"; + + return obj.property === "isWritable"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-179.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-179.js new file mode 100644 index 000000000..354200562 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-179.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-179 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is Boolean object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: new Boolean(true) + } + }); + + obj.property = "isWritable"; + + return obj.property === "isWritable"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-18.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-18.js new file mode 100644 index 000000000..8595a9f84 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-18.js @@ -0,0 +1,40 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-18 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + inherited accessor property without a get function (8.10.5 step + 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var proto = {}; + var accessed = false; + + Object.defineProperty(proto, "enumerable", { + set: function () { } + }); + + var Con = function () { }; + Con.prototype = proto; + var descObj = new Con(); + + Object.defineProperties(obj, { + prop: descObj + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-180.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-180.js new file mode 100644 index 000000000..3b5333921 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-180.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-180 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is Number object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: new Number(123) + } + }); + + obj.property = "isWritable"; + + return obj.property === "isWritable"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-181.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-181.js new file mode 100644 index 000000000..b41527f0a --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-181.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-181 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is the Math object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: Math + } + }); + + obj.property = "isWritable"; + + return obj.property === "isWritable"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-182.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-182.js new file mode 100644 index 000000000..e892fc717 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-182.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-182 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is Date object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: new Date() + } + }); + + obj.property = "isWritable"; + + return obj.property === "isWritable"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-183.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-183.js new file mode 100644 index 000000000..619b031cd --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-183.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-183 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is RegExp object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: new RegExp() + } + }); + + obj.property = "isWritable"; + + return obj.property === "isWritable"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-184.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-184.js new file mode 100644 index 000000000..6448bcc9c --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-184.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-184 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is the JSON object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: JSON + } + }); + + obj.property = "isWritable"; + + return obj.property === "isWritable"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-185.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-185.js new file mode 100644 index 000000000..1f2a649ef --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-185.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-185 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is Error object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: new SyntaxError() + } + }); + + obj.property = "isWritable"; + + return obj.property === "isWritable"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-186.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-186.js new file mode 100644 index 000000000..fda13b1bb --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-186.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-186 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is the Argument object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var func = function (a, b, c) { + return arguments; + }; + + Object.defineProperties(obj, { + property: { + writable: func(1, true, "a") + } + }); + + obj.property = "isWritable"; + + return obj.property === "isWritable"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-188.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-188.js new file mode 100644 index 000000000..e7e444b0f --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-188.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-188 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is the global object (8.10.5 step 6.b) +includes: + - runTestCase.js + - fnGlobalObject.js +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: fnGlobalObject() + } + }); + + obj.property = "isWritable"; + + return obj.property === "isWritable"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-189.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-189.js new file mode 100644 index 000000000..545ac80c5 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-189.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-189 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is a string (value is 'false') which is treated as true + value (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: "false" + } + }); + + obj.property = "isWritable"; + + return obj.property === "isWritable"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-19.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-19.js new file mode 100644 index 000000000..ec4d725ab --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-19.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-19 +description: > + Object.defineProperties - 'descObj' is a Function object which + implements its own [[Get]] method to get 'enumerable' property + (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var descObj = function () { }; + var accessed = false; + + descObj.enumerable = true; + + Object.defineProperties(obj, { + prop: descObj + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-190.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-190.js new file mode 100644 index 000000000..4b17ccc28 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-190.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-190 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is new Boolean(false) which is treated as true value + (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + writable: new Boolean(false) + } + }); + + obj.property = "isWritable"; + + return obj.property === "isWritable"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-191.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-191.js new file mode 100644 index 000000000..4b6a36ca3 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-191.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-191 +description: > + Object.defineProperties - 'get' property of 'descObj' is present + (8.10.5 step 7) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getter = function () { + return "present"; + }; + + Object.defineProperties(obj, { + property: { + get: getter + } + }); + + return obj.property === "present"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-192.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-192.js new file mode 100644 index 000000000..50c7a4d7b --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-192.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-192 +description: > + Object.defineProperties - 'get' property of 'descObj' is not + present (8.10.5 step 7) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var setter = function () { }; + + Object.defineProperties(obj, { + property: { + set: setter + } + }); + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-193.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-193.js new file mode 100644 index 000000000..3b0dd89bd --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-193.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-193 +description: > + Object.defineProperties - 'get' property of 'descObj' is own data + property (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getter = function () { + return "ownDataProperty"; + }; + + Object.defineProperties(obj, { + property: { + get: getter + } + }); + + return obj.property === "ownDataProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-194.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-194.js new file mode 100644 index 000000000..71384eb52 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-194.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-194 +description: > + Object.defineProperties - 'get' property of 'descObj' is inherited + data property (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getter = function () { + return "inheritedDataProperty"; + }; + + var proto = { + get: getter + }; + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.property === "inheritedDataProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-195.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-195.js new file mode 100644 index 000000000..38dc407e4 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-195.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-195 +description: > + Object.defineProperties - 'get' property of 'descObj' is own data + property that overrides an inherited data property (8.10.5 step + 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getter = function () { + return "inheritedDataProperty"; + }; + + var proto = { + get: getter + }; + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + + descObj.get = function () { + return "ownDataProperty"; + }; + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.property === "ownDataProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-196.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-196.js new file mode 100644 index 000000000..75d5d6152 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-196.js @@ -0,0 +1,46 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-196 +description: > + Object.defineProperties - 'get' property of 'descObj' is own data + property that overrides an inherited accessor property (8.10.5 + step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var proto = {}; + + Object.defineProperty(proto, "get", { + get: function () { + return function () { + return "inheritedAccessorProperty"; + }; + } + }); + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + + Object.defineProperty(descObj, "get", { + value: function () { + return "ownDataProperty"; + } + }); + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.property === "ownDataProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-197.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-197.js new file mode 100644 index 000000000..6532a3430 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-197.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-197 +description: > + Object.defineProperties - 'get' property of 'descObj' is own + accessor property (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var descObj = {}; + + Object.defineProperty(descObj, "get", { + get: function () { + return function () { + return "ownAccessorProperty"; + }; + } + }); + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.property === "ownAccessorProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-198.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-198.js new file mode 100644 index 000000000..a7decfdcd --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-198.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-198 +description: > + Object.defineProperties - 'get' property of 'descObj' is inherited + accessor property (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var proto = {}; + + Object.defineProperty(proto, "get", { + get: function () { + return function () { + return "inheritedAccessorProperty"; + }; + } + }); + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.property === "inheritedAccessorProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-199.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-199.js new file mode 100644 index 000000000..cfe54839f --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-199.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-199 +description: > + Object.defineProperties - 'get' property of 'descObj' is own + accessor property that overrides an inherited data property + (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var proto = { + get: function () { + return "inheritedDataProperty"; + } + }; + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + + Object.defineProperty(descObj, "get", { + get: function () { + return function () { + return "ownAccessorProperty"; + }; + } + }); + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.property === "ownAccessorProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-2.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-2.js new file mode 100644 index 000000000..db68a590e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-2.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-2 +description: Object.defineProperties - 'descObj' is null (8.10.5 step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + try { + Object.defineProperties(obj, { + prop: null + }); + return false; + } catch (e) { + return e instanceof TypeError && !obj.hasOwnProperty("prop"); ; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-20.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-20.js new file mode 100644 index 000000000..369365440 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-20.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-20 +description: > + Object.defineProperties - 'descObj' is an Array object which + implements its own [[Get]] method to get 'enumerable' property + (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + var descObj = []; + + descObj.enumerable = true; + + Object.defineProperties(obj, { + prop: descObj + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-200.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-200.js new file mode 100644 index 000000000..1bb5b3ce1 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-200.js @@ -0,0 +1,48 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-200 +description: > + Object.defineProperties - 'get' property of 'descObj' is own + accessor property that overrides an inherited accessor property + (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var proto = {}; + + Object.defineProperty(proto, "get", { + get: function () { + return function () { + return "inheritedAccessorProperty"; + }; + } + }); + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + + Object.defineProperty(descObj, "get", { + get: function () { + return function () { + return "ownAccessorProperty"; + }; + } + }); + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.property === "ownAccessorProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-201.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-201.js new file mode 100644 index 000000000..8c65185fb --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-201.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-201 +description: > + Object.defineProperties - 'get' property of 'descObj' is own + accessor property without a get function (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var descObj = {}; + + Object.defineProperty(descObj, "get", { + set: function () { } + }); + + Object.defineProperties(obj, { + property: descObj + }); + + return typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-202.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-202.js new file mode 100644 index 000000000..fcff86822 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-202.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-202 +description: > + Object.defineProperties - 'get' property of 'descObj' is own + accessor property without a get function that overrides an + inherited accessor property (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var proto = {}; + + Object.defineProperty(proto, "get", { + get: function () { + return function () { + return "inheritedAccessorProperty"; + }; + } + }); + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + + Object.defineProperty(descObj, "get", { + set: function () { } + }); + + Object.defineProperties(obj, { + property: descObj + }); + + return typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-203.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-203.js new file mode 100644 index 000000000..9087239e9 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-203.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-203 +description: > + Object.defineProperties - 'get' property of 'descObj' is inherited + accessor property without a get function (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var proto = {}; + + Object.defineProperty(proto, "get", { + set: function () { } + }); + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + + Object.defineProperties(obj, { + property: descObj + }); + + return typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-204.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-204.js new file mode 100644 index 000000000..d630fbd2d --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-204.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-204 +description: > + Object.defineProperties - 'descObj' is a Function object which + implements its own [[Get]] method to get 'get' property (8.10.5 + step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var func = function (a, b) { + return a + b; + }; + + func.get = function () { + return "Function"; + }; + + Object.defineProperties(obj, { + property: func + }); + + return obj.property === "Function"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-205.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-205.js new file mode 100644 index 000000000..4987732f0 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-205.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-205 +description: > + Object.defineProperties - 'descObj' is an Array object which + implements its own [[Get]] method to get 'get' property (8.10.5 + step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var arr = []; + + arr.get = function () { + return "Array"; + }; + + Object.defineProperties(obj, { + property: arr + }); + + return obj.property === "Array"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-206.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-206.js new file mode 100644 index 000000000..282dcb169 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-206.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-206 +description: > + Object.defineProperties - 'descObj' is a String object which + implements its own [[Get]] method to get 'get' property (8.10.5 + step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var str = new String("abc"); + + str.get = function () { + return "string Object"; + }; + + Object.defineProperties(obj, { + property: str + }); + + return obj.property === "string Object"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-207.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-207.js new file mode 100644 index 000000000..2fb34238b --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-207.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-207 +description: > + Object.defineProperties - 'descObj' is a Boolean object which + implements its own [[Get]] method to get 'get' property (8.10.5 + step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var descObj = new Boolean(false); + + descObj.get = function () { + return "Boolean"; + }; + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.property === "Boolean"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-208.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-208.js new file mode 100644 index 000000000..06c5c7791 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-208.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-208 +description: > + Object.defineProperties - 'descObj' is a Number object which + implements its own [[Get]] method to get 'get' property (8.10.5 + step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var descObj = new Number(-9); + + descObj.get = function () { + return "Number"; + }; + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.property === "Number"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-209.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-209.js new file mode 100644 index 000000000..8d2115fb4 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-209.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-209 +description: > + Object.defineProperties - 'descObj' is the Math object which + implements its own [[Get]] method to get 'get' property (8.10.5 + step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + try { + Math.get = function () { + return "Math"; + }; + + Object.defineProperties(obj, { + property: Math + }); + + return obj.property === "Math"; + } finally { + delete Math.get; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-21.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-21.js new file mode 100644 index 000000000..c1ebdb36e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-21.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-21 +description: > + Object.defineProperties - 'descObj' is a String object which + implements its own [[Get]] method to get 'enumerable' property + (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var descObj = new String(); + var accessed = false; + descObj.enumerable = true; + + Object.defineProperties(obj, { + prop: descObj + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-210.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-210.js new file mode 100644 index 000000000..f212a9840 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-210.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-210 +description: > + Object.defineProperties - 'descObj' is a Date object which + implements its own [[Get]] method to get 'get' property (8.10.5 + step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var descObj = new Date(); + + descObj.get = function () { + return "Date"; + }; + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.property === "Date"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-211.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-211.js new file mode 100644 index 000000000..877b4f038 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-211.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-211 +description: > + Object.defineProperties - 'descObj' is a RegExp object which + implements its own [[Get]] method to get 'get' property (8.10.5 + step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var descObj = new RegExp(); + + descObj.get = function () { + return "RegExp"; + }; + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.property === "RegExp"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-212.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-212.js new file mode 100644 index 000000000..fb097bd07 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-212.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-212 +description: > + Object.defineProperties - 'descObj' is the JSON object which + implements its own [[Get]] method to get 'get' property (8.10.5 + step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + try { + JSON.get = function () { + return "JSON"; + }; + + Object.defineProperties(obj, { + property: JSON + }); + + return obj.property === "JSON"; + } finally { + delete JSON.get; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-213.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-213.js new file mode 100644 index 000000000..fdd80e52a --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-213.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-213 +description: > + Object.defineProperties - 'descObj' is an Error object which + implements its own [[Get]] method to get 'get' property (8.10.5 + step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var descObj = new Error(); + + descObj.get = function () { + return "Error"; + }; + + Object.defineProperties(obj, { + property: descObj + }); + + return obj.property === "Error"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-214.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-214.js new file mode 100644 index 000000000..a40095525 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-214.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-214 +description: > + Object.defineProperties - 'descObj' is the Arguments object which + implements its own [[Get]] method to get 'get' property (8.10.5 + step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var func = function (a, b) { + arguments.get = function () { + return "arguments"; + }; + + Object.defineProperties(obj, { + property: arguments + }); + + return obj.property === "arguments"; + }; + + return func(); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-216.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-216.js new file mode 100644 index 000000000..e86df67ef --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-216.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-216 +description: > + Object.defineProperties - 'descObj' is the global object which + implements its own [[Get]] method to get 'get' property (8.10.5 + step 7.a) +includes: + - runTestCase.js + - fnGlobalObject.js +---*/ + +function testcase() { + + var obj = {}; + + try { + fnGlobalObject().get = function () { + return "global"; + }; + + Object.defineProperties(obj, { + property: fnGlobalObject() + }); + + return obj.property === "global"; + } finally { + delete fnGlobalObject().get; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-217.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-217.js new file mode 100644 index 000000000..273ee94c3 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-217.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-217 +description: > + Object.defineProperties - value of 'get' property of 'descObj' is + undefined (8.10.5 step 7.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + get: undefined + } + }); + + return obj.hasOwnProperty("property") && typeof obj.property === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-218.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-218.js new file mode 100644 index 000000000..b60524642 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-218.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-218 +description: > + Object.defineProperties - value of 'get' property of 'descObj' is + primitive values( value is null) (8.10.5 step 7.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + Object.defineProperties(obj, { + property: { + get: null + } + }); + + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-219.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-219.js new file mode 100644 index 000000000..7db948cb7 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-219.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-219 +description: > + Object.defineProperties - value of 'get' property of 'descObj' is + primitive values( value is boolean) (8.10.5 step 7.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + Object.defineProperties(obj, { + property: { + get: false + } + }); + + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-22.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-22.js new file mode 100644 index 000000000..dbf3e0122 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-22.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-22 +description: > + Object.defineProperties - 'descObj' is a Boolean object which + implements its own [[Get]] method to get 'enumerable' property + (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var descObj = new Boolean(false); + var accessed = false; + + descObj.enumerable = true; + + Object.defineProperties(obj, { + prop: descObj + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-220.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-220.js new file mode 100644 index 000000000..3e933c065 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-220.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-220 +description: > + Object.defineProperties - value of 'get' property of 'descObj' is + primitive values( value is number) (8.10.5 step 7.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + Object.defineProperties(obj, { + property: { + get: 123 + } + }); + + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-221.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-221.js new file mode 100644 index 000000000..87547ac12 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-221.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-221 +description: > + Object.defineProperties - value of 'get' property of 'descObj' is + primitive values( value is string) (8.10.5 step 7.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + Object.defineProperties(obj, { + property: { + get: "string" + } + }); + + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-222.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-222.js new file mode 100644 index 000000000..b71da68bc --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-222.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-222 +description: > + Object.defineProperties - value of 'get' property of 'descObj' is + applied to Array object (8.10.5 step 7.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + Object.defineProperties(obj, { + property: { + get: [] + } + }); + + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-223.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-223.js new file mode 100644 index 000000000..1e7f90454 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-223.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-223 +description: > + Object.defineProperties - value of 'get' property of 'descObj' is + a function (8.10.5 step 7.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getter = function () { + return 100; + }; + + Object.defineProperties(obj, { + property: { + get: getter + } + }); + + return obj.property === 100; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-226.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-226.js new file mode 100644 index 000000000..b6eeb92aa --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-226.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-226 +description: > + Object.defineProperties - 'set' property of 'descObj' is present + (8.10.5 step 8) +includes: [runTestCase.js] +---*/ + +function testcase() { + var data = "data"; + var obj = {}; + + Object.defineProperties(obj, { + "prop": { + set: function (value) { + data = value; + } + } + }); + + obj.prop = "overrideData"; + + return obj.hasOwnProperty("prop") && data === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-227.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-227.js new file mode 100644 index 000000000..f8a0874bc --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-227.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-227 +description: > + Object.defineProperties - 'set' property of 'descObj' is not + present (8.10.5 step 8) +includes: [runTestCase.js] +---*/ + +function testcase() { + var data = "data"; + var obj = {}; + + try { + Object.defineProperties(obj, { + descObj: { + get: function () { + return data; + } + } + }); + + + obj.descObj = "overrideData"; + + var desc = Object.getOwnPropertyDescriptor(obj, "descObj"); + return obj.hasOwnProperty("descObj") && typeof (desc.set) === "undefined" && data === "data"; + } catch (e) { + return false; + } + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-228.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-228.js new file mode 100644 index 000000000..33f0af8a8 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-228.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-228 +description: > + Object.defineProperties - 'set' property of 'descObj' is own data + property (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var data = "data"; + var obj = {}; + + Object.defineProperties(obj, { + descObj: { + set: function (value) { + data = value; + } + } + }); + + obj.descObj = "overrideData"; + + return obj.hasOwnProperty("descObj") && data === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-229.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-229.js new file mode 100644 index 000000000..ad1c3c5b5 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-229.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-229 +description: > + Object.defineProperties - 'set' property of 'descObj' is inherited + data property (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var data = "data"; + var proto = { + set: function (value) { + data = value; + } + }; + + var Con = function () { }; + Con.prototype = proto; + + var child = new Con(); + var obj = {}; + + Object.defineProperties(obj, { + prop: child + }); + + obj.prop = "overrideData"; + + return obj.hasOwnProperty("prop") && data === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-23.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-23.js new file mode 100644 index 000000000..91c78ed86 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-23.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-23 +description: > + Object.defineProperties - 'descObj' is a Number object which + implements its own [[Get]] method to get 'enumerable' property + (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var descObj = new Number(-9); + var accessed = false; + + descObj.enumerable = true; + + Object.defineProperties(obj, { + prop: descObj + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-230.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-230.js new file mode 100644 index 000000000..3fb18bed7 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-230.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-230 +description: > + Object.defineProperties - 'set' property of 'descObj' is own data + property that overrides an inherited data property (8.10.5 step + 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var data1 = "data"; + var data2 = "data"; + var proto = { + set: function (value) { + data2 = value; + } + }; + + var Con = function () { }; + Con.prototype = proto; + + var child = new Con(); + child.set = function (value) { + data1 = value; + }; + + var obj = {}; + + Object.defineProperties(obj, { + prop: child + }); + + obj.prop = "overrideData"; + + return obj.hasOwnProperty("prop") && data1 === "overrideData" && data2 === "data"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-231.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-231.js new file mode 100644 index 000000000..d6d5001cd --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-231.js @@ -0,0 +1,50 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-231 +description: > + Object.defineProperties - 'set' property of 'descObj' is own data + property that overrides an inherited accessor property (8.10.5 + step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var data1 = "data"; + var data2 = "data"; + var fun = function (value) { + data2 = value; + }; + var proto = {}; + Object.defineProperty(proto, "set", { + get: function () { + return fun; + }, + set: function (value) { + fun = value; + } + }); + + var Con = function () { }; + Con.prototype = proto; + + var child = new Con(); + child.set = function (value) { + data1 = value; + }; + + var obj = {}; + + Object.defineProperties(obj, { + prop: child + }); + + obj.prop = "overrideData"; + + return obj.hasOwnProperty("prop") && data1 === "overrideData" && data2 === "data"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-232.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-232.js new file mode 100644 index 000000000..59bbaf06a --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-232.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-232 +description: > + Object.defineProperties - 'set' property of 'descObj' is own + accessor property (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var data = "data"; + var setFun = function (value) { + data = value; + }; + var descObj = {}; + Object.defineProperty(descObj, "set", { + get: function () { + return setFun; + } + }); + + var obj = {}; + + Object.defineProperties(obj, { + prop: descObj + }); + + obj.prop = "overrideData"; + + return obj.hasOwnProperty("prop") && data === "overrideData"; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-233.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-233.js new file mode 100644 index 000000000..a146b6e1a --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-233.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-233 +description: > + Object.defineProperties - 'set' property of 'descObj' is inherited + accessor property (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var data = "data"; + var setFun = function (value) { + data = value; + }; + var proto = {}; + Object.defineProperty(proto, "set", { + get: function () { + return setFun; + } + }); + + var Con = function () { }; + Con.prototype = proto; + + var child = new Con(); + var obj = {}; + + Object.defineProperties(obj, { + prop: child + }); + obj.prop = "overrideData"; + + return obj.hasOwnProperty("prop") && data === "overrideData"; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-234.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-234.js new file mode 100644 index 000000000..c9da8b4b4 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-234.js @@ -0,0 +1,47 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-234 +description: > + Object.defineProperties - 'set' property of 'descObj' is own + accessor property that overrides an inherited data property + (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var data1 = "data"; + var data2 = "data"; + + var proto = {}; + proto.set = function (value) { + data1 = value; + }; + + var Con = function () { }; + Con.prototype = proto; + + var child = new Con(); + Object.defineProperty(child, "set", { + get: function () { + return function (value) { + data2 = value; + }; + } + }); + + var obj = {}; + + Object.defineProperties(obj, { + prop: child + }); + obj.prop = "overrideData"; + + return obj.hasOwnProperty("prop") && data2 === "overrideData" && data1 === "data"; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-235.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-235.js new file mode 100644 index 000000000..7a4358aad --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-235.js @@ -0,0 +1,51 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-235 +description: > + Object.defineProperties - 'set' property of 'descObj' is own + accessor property that overrides an inherited accessor property + (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var data1 = "data"; + var data2 = "data"; + + var proto = {}; + Object.defineProperty(proto, "set", { + get: function () { + return function (value) { + data1 = value; + }; + } + }); + + var Con = function () { }; + Con.prototype = proto; + + var child = new Con(); + Object.defineProperty(child, "set", { + get: function () { + return function (value) { + data2 = value; + }; + } + }); + + var obj = {}; + + Object.defineProperties(obj, { + prop: child + }); + + obj.prop = "overrideData"; + + return obj.hasOwnProperty("prop") && data2 === "overrideData" && data1 === "data"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-236.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-236.js new file mode 100644 index 000000000..ffb1a7868 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-236.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-236 +description: > + Object.defineProperties - 'set' property of 'descObj' is own + accessor property without a get function (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var fun = function () { + return 10; + }; + var descObj = { + get: fun + }; + Object.defineProperty(descObj, "set", { + set: function () { } + }); + + var obj = {}; + + Object.defineProperties(obj, { + prop: descObj + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.hasOwnProperty("prop") && typeof desc.set === "undefined" && obj.prop === 10; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-237.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-237.js new file mode 100644 index 000000000..7957d29b5 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-237.js @@ -0,0 +1,50 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-237 +description: > + Object.defineProperties - 'set' property of 'descObj' is own + accessor property without a get function that overrides an + inherited accessor property (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var fun = function () { + return 10; + }; + var proto = {}; + Object.defineProperty(proto, "set", { + get: function () { + return function () { + return arguments; + }; + } + }); + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + Object.defineProperty(descObj, "set", { + set: function () { } + }); + + descObj.get = fun; + + var obj = {}; + + Object.defineProperties(obj, { + prop: descObj + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.hasOwnProperty("prop") && typeof (desc.set) === "undefined" && obj.prop === 10; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-238.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-238.js new file mode 100644 index 000000000..7f2df0692 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-238.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-238 +description: > + Object.defineProperties - 'set' property of 'descObj' is inherited + accessor property without a get function (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var fun = function () { + return 10; + }; + var proto = {}; + Object.defineProperty(proto, "set", { + set: function () { } + }); + + var Con = function () { }; + Con.prototype = proto; + + var descObj = new Con(); + descObj.get = fun; + + var obj = {}; + + Object.defineProperties(obj, { + prop: descObj + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.hasOwnProperty("prop") && typeof (desc.set) === "undefined" && obj.prop === 10; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-239.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-239.js new file mode 100644 index 000000000..eeff8198e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-239.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-239 +description: > + Object.defineProperties - 'descObj' is a Function object which + implements its own [[Get]] method to get 'set' property (8.10.5 + step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var data = "data"; + var descFun = function () { }; + var setFun = function (value) { + data = value; + }; + + descFun.prop = { + set: setFun + }; + + var obj = {}; + Object.defineProperties(obj, descFun); + obj.prop = "funData"; + return obj.hasOwnProperty("prop") && data === "funData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-24.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-24.js new file mode 100644 index 000000000..fa7ece60c --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-24.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-24 +description: > + Object.defineProperties - 'descObj' is the Math object which + implements its own [[Get]] method to get 'enumerable' property + (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + try { + Math.enumerable = true; + + Object.defineProperties(obj, { + prop: Math + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } finally { + delete Math.enumerable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-240.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-240.js new file mode 100644 index 000000000..3f73286ef --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-240.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-240 +description: > + Object.defineProperties - 'descObj' is an Array object which + implements its own [[Get]] method to get 'set' property (8.10.5 + step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var data = "data"; + var arr = []; + var setFun = function (value) { + data = value; + }; + arr.prop = { + set: setFun + }; + + var obj = {}; + Object.defineProperties(obj, arr); + obj.prop = "arrData"; + return obj.hasOwnProperty("prop") && data === "arrData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-241.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-241.js new file mode 100644 index 000000000..f99e8ebd4 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-241.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-241 +description: > + Object.defineProperties - 'descObj' is a String object which + implements its own [[Get]] method to get 'set' property (8.10.5 + step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var data = "data"; + var descStr = new String(); + var setFun = function (value) { + data = value; + }; + + descStr.prop = { + set: setFun + }; + + var obj = {}; + Object.defineProperties(obj, descStr); + obj.prop = "strData"; + return obj.hasOwnProperty("prop") && data === "strData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-242.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-242.js new file mode 100644 index 000000000..03e9806ab --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-242.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-242 +description: > + Object.defineProperties - 'descObj' is a Boolean object which + implements its own [[Get]] method to get 'set' property (8.10.5 + step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var data = "data"; + var descObj = new Boolean(false); + var setFun = function (value) { + data = value; + }; + descObj.prop = { + set: setFun + }; + + var obj = {}; + Object.defineProperties(obj, descObj); + obj.prop = "booleanData"; + return obj.hasOwnProperty("prop") && data === "booleanData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-243.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-243.js new file mode 100644 index 000000000..fe8c066ec --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-243.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-243 +description: > + Object.defineProperties - 'descObj' is a Number object which + implements its own [[Get]] method to get 'set' property (8.10.5 + step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var data = "data"; + var descObj = new Number(-9); + var setFun = function (value) { + data = value; + }; + descObj.prop = { + set: setFun + }; + + var obj = {}; + Object.defineProperties(obj, descObj); + obj.prop = "numberData"; + return obj.hasOwnProperty("prop") && data === "numberData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-244.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-244.js new file mode 100644 index 000000000..b50923992 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-244.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-244 +description: > + Object.defineProperties - 'descObj' is the Math object which + implements its own [[Get]] method to get 'set' property (8.10.5 + step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var data = "data"; + var setFun = function (value) { + data = value; + }; + try { + Math.prop = { + set: setFun + }; + + var obj = {}; + Object.defineProperties(obj, Math); + obj.prop = "mathData"; + return obj.hasOwnProperty("prop") && data === "mathData"; + } finally { + delete Math.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-245.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-245.js new file mode 100644 index 000000000..875ed6f60 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-245.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-245 +description: > + Object.defineProperties - 'descObj' is a Date object which + implements its own [[Get]] method to get 'set' property (8.10.5 + step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var data = "data"; + var descObj = new Date(); + var setFun = function (value) { + data = value; + }; + descObj.prop = { + set: setFun + }; + + var obj = {}; + Object.defineProperties(obj, descObj); + obj.prop = "dateData"; + return obj.hasOwnProperty("prop") && data === "dateData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-246.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-246.js new file mode 100644 index 000000000..4dc8e6bc8 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-246.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-246 +description: > + Object.defineProperties - 'descObj' is a RegExp object which + implements its own [[Get]] method to get 'set' property (8.10.5 + step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var data = "data"; + var descObj = new RegExp(); + var setFun = function (value) { + data = value; + }; + descObj.prop = { + set: setFun + }; + + var obj = {}; + Object.defineProperties(obj, descObj); + obj.prop = "regExpData"; + return obj.hasOwnProperty("prop") && data === "regExpData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-247.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-247.js new file mode 100644 index 000000000..28bfc6d02 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-247.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-247 +description: > + Object.defineProperties - 'descObj' is the JSON object which + implements its own [[Get]] method to get 'set' property (8.10.5 + step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var data = "data"; + var setFun = function (value) { + data = value; + }; + try { + JSON.prop = { + set: setFun + }; + + var obj = {}; + Object.defineProperties(obj, JSON); + obj.prop = "JSONData"; + return obj.hasOwnProperty("prop") && data === "JSONData"; + } finally { + delete JSON.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-248.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-248.js new file mode 100644 index 000000000..931e0f791 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-248.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-248 +description: > + Object.defineProperties - 'descObj' is an Error object which + implements its own [[Get]] method to get 'set' property (8.10.5 + step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var data = "data"; + var descObj = new Error("test"); + descObj.description = { value: 11 }; + descObj.message = { value: 11 }; + descObj.name = { value: 11 }; + + var setFun = function (value) { + data = value; + }; + descObj.prop = { + set: setFun + }; + + var obj = {}; + Object.defineProperties(obj, descObj); + obj.prop = "errorData"; + return obj.hasOwnProperty("prop") && data === "errorData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-249.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-249.js new file mode 100644 index 000000000..c3dd05b7d --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-249.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-249 +description: > + Object.defineProperties - 'descObj' is the Arguments object which + implements its own [[Get]] method to get 'set' property (8.10.5 + step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var data = "data"; + var fun = function () { + return arguments; + }; + var arg = fun(); + var setFun = function (value) { + data = value; + }; + + arg.prop = { + set: setFun + }; + + var obj = {}; + Object.defineProperties(obj, arg); + obj.prop = "argData"; + return obj.hasOwnProperty("prop") && data === "argData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-25.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-25.js new file mode 100644 index 000000000..7ed515053 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-25.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-25 +description: > + Object.defineProperties - 'descObj' is a Date object which + implements its own [[Get]] method to get 'enumerable' property + (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var descObj = new Date(); + var accessed = false; + + descObj.enumerable = true; + + Object.defineProperties(obj, { + prop: descObj + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-252.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-252.js new file mode 100644 index 000000000..6f6c54047 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-252.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-252 +description: > + Object.defineProperties - value of 'set' property of 'descObj' is + undefined (8.10.5 step 8.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var getFun = function () { + return 11; + }; + + var obj = {}; + Object.defineProperties(obj, { + prop: { + get: getFun, + set: undefined + } + }); + + try { + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + return obj.hasOwnProperty("prop") && typeof (desc.set) === "undefined"; + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-253.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-253.js new file mode 100644 index 000000000..fa598591e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-253.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-253 +description: > + Object.defineProperties - value of 'set' property of 'descObj' is + primitive values null (8.10.5 step 8.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + try { + Object.defineProperties(obj, { + prop: { + set: null + } + }); + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-254.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-254.js new file mode 100644 index 000000000..d763e69e3 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-254.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-254 +description: > + Object.defineProperties - value of 'set' property of 'descObj' is + primitive values boolean (8.10.5 step 8.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + try { + Object.defineProperties(obj, { + prop: { + set: true + } + }); + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-255.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-255.js new file mode 100644 index 000000000..7009df2ce --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-255.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-255 +description: > + Object.defineProperties - value of 'set' property of 'descObj' is + primitive values number (8.10.5 step 8.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + try { + Object.defineProperties(obj, { + prop: { + set: 100 + } + }); + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-256.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-256.js new file mode 100644 index 000000000..26aa12435 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-256.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-256 +description: > + Object.defineProperties - value of 'set' property of 'descObj' is + primitive values string (8.10.5 step 8.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + try { + Object.defineProperties(obj, { + prop: { + set: "abcdef" + } + }); + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-257.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-257.js new file mode 100644 index 000000000..5c04838db --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-257.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-257 +description: > + Object.defineProperties - value of 'set' property of 'descObj' is + an interesting object other than a function (8.10.5 step 8.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + try { + Object.defineProperties(obj, { + prop: { + set: [] + } + }); + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-258.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-258.js new file mode 100644 index 000000000..3348ea4a3 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-258.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-258 +description: > + Object.defineProperties - value of 'set' property of 'descObj' is + a function (8.10.5 step 8.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var data = "data"; + var setFun = function (value) { + data = value; + }; + var obj = {}; + + + Object.defineProperties(obj, { + prop: { + set: setFun + } + }); + obj.prop = "funData"; + return obj.hasOwnProperty("prop") && data === "funData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-26.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-26.js new file mode 100644 index 000000000..6dc192047 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-26.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-26 +description: > + Object.defineProperties - 'descObj' is a RegExp object which + implements its own [[Get]] method to get 'enumerable' property + (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var descObj = new RegExp(); + var accessed = false; + + descObj.enumerable = true; + + Object.defineProperties(obj, { + prop: descObj + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-261.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-261.js new file mode 100644 index 000000000..d7e9e129f --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-261.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-261 +description: > + Object.defineProperties - TypeError is thrown if both 'set' + property and 'value' property of 'descObj' are present (8.10.5 + step 9.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var setFun = function () {}; + var obj = {}; + + try { + Object.defineProperties(obj, { + prop: { + value: 12, + set: setFun + } + }); + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-262.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-262.js new file mode 100644 index 000000000..78ce75134 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-262.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-262 +description: > + Object.defineProperties - TypeError is thrown if both 'set' + property and 'writable' property of 'descObj' are present (8.10.5 + step 9.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var setFun = function () { }; + var obj = {}; + + try { + Object.defineProperties(obj, { + prop: { + writable: true, + set: setFun + } + }); + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-263.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-263.js new file mode 100644 index 000000000..ba3fcc54a --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-263.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-263 +description: > + Object.defineProperties - TypeError is thrown if both 'get' + property and 'value' property of 'descObj' are present (8.10.5 + step 9.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var getFun = function () {}; + var obj = {}; + + try { + Object.defineProperties(obj, { + prop: { + value: 12, + get: getFun + } + }); + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-264.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-264.js new file mode 100644 index 000000000..3382065d1 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-264.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-264 +description: > + Object.defineProperties - TypeError is thrown if both 'get' + property and 'writable' property of 'descObj' are present (8.10.5 + step 9.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var getFun = function () {}; + + var obj = {}; + + try { + Object.defineProperties(obj, { + "prop": { + writable: true, + get: getFun + } + }); + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-27.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-27.js new file mode 100644 index 000000000..2a7a3361f --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-27.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-27 +description: > + Object.defineProperties - 'descObj' is the JSON object which + implements its own [[Get]] method to get 'enumerable' property + (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + try { + JSON.enumerable = true; + + Object.defineProperties(obj, { + prop: JSON + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } finally { + delete JSON.enumerable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-28.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-28.js new file mode 100644 index 000000000..53a54f2bf --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-28.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-28 +description: > + Object.defineProperties - 'descObj' is an Error object which + implements its own [[Get]] method to get 'enumerable' property + (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var descObj = new Error(); + var accessed = false; + + descObj.enumerable = true; + + Object.defineProperties(obj, { + prop: descObj + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-29.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-29.js new file mode 100644 index 000000000..f893bfd17 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-29.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-29 +description: > + Object.defineProperties - 'descObj' is the Arguments object which + implements its own [[Get]] method to get 'enumerable' property + (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var arg; + var accessed = false; + + (function fun() { + arg = arguments; + }()); + + arg.enumerable = true; + + Object.defineProperties(obj, { + prop: arg + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-3.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-3.js new file mode 100644 index 000000000..a1f17f62e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-3.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-3 +description: Object.defineProperties - 'descObj' is a boolean (8.10.5 step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + try { + Object.defineProperties(obj, { + prop: true + }); + return false; + } catch (e) { + return e instanceof TypeError && !obj.hasOwnProperty("prop"); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-31.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-31.js new file mode 100644 index 000000000..3b840872e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-31.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-31 +description: > + Object.defineProperties - 'descObj' is the global object which + implements its own [[Get]] method to get 'enumerable' property + (8.10.5 step 3.a) +includes: + - runTestCase.js + - fnGlobalObject.js +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + try { + fnGlobalObject().enumerable = true; + + Object.defineProperties(obj, { + prop: fnGlobalObject() + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } finally { + delete fnGlobalObject().enumerable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-32.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-32.js new file mode 100644 index 000000000..65429acfc --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-32.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-32 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is undefined (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: undefined + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-33.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-33.js new file mode 100644 index 000000000..1c0b9bf98 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-33.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-33 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is null (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: null + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-34.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-34.js new file mode 100644 index 000000000..87e2bac68 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-34.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-34 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is true (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: true + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-35.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-35.js new file mode 100644 index 000000000..bba3e0e7c --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-35.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-35 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is false (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: false + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-36.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-36.js new file mode 100644 index 000000000..f38d7a2b5 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-36.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-36 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is 0 (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: 0 + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-37.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-37.js new file mode 100644 index 000000000..7d8705a63 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-37.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-37 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is +0 (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: +0 + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-38.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-38.js new file mode 100644 index 000000000..96fc6ea9b --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-38.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-38 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is -0 (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: -0 + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-39.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-39.js new file mode 100644 index 000000000..e54355938 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-39.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-39 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is NaN (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: NaN + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-4.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-4.js new file mode 100644 index 000000000..717330ada --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-4.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-4 +description: Object.defineProperties - 'descObj' is a number (8.10.5 step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + try { + Object.defineProperties(obj, { + prop: 12 + }); + return false; + } catch (e) { + return e instanceof TypeError && !obj.hasOwnProperty("prop"); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-40.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-40.js new file mode 100644 index 000000000..cecc92681 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-40.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-40 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is positive number (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: 12 + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-41.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-41.js new file mode 100644 index 000000000..181425fc6 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-41.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-41 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is negative number (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: -9 + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-42.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-42.js new file mode 100644 index 000000000..a090d1fcc --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-42.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-42 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is empty string (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: "" + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-43.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-43.js new file mode 100644 index 000000000..9b061ea0c --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-43.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-43 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is non-empty string (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: "AB\n\\cd" + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-44.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-44.js new file mode 100644 index 000000000..0ddb43bf1 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-44.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-44 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is a Function object (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: function () { } + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-45.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-45.js new file mode 100644 index 000000000..10cb835a6 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-45.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-45 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is an Array object (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: [] + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-46.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-46.js new file mode 100644 index 000000000..2e93acc52 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-46.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-46 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is a String object (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: new String() + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-47.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-47.js new file mode 100644 index 000000000..5d181fddb --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-47.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-47 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is a Boolean object (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: new Boolean(true) + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-48.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-48.js new file mode 100644 index 000000000..6307dc5c6 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-48.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-48 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is a Number object (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: new Number(-9) + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-49.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-49.js new file mode 100644 index 000000000..245c6757d --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-49.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-49 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is the Math object (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: Math + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-5.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-5.js new file mode 100644 index 000000000..46c2b2606 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-5.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-5 +description: Object.defineProperties - 'descObj' is a string (8.10.5 step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + try { + Object.defineProperties(obj, { + prop: "abc" + }); + return false; + } catch (e) { + return e instanceof TypeError && !obj.hasOwnProperty("prop"); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-50.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-50.js new file mode 100644 index 000000000..23cda5882 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-50.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-50 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is a Date object (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: new Date() + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-51.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-51.js new file mode 100644 index 000000000..c0e2ab1c0 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-51.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-51 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is a RegExp object (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: new RegExp() + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-52.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-52.js new file mode 100644 index 000000000..ff5ccadd8 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-52.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-52 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is the JSON object (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: JSON + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-53.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-53.js new file mode 100644 index 000000000..5f2ef94c2 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-53.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-53 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is an Error object (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: new Error() + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-54.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-54.js new file mode 100644 index 000000000..e569cd2be --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-54.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-54 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is the Arguments object (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + var arg; + + (function fun() { + arg = arguments; + }(1, 2, 3)); + + Object.defineProperties(obj, { + prop: { + enumerable: arg + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-56.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-56.js new file mode 100644 index 000000000..084ae835e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-56.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-56 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is the global object (8.10.5 step 3.b) +includes: + - runTestCase.js + - fnGlobalObject.js +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: fnGlobalObject() + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-57.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-57.js new file mode 100644 index 000000000..1dc22b224 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-57.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-57 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is a string (value is 'false') which is treated as true + value (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: "false" + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-58.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-58.js new file mode 100644 index 000000000..82ecb0600 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-58.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-58 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is new Boolean(false) which is treated as true value + (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: new Boolean(false) + } + }); + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-59.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-59.js new file mode 100644 index 000000000..99a5dbbbb --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-59.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-59 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + present (8.10.5 step 4) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperties(obj, { + prop: { + configurable: true + } + }); + + var result1 = obj.hasOwnProperty("prop"); + delete obj.prop; + var result2 = obj.hasOwnProperty("prop"); + + return result1 === true && result2 === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-6.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-6.js new file mode 100644 index 000000000..1b8f4320c --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-6.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-6 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + present (8.10.5 step 3) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: { + enumerable: true + } + }); + + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-60.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-60.js new file mode 100644 index 000000000..272b02e98 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-60.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-60 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + not present (8.10.5 step 4) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperties(obj, { + prop: {} + }); + + var result1 = obj.hasOwnProperty("prop"); + delete obj.prop; + var result2 = obj.hasOwnProperty("prop"); + + return result1 === true && result2 === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-61.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-61.js new file mode 100644 index 000000000..55284e377 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-61.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-61 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + own data property (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperties(obj, { + prop: { + configurable: true + } + }); + + var result1 = obj.hasOwnProperty("prop"); + delete obj.prop; + var result2 = obj.hasOwnProperty("prop"); + + return result1 === true && result2 === false; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-62.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-62.js new file mode 100644 index 000000000..e0f6d570b --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-62.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-62 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + inherited data property (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var proto = { + configurable: true + }; + var Con = function () { }; + Con.prototype = proto; + var descObj = new Con(); + + Object.defineProperties(obj, { + prop: descObj + }); + + var result1 = obj.hasOwnProperty("prop"); + delete obj.prop; + var result2 = obj.hasOwnProperty("prop"); + + return result1 === true && result2 === false; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-63.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-63.js new file mode 100644 index 000000000..9d208285f --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-63.js @@ -0,0 +1,40 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-63 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + own data property that overrides an inherited data property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var proto = { + configurable: true + }; + + var Con = function () { }; + Con.prototype = proto; + var descObj = new Con(); + + Object.defineProperty(descObj, "configurable", { + value: false + }); + + Object.defineProperties(obj, { + prop: descObj + }); + var result1 = obj.hasOwnProperty("prop"); + delete obj.prop; + var result2 = obj.hasOwnProperty("prop"); + + return result1 === true && result2 === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-64.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-64.js new file mode 100644 index 000000000..f754ca4fc --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-64.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-64 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + own data property that overrides an inherited accessor property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var proto = {}; + Object.defineProperty(proto, "configurable", { + get: function () { + return true; + } + }); + + var Con = function () { }; + Con.prototype = proto; + var descObj = new Con(); + + Object.defineProperty(descObj, "configurable", { + value: false + }); + + Object.defineProperties(obj, { + prop: descObj + }); + var result1 = obj.hasOwnProperty("prop"); + delete obj.prop; + var result2 = obj.hasOwnProperty("prop"); + + return result1 === true && result2 === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-65.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-65.js new file mode 100644 index 000000000..966350492 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-65.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-65 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + own accessor property (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + var descObj = {}; + Object.defineProperty(descObj, "configurable", { + get: function () { + return true; + } + }); + + Object.defineProperties(obj, { + prop: descObj + }); + var result1 = obj.hasOwnProperty("prop"); + delete obj.prop; + var result2 = obj.hasOwnProperty("prop"); + + return result1 === true && result2 === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-66.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-66.js new file mode 100644 index 000000000..44e6ba52a --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-66.js @@ -0,0 +1,40 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-66 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + inherited accessor property (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var proto = {}; + + Object.defineProperty(proto, "configurable", { + get: function () { + return true; + } + }); + + var Con = function () { }; + Con.prototype = proto; + var descObj = new Con(); + + Object.defineProperties(obj, { + prop: descObj + }); + + var result1 = obj.hasOwnProperty("prop"); + delete obj.prop; + var result2 = obj.hasOwnProperty("prop"); + + return result1 === true && result2 === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-67.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-67.js new file mode 100644 index 000000000..eec0dbc5d --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-67.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-67 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + own accessor property that overrides an inherited data property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var proto = { + configurable: true + }; + + var Con = function () { }; + Con.prototype = proto; + var descObj = new Con(); + + Object.defineProperty(descObj, "configurable", { + get: function () { + return false; + } + }); + + Object.defineProperties(obj, { + prop: descObj + }); + var result1 = obj.hasOwnProperty("prop"); + delete obj.prop; + var result2 = obj.hasOwnProperty("prop"); + + return result1 === true && result2 === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-68.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-68.js new file mode 100644 index 000000000..e46ce6803 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-68.js @@ -0,0 +1,45 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-68 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + own accessor property that overrides an inherited accessor + property (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var proto = {}; + Object.defineProperty(proto, "configurable", { + get: function () { + return true; + } + }); + + var Con = function () { }; + Con.prototype = proto; + var descObj = new Con(); + + Object.defineProperty(descObj, "configurable", { + get: function () { + return false; + } + }); + + Object.defineProperties(obj, { + prop: descObj + }); + var result1 = obj.hasOwnProperty("prop"); + delete obj.prop; + var result2 = obj.hasOwnProperty("prop"); + + return result1 === true && result2 === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-69.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-69.js new file mode 100644 index 000000000..4f43dd026 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-69.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-69 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + own accessor property without a get function (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + var descObj = {}; + Object.defineProperty(descObj, "configurable", { + set: function () { } + }); + + Object.defineProperties(obj, { + prop: descObj + }); + var result1 = obj.hasOwnProperty("prop"); + delete obj.prop; + var result2 = obj.hasOwnProperty("prop"); + + return result1 === true && result2 === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-7.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-7.js new file mode 100644 index 000000000..ac9a57dcc --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-7.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-7 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + not present (8.10.5 step 3) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperties(obj, { + prop: {} + }); + + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-70.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-70.js new file mode 100644 index 000000000..850343a50 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-70.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-70 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + own accessor property without a get function that overrides an + inherited accessor property (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var proto = {}; + Object.defineProperty(proto, "configurable", { + get: function () { + return true; + } + }); + + var Con = function () { }; + Con.prototype = proto; + var descObj = new Con(); + + Object.defineProperty(descObj, "configurable", { + set: function () { } + }); + + Object.defineProperties(obj, { + prop: descObj + }); + var result1 = obj.hasOwnProperty("prop"); + delete obj.prop; + var result2 = obj.hasOwnProperty("prop"); + + return result1 === true && result2 === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-71.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-71.js new file mode 100644 index 000000000..4b4b639c6 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-71.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-71 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + inherited accessor property without a get function (8.10.5 step + 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var proto = {}; + + Object.defineProperty(proto, "configurable", { + set: function () { } + }); + + var Con = function () { }; + Con.prototype = proto; + var descObj = new Con(); + + Object.defineProperties(obj, { + prop: descObj + }); + + var result1 = obj.hasOwnProperty("prop"); + delete obj.prop; + var result2 = obj.hasOwnProperty("prop"); + + return result1 === true && result2 === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-72.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-72.js new file mode 100644 index 000000000..7b1bb8158 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-72.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-72 +description: > + Object.defineProperties - 'descObj' is a Function object which + implements its own [[Get]] method to get 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + var descObj = function () { }; + descObj.configurable = true; + + Object.defineProperties(obj, { + prop: descObj + }); + + var result1 = obj.hasOwnProperty("prop"); + delete obj.prop; + var result2 = obj.hasOwnProperty("prop"); + + return result1 === true && result2 === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-73.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-73.js new file mode 100644 index 000000000..c0d581a11 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-73.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-73 +description: > + Object.defineProperties - 'descObj' is an Array object which + implements its own [[Get]] method to get 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + var descObj = []; + descObj.configurable = true; + + Object.defineProperties(obj, { + prop: descObj + }); + + var result1 = obj.hasOwnProperty("prop"); + delete obj.prop; + var result2 = obj.hasOwnProperty("prop"); + + return result1 === true && result2 === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-74.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-74.js new file mode 100644 index 000000000..d842598a0 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-74.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-74 +description: > + Object.defineProperties - 'descObj' is a String object which + implements its own [[Get]] method to get 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + var descObj = new String(); + descObj.configurable = true; + + Object.defineProperties(obj, { + prop: descObj + }); + var result1 = obj.hasOwnProperty("prop"); + delete obj.prop; + var result2 = obj.hasOwnProperty("prop"); + + return result1 === true && result2 === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-75.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-75.js new file mode 100644 index 000000000..6df5e5ec3 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-75.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-75 +description: > + Object.defineProperties - 'descObj' is a Boolean object which + implements its own [[Get]] method to get 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + var descObj = new Boolean(false); + descObj.configurable = true; + + Object.defineProperties(obj, { + prop: descObj + }); + + var result1 = obj.hasOwnProperty("prop"); + delete obj.prop; + var result2 = obj.hasOwnProperty("prop"); + + return result1 === true && result2 === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-76.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-76.js new file mode 100644 index 000000000..7ee1adbea --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-76.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-76 +description: > + Object.defineProperties - 'descObj' is a Number object which + implements its own [[Get]] method to get 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + var descObj = new Number(-9); + descObj.configurable = true; + + Object.defineProperties(obj, { + prop: descObj + }); + + var result1 = obj.hasOwnProperty("prop"); + delete obj.prop; + var result2 = obj.hasOwnProperty("prop"); + + return result1 === true && result2 === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-77.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-77.js new file mode 100644 index 000000000..677a8b900 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-77.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-77 +description: > + Object.defineProperties - 'descObj' is the Math object which + implements its own [[Get]] method to get 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + try { + Math.configurable = true; + + Object.defineProperties(obj, { + prop: Math + }); + + var result1 = obj.hasOwnProperty("prop"); + delete obj.prop; + var result2 = obj.hasOwnProperty("prop"); + + return result1 === true && result2 === false; + } finally { + delete Math.configurable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-78.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-78.js new file mode 100644 index 000000000..941c0040b --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-78.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-78 +description: > + Object.defineProperties - 'descObj' is a Date object which + implements its own [[Get]] method to get 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + var descObj = new Date(); + descObj.configurable = true; + + Object.defineProperties(obj, { + prop: descObj + }); + + var result1 = obj.hasOwnProperty("prop"); + delete obj.prop; + var result2 = obj.hasOwnProperty("prop"); + + return result1 === true && result2 === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-79.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-79.js new file mode 100644 index 000000000..0e110ef73 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-79.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-79 +description: > + Object.defineProperties - 'descObj' is a RegExp object which + implements its own [[Get]] method to get 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + var descObj = new RegExp(); + descObj.configurable = true; + + Object.defineProperties(obj, { + prop: descObj + }); + + var result1 = obj.hasOwnProperty("prop"); + delete obj.prop; + var result2 = obj.hasOwnProperty("prop"); + + return result1 === true && result2 === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-8.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-8.js new file mode 100644 index 000000000..6fc9accab --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-8.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-8 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + own data property (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + var descObj = { enumerable: true }; + + Object.defineProperties(obj, { + prop: descObj + }); + + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-80.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-80.js new file mode 100644 index 000000000..7319d2896 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-80.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-80 +description: > + Object.defineProperties - 'descObj' is the JSON object which + implements its own [[Get]] method to get 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + try { + JSON.configurable = true; + + Object.defineProperties(obj, { + prop: JSON + }); + + var result1 = obj.hasOwnProperty("prop"); + delete obj.prop; + var result2 = obj.hasOwnProperty("prop"); + + return result1 === true && result2 === false; + } finally { + delete JSON.configurable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-81.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-81.js new file mode 100644 index 000000000..4668f5486 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-81.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-81 +description: > + Object.defineProperties - 'descObj' is an Error object which + implements its own [[Get]] method to get 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + var descObj = new Error(); + descObj.configurable = true; + + Object.defineProperties(obj, { + prop: descObj + }); + + var result1 = obj.hasOwnProperty("prop"); + delete obj.prop; + var result2 = obj.hasOwnProperty("prop"); + + return result1 === true && result2 === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-82.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-82.js new file mode 100644 index 000000000..d58c12781 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-82.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-82 +description: > + Object.defineProperties - 'descObj' is the Arguments object which + implements its own [[Get]] method to get 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + var arg; + (function fun() { + arg = arguments; + }()); + + arg.configurable = true; + + Object.defineProperties(obj, { + prop: arg + }); + + var result1 = obj.hasOwnProperty("prop"); + delete obj.prop; + var result2 = obj.hasOwnProperty("prop"); + + return result1 === true && result2 === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-84.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-84.js new file mode 100644 index 000000000..46fd4a6e2 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-84.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-84 +description: > + Object.defineProperties - 'descObj' is the global object which + implements its own [[Get]] method to get 'configurable' property + (8.10.5 step 4.a) +includes: + - runTestCase.js + - fnGlobalObject.js +---*/ + +function testcase() { + + var obj = {}; + + try { + fnGlobalObject().configurable = true; + + Object.defineProperties(obj, { + prop: fnGlobalObject() + }); + + var result1 = obj.hasOwnProperty("prop"); + delete obj.prop; + var result2 = obj.hasOwnProperty("prop"); + + return result1 === true && result2 === false; + } finally { + delete fnGlobalObject().configurable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-85.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-85.js new file mode 100644 index 000000000..6136a39e9 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-85.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-85 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is undefined (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + configurable: undefined + } + }); + + var hadOwnProperty = obj.hasOwnProperty("property"); + + delete obj.property; + + return obj.hasOwnProperty("property") && hadOwnProperty; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-86.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-86.js new file mode 100644 index 000000000..71374c29e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-86.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-86 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is null (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + configurable: null + } + }); + + var hadOwnProperty = obj.hasOwnProperty("property"); + + delete obj.property; + + return obj.hasOwnProperty("property") && hadOwnProperty; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-87.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-87.js new file mode 100644 index 000000000..30772f693 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-87.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-87 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is true (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + configurable: true + } + }); + + var hadOwnProperty = obj.hasOwnProperty("property"); + + delete obj.property; + + return !obj.hasOwnProperty("property") && hadOwnProperty; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-88.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-88.js new file mode 100644 index 000000000..0e2a6410e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-88.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-88 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is false (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + configurable: false + } + }); + + var hadOwnProperty = obj.hasOwnProperty("property"); + + delete obj.property; + + return obj.hasOwnProperty("property") && hadOwnProperty; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-89.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-89.js new file mode 100644 index 000000000..cc88c7b20 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-89.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-89 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is 0 (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + configurable: 0 + } + }); + + var hadOwnProperty = obj.hasOwnProperty("property"); + + delete obj.property; + + return obj.hasOwnProperty("property") && hadOwnProperty; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-9.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-9.js new file mode 100644 index 000000000..b5d3673ec --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-9.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-9 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + inherited data property (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + var proto = { + enumerable: true + }; + var Con = function () { }; + Con.prototype = proto; + var descObj = new Con(); + + Object.defineProperties(obj, { + prop: descObj + }); + + for (var property in obj) { + if (property === "prop") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-90.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-90.js new file mode 100644 index 000000000..aea69a8b4 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-90.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-90 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is +0 (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + configurable: +0 + } + }); + + var hadOwnProperty = obj.hasOwnProperty("property"); + + delete obj.property; + + return obj.hasOwnProperty("property") && hadOwnProperty; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-91.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-91.js new file mode 100644 index 000000000..594e4ed61 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-91.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-91 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is -0 (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + configurable: -0 + } + }); + + var hadOwnProperty = obj.hasOwnProperty("property"); + + delete obj.property; + + return obj.hasOwnProperty("property") && hadOwnProperty; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-92.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-92.js new file mode 100644 index 000000000..eb014efe3 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-92.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-92 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is NaN (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + configurable: NaN + } + }); + + var hadOwnProperty = obj.hasOwnProperty("property"); + + delete obj.property; + + return obj.hasOwnProperty("property") && hadOwnProperty; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-93.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-93.js new file mode 100644 index 000000000..34a106021 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-93.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-93 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is positive number (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + configurable: 123 + } + }); + + var hadOwnProperty = obj.hasOwnProperty("property"); + + delete obj.property; + + return !obj.hasOwnProperty("property") && hadOwnProperty; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-94.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-94.js new file mode 100644 index 000000000..3972d07e5 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-94.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-94 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is negative number (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + configurable: -123 + } + }); + + var hadOwnProperty = obj.hasOwnProperty("property"); + + delete obj.property; + + return !obj.hasOwnProperty("property") && hadOwnProperty; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-95.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-95.js new file mode 100644 index 000000000..f98aad24c --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-95.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-95 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is empty string (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + configurable: "" + } + }); + + var hadOwnProperty = obj.hasOwnProperty("property"); + + delete obj.property; + + return obj.hasOwnProperty("property") && hadOwnProperty; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-96.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-96.js new file mode 100644 index 000000000..f1e708987 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-96.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-96 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is non-empty string (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + configurable: "abc" + } + }); + + var hadOwnProperty = obj.hasOwnProperty("property"); + + delete obj.property; + + return !obj.hasOwnProperty("property") && hadOwnProperty; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-97.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-97.js new file mode 100644 index 000000000..55fe64e9e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-97.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-97 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is Function object (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + configurable: function () { } + } + }); + + var hadOwnProperty = obj.hasOwnProperty("property"); + + delete obj.property; + + return !obj.hasOwnProperty("property") && hadOwnProperty; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-98.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-98.js new file mode 100644 index 000000000..4c3c8dd61 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-98.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-98 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is Array object (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + configurable: [1, 2, 3] + } + }); + + var hadOwnProperty = obj.hasOwnProperty("property"); + + delete obj.property; + + return !obj.hasOwnProperty("property") && hadOwnProperty; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-5-b-99.js b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-99.js new file mode 100644 index 000000000..4aa080f7f --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-5-b-99.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-5-b-99 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is String object (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + property: { + configurable: new String("abc") + } + }); + + var hadOwnProperty = obj.hasOwnProperty("property"); + + delete obj.property; + + return !obj.hasOwnProperty("property") && hadOwnProperty; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-1.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-1.js new file mode 100644 index 000000000..57b356cad --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-1.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-1 +description: > + Object.defineProperties - 'P' is own existing data property + (8.12.9 step 1 ) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, "prop", { + value: 11, + configurable: false + }); + + try { + Object.defineProperties(obj, { + prop: { + value: 12, + configurable: true + } + }); + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-10.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-10.js new file mode 100644 index 000000000..5b579bab2 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-10.js @@ -0,0 +1,46 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-10 +description: > + Object.defineProperties - 'P' is own accessor property without a + get function that overrides an inherited accessor property (8.12.9 + step 1 ) +includes: [runTestCase.js] +---*/ + +function testcase() { + var proto = {}; + Object.defineProperty(proto, "prop", { + get: function () { + return 11; + }, + set: function () { }, + configurable: true + }); + var Con = function () { }; + Con.prototype = proto; + + var obj = new Con(); + Object.defineProperty(obj, "prop", { + set: function () { }, + configurable: false + }); + + try { + Object.defineProperties(obj, { + prop: { + value: 12, + configurable: true + } + }); + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-100.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-100.js new file mode 100644 index 000000000..a718b2b73 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-100.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-100 +description: > + Object.defineProperties - 'P' is data property, several attributes + values of P and properties are different (8.12.9 step 12) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: 100, + writable: true, + configurable: true + }); + + Object.defineProperties(obj, { + foo: { + value: 200, + writable: false, + configurable: false + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", 200, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-101.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-101.js new file mode 100644 index 000000000..7654595d0 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-101.js @@ -0,0 +1,47 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-101 +description: > + Object.defineProperties - 'P' is accessor property, both + properties.[[Get]] and P.[[Get]] are two different values (8.12.9 + step 12) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function get_func() { + return 10; + } + function set_func(value) { + obj.setVerifyHelpProp = value; + } + + Object.defineProperty(obj, "foo", { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + }); + + function get_func2() { + return 20; + } + + Object.defineProperties(obj, { + foo: { + get: get_func2 + } + }); + return accessorPropertyAttributesAreCorrect(obj, "foo", get_func2, set_func, "setVerifyHelpProp", true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-102.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-102.js new file mode 100644 index 000000000..3a7e732c3 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-102.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-102 +description: > + Object.defineProperties - 'P' is accessor property, P.[[Get]] is + present and properties.[[Get]] is undefined (8.12.9 step 12) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function get_func() { + return 10; + } + function set_func(value) { + obj.setVerifyHelpProp = value; + } + + Object.defineProperty(obj, "foo", { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + }); + + Object.defineProperties(obj, { + foo: { + get: undefined + } + }); + return accessorPropertyAttributesAreCorrect(obj, "foo", undefined, set_func, "setVerifyHelpProp", true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-103.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-103.js new file mode 100644 index 000000000..472d1a254 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-103.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-103 +description: > + Object.defineProperties - 'P' is accessor property, P.[[Get]] is + undefined and properties.[[Get]] is normal value (8.12.9 step 12) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function set_func(value) { + obj.setVerifyHelpProp = value; + } + + Object.defineProperty(obj, "foo", { + get: undefined, + set: set_func, + enumerable: true, + configurable: true + }); + + function get_func() { + return 10; + } + + Object.defineProperties(obj, { + foo: { + get: get_func + } + }); + return accessorPropertyAttributesAreCorrect(obj, "foo", get_func, set_func, "setVerifyHelpProp", true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-104.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-104.js new file mode 100644 index 000000000..c24473b8d --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-104.js @@ -0,0 +1,48 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-104 +description: > + Object.defineProperties - 'P' is accessor property, both + properties.[[Set]] and P.[[Set]] are two different values (8.12.9 + step 12) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function get_func() { + return 10; + } + + function set_func() { + return 10; + } + + Object.defineProperty(obj, "foo", { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + }); + + function set_func2(value) { + obj.setVerifyHelpProp = value; + } + + Object.defineProperties(obj, { + foo: { + set: set_func2 + } + }); + return accessorPropertyAttributesAreCorrect(obj, "foo", get_func, set_func2, "setVerifyHelpProp", true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-105.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-105.js new file mode 100644 index 000000000..9a2c9f5c4 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-105.js @@ -0,0 +1,58 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-105 +description: > + Object.defineProperties - 'P' is accessor property, P.[[Set]] is + present and properties.[[Set]] is undefined (8.12.9 step 12) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + function get_func() { + return 10; + } + function set_func() { + return 10; + } + + Object.defineProperty(obj, "property", { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + }); + + Object.defineProperties(obj, { + property: { + set: undefined + } + }); + + var hasProperty = obj.hasOwnProperty("property"); + var verifyGet = false; + verifyGet = (obj.property === 10); + + var verifySet = false; + var desc = Object.getOwnPropertyDescriptor(obj, "property"); + verifySet = (typeof desc.set === 'undefined'); + + var verifyEnumerable = false; + for (var p in obj) { + if (p === "property") { + verifyEnumerable = true; + } + } + + var verifyConfigurable = false; + delete obj.property; + verifyConfigurable = obj.hasOwnProperty("property"); + + return hasProperty && verifyGet && verifySet && verifyEnumerable && !verifyConfigurable; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-106.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-106.js new file mode 100644 index 000000000..c8c5ae6f3 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-106.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-106 +description: > + Object.defineProperties - 'P' is accessor property, P.[[Set]] is + undefined and properties.[[Set]] is normal value (8.12.9 step 12) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function get_func() { + return 10; + } + + Object.defineProperty(obj, "foo", { + get: get_func, + set: undefined, + enumerable: true, + configurable: true + }); + + function set_func(value) { + obj.setVerifyHelpProp = value; + } + + Object.defineProperties(obj, { + foo: { + set: set_func + } + }); + return accessorPropertyAttributesAreCorrect(obj, "foo", get_func, set_func, "setVerifyHelpProp", true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-107.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-107.js new file mode 100644 index 000000000..ccbed0fcd --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-107.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-107 +description: > + Object.defineProperties - 'P' is accessor property, P.enumerable + and properties.enumerable are different values (8.12.9 step 12) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function get_func() { + return 10; + } + function set_func(value) { + obj.setVerifyHelpProp = value; + } + + Object.defineProperty(obj, "foo", { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + }); + + Object.defineProperties(obj, { + foo: { + enumerable: false + } + }); + return accessorPropertyAttributesAreCorrect(obj, "foo", get_func, set_func, "setVerifyHelpProp", false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-108.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-108.js new file mode 100644 index 000000000..7218d10ec --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-108.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-108 +description: > + Object.defineProperties - 'P' is accessor property, P.configurable + is true and properties.configurable is false +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function get_func() { + return 10; + } + function set_func(value) { + obj.setVerifyHelpProp = value; + } + + Object.defineProperty(obj, "foo", { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + }); + + Object.defineProperties(obj, { + foo: { + configurable: false + } + }); + return accessorPropertyAttributesAreCorrect(obj, "foo", get_func, set_func, "setVerifyHelpProp", true, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-109.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-109.js new file mode 100644 index 000000000..43e641b78 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-109.js @@ -0,0 +1,49 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-109 +description: > + Object.defineProperties - 'P' is accessor property, several + attributes values of P and properties are different (8.12.9 step + 12) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function get_func1() { + return 10; + } + function set_func1() { } + + Object.defineProperty(obj, "foo", { + get: get_func1, + set: set_func1, + configurable: true + }); + + function get_func2() { + return 20; + } + function set_func2(value) { + obj.setVerifyHelpProp = value; + } + + Object.defineProperties(obj, { + foo: { + get: get_func2, + set: set_func2, + configurable: false + } + }); + return accessorPropertyAttributesAreCorrect(obj, "foo", get_func2, set_func2, "setVerifyHelpProp", false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-11.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-11.js new file mode 100644 index 000000000..0e2dc1dc2 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-11.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-11 +description: > + Object.defineProperties - 'P' is inherited accessor property + without a get function (8.12.9 step 1 ) +includes: [runTestCase.js] +---*/ + +function testcase() { + var proto = {}; + Object.defineProperty(proto, "prop", { + set: function () { }, + configurable: false + }); + var Con = function () { }; + Con.prototype = proto; + + var obj = new Con(); + + Object.defineProperties(obj, { + prop: { + get: function () { + return 12; + }, + configurable: true + } + }); + return obj.hasOwnProperty("prop") && obj.prop === 12; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-110.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-110.js new file mode 100644 index 000000000..46cf1e038 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-110.js @@ -0,0 +1,48 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-110 +description: > + Object.defineProperties - all own properties (data property and + accessor property) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function get_func() { + return 10; + } + function set_func(value) { + obj.setVerifyHelpProp = value; + } + + var properties = { + foo1: { + value: 200, + enumerable: true, + writable: true, + configurable: true + }, + foo2: { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + } + }; + + Object.defineProperties(obj, properties); + return dataPropertyAttributesAreCorrect(obj, "foo1", 200, true, true, true) && accessorPropertyAttributesAreCorrect(obj, "foo2", get_func, set_func, "setVerifyHelpProp", true, true); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-111.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-111.js new file mode 100644 index 000000000..2f1f13c56 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-111.js @@ -0,0 +1,48 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-111 +description: Object.defineProperties - each properties are in list order +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + function get_func() { + return 20; + } + + function set_func() { } + + var properties = { + a: { + value: 100, + enumerable: true, + writable: true, + configurable: true + }, + b: { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + }, + c: { + value: 200, + enumerable: true, + writable: true, + configurable: true + } + }; + + Object.defineProperties(obj, properties); + return (obj["a"] === 100 && obj["b"] === 20 && obj["c"] === 200); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-112.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-112.js new file mode 100644 index 000000000..dea7e7088 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-112.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-112 +description: > + Object.defineProperties - 'O' is an Array, test the length + property of 'O' is own data property (15.4.5.1 step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, 1]; + Object.defineProperty(arr, "1", { + value: 1, + configurable: false + }); + try { + + Object.defineProperties(arr, { + length: { value: 1 } + }); + return false; + } catch (ex) { + var desc = Object.getOwnPropertyDescriptor(arr, "length"); + + return ex instanceof TypeError && desc.value === 2 && + desc.writable && !desc.enumerable && !desc.configurable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-113.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-113.js new file mode 100644 index 000000000..a287ac8ca --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-113.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-113 +description: > + Object.defineProperties - 'O' is an Array, test the length + property of 'O' is own data property that overrides an inherited + data property (15.4.5.1 step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrProtoLen; + var arr = [0, 1, 2]; + try { + arrProtoLen = Array.prototype.length; + Array.prototype.length = 0; + + Object.defineProperty(arr, "2", { + configurable: false + }); + + Object.defineProperties(arr, { + length: { value: 1 } + }); + return false; + } catch (e) { + var desc = Object.getOwnPropertyDescriptor(arr, "length"); + + return e instanceof TypeError && desc.value === 3 && + desc.writable && !desc.enumerable && !desc.configurable; + } finally { + Array.prototype.length = arrProtoLen; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-114.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-114.js new file mode 100644 index 000000000..beb373ec9 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-114.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-114 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is absent, test + every field in 'desc' is absent (15.4.5.1 step 3.a.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arr = []; + + Object.defineProperties(arr, { length: {} }); + + var verifyValue = false; + verifyValue = (arr.length === 0); + + var verifyWritable = false; + arr.length = 2; + verifyWritable = (arr.length === 2); + + var verifyEnumerable = false; + for (var p in arr) { + if (p === "length") { + verifyEnumerable = true; + } + } + + var verifyConfigurable = false; + delete arr.length; + verifyConfigurable = arr.hasOwnProperty("length"); + + return verifyValue && verifyWritable && !verifyEnumerable && verifyConfigurable; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-115.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-115.js new file mode 100644 index 000000000..1a8c5d204 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-115.js @@ -0,0 +1,48 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-115 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is absent, test + every field in 'desc' is same with corresponding attribute value + of the length property in 'O' (15.4.5.1 step 3.a.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arr = []; + + Object.defineProperties(arr, { + length: { + writable: true, + enumerable: false, + configurable: false + } + }); + + var verifyValue = false; + verifyValue = (arr.length === 0); + + var verifyWritable = false; + arr.length = 2; + verifyWritable = (arr.length === 2); + + var verifyEnumerable = false; + for (var p in arr) { + if (p === "length") { + verifyEnumerable = true; + } + } + + var verifyConfigurable = false; + delete arr.length; + verifyConfigurable = arr.hasOwnProperty("length"); + + return verifyValue && verifyWritable && !verifyEnumerable && verifyConfigurable; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-116.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-116.js new file mode 100644 index 000000000..d63c5d3b7 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-116.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-116 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is absent, test + TypeError is thrown when updating the [[Configurable]] attribute + of the length property from false to true (15.4.5.1 step 3.a.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + try { + Object.defineProperties(arr, { + length: { configurable: true } + }); + + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-117.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-117.js new file mode 100644 index 000000000..8ec0b45be --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-117.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-117 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is absent, test + TypeError is thrown when updating the [[Enumerable]] attribute of + the length property from false to true (15.4.5.1 step 3.a.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + try { + Object.defineProperties(arr, { + length: { enumerable: true } + }); + + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-118.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-118.js new file mode 100644 index 000000000..dd0124a4e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-118.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-118 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is absent, test + TypeError is thrown when 'desc' is accessor descriptor (15.4.5.1 + step 3.a.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + try { + Object.defineProperties(arr, { + length: { + get: function () { + return 2; + } + } + }); + + return false; + } catch (e) { + return e instanceof TypeError && arr.length === 0; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-119.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-119.js new file mode 100644 index 000000000..b761b3f93 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-119.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-119 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is absent, test + TypeError is thrown when updating the [[Writable]] attribute of + the length property from false to true (15.4.5.1 step 3.a.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperty(arr, "length", { + writable: false + }); + + try { + Object.defineProperties(arr, { + length: { writable: true } + }); + + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-12.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-12.js new file mode 100644 index 000000000..dd84a5faa --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-12.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-12 +description: > + Object.defineProperties - 'O' is a Function object which + implements its own [[GetOwnProperty]] method to get 'P' (8.12.9 + step 1 ) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var fun = function () { }; + + Object.defineProperty(fun, "prop", { + value: 11, + configurable: false + }); + + try { + Object.defineProperties(fun, { + prop: { + value: 12, + configurable: true + } + }); + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(fun, "prop", 11, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-120.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-120.js new file mode 100644 index 000000000..39e13d920 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-120.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-120 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is absent, test + updating the [[Writable]] attribute of the length property from + true to false (15.4.5.1 step 3.a.i) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + + try { + Object.defineProperties(arr, { + length: { writable: false } + }); + + return dataPropertyAttributesAreCorrect(arr, "length", 0, false, false, false); + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-121.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-121.js new file mode 100644 index 000000000..eb6a6f66a --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-121.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-121 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', test RangeError is thrown when setting the + [[Value]] field of 'desc' to undefined (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + try { + Object.defineProperties(arr, { + length: { value: undefined } + }); + + return false; + } catch (e) { + return e instanceof RangeError && arr.length === 0; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-122.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-122.js new file mode 100644 index 000000000..73981db22 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-122.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-122 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', test setting the [[Value]] field of 'desc' to + null actuall is set to 0 (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, 1]; + + Object.defineProperties(arr, { + length: { value: null } + }); + return arr.length === 0; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-123.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-123.js new file mode 100644 index 000000000..599e0d0cc --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-123.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-123 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is a boolean + with value false (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, 1]; + + Object.defineProperties(arr, { + length: { value: false } + }); + return arr.length === 0; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-124.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-124.js new file mode 100644 index 000000000..8edddac42 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-124.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-124 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is a boolean + with value true (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperties(arr, { + length: { value: true } + }); + return arr.length === 1; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-125.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-125.js new file mode 100644 index 000000000..ffbb0d5ba --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-125.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-125 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is 0 (15.4.5.1 + step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, 1]; + + Object.defineProperties(arr, { + length: { value: 0 } + }); + return arr.length === 0; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-126.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-126.js new file mode 100644 index 000000000..0f0840097 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-126.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-126 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is +0 + (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, 1]; + + Object.defineProperties(arr, { + length: { value: +0 } + }); + return arr.length === 0; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-127.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-127.js new file mode 100644 index 000000000..f204b43de --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-127.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-127 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is -0 + (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, 1]; + + Object.defineProperties(arr, { + length: { value: -0 } + }); + return arr.length === 0; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-128.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-128.js new file mode 100644 index 000000000..c39a34c44 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-128.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-128 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is positive + number (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperties(arr, { + length: { value: 12 } + }); + return arr.length === 12; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-129.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-129.js new file mode 100644 index 000000000..f1c81d357 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-129.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-129 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is negative + number (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + try { + Object.defineProperties(arr, { + length: { + value: -9 + } + }); + return false; + } catch (e) { + return e instanceof RangeError && arr.length === 0; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-13.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-13.js new file mode 100644 index 000000000..0310a6ef9 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-13.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-13 +description: > + Object.defineProperties - 'O' is an Array object which implements + its own [[GetOwnProperty]] method to get 'P' (8.12.9 step 1 ) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + Object.defineProperty(arr, "prop", { + value: 11, + configurable: false + }); + + try { + Object.defineProperties(arr, { + prop: { + value: 12, + configurable: true + } + }); + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arr, "prop", 11, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-130.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-130.js new file mode 100644 index 000000000..941761b94 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-130.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-130 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is +Infinity + (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + try { + Object.defineProperties(arr, { + length: { + value: +Infinity + } + }); + return false; + } catch (e) { + return e instanceof RangeError && arr.length === 0; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-131.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-131.js new file mode 100644 index 000000000..17a65cfcc --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-131.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-131 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is -Infinity + (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + try { + Object.defineProperties(arr, { + length: { + value: -Infinity + } + }); + return false; + } catch (e) { + return e instanceof RangeError && arr.length === 0; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-132.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-132.js new file mode 100644 index 000000000..924f053d2 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-132.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-132 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is NaN + (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + try { + Object.defineProperties(arr, { + length: { + value: NaN + } + }); + + return false; + } catch (e) { + return e instanceof RangeError && arr.length === 0; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-133.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-133.js new file mode 100644 index 000000000..41638cfc8 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-133.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-133 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is a string + containing a positive number (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperties(arr, { + length: { + value: "2" + } + }); + return arr.length === 2; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-134.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-134.js new file mode 100644 index 000000000..ff233e80d --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-134.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-134 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is a string + containing a negative number (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + try { + Object.defineProperties(arr, { + length: { + value: "-42" + } + }); + return false; + } catch (e) { + return e instanceof RangeError && arr.length === 0; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-135.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-135.js new file mode 100644 index 000000000..4cb162c75 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-135.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-135 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is a string + containing a decimal number (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + try { + Object.defineProperties(arr, { + length: { + value: "200.59" + } + }); + return false; + } catch (e) { + return e instanceof RangeError && arr.length === 0; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-136.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-136.js new file mode 100644 index 000000000..7c8f26358 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-136.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-136 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is a string + containing +Infinity (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + try { + Object.defineProperties(arr, { + length: { + value: "+Infinity" + } + }); + return false; + } catch (e) { + return e instanceof RangeError && arr.length === 0; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-137.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-137.js new file mode 100644 index 000000000..798ba24aa --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-137.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-137 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is a string + containing -Infinity (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + try { + Object.defineProperties(arr, { + length: { + value: "-Infinity" + } + }); + return false; + } catch (e) { + return e instanceof RangeError && arr.length === 0; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-138.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-138.js new file mode 100644 index 000000000..62f651210 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-138.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-138 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is a string + containing an exponential number (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperties(arr, { + length: { + value: "2E3" + } + }); + return arr.length === 2E3; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-139.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-139.js new file mode 100644 index 000000000..e5fb9635b --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-139.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-139 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is a string + containing an hex number (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperties(arr, { + length: { + value: "0x00B" + } + }); + return arr.length === 0x00B; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-14.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-14.js new file mode 100644 index 000000000..b094ee9ef --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-14.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-14 +description: > + Object.defineProperties - 'O' is a String object which implements + its own [[GetOwnProperty]] method to get 'P' (8.12.9 step 1 ) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var str = new String(); + + Object.defineProperty(str, "prop", { + value: 11, + configurable: false + }); + + try { + Object.defineProperties(str, { + prop: { + value: 12, + configurable: true + } + }); + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(str, "prop", 11, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-140.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-140.js new file mode 100644 index 000000000..5b4b453a1 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-140.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-140 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is a string + containing an leading zero number (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperties(arr, { + length: { + value: "0002.0" + } + }); + return arr.length === 2; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-141.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-141.js new file mode 100644 index 000000000..0b3f110c7 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-141.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-141 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', test the [[Value]] field of 'desc' is a string + which doesn't convert to a number (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + try { + Object.defineProperties(arr, { + length: { + value: "two" + } + }); + return false; + } catch (e) { + return e instanceof RangeError && arr.length === 0; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-142.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-142.js new file mode 100644 index 000000000..48f1d966a --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-142.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-142 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', test the [[Value]] field of 'desc' is an Object + which has an own toString method (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperties(arr, { + length: { + value: { + toString: function () { + return '2'; + } + } + } + }); + + return arr.length === 2; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-143.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-143.js new file mode 100644 index 000000000..56d2d4bac --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-143.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-143 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is an Object + which has an own valueOf method (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperties(arr, { + length: { + value: { + valueOf: function () { + return 2; + } + } + } + }); + return arr.length === 2; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-144.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-144.js new file mode 100644 index 000000000..18b614372 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-144.js @@ -0,0 +1,40 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-144 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is an Object + which has an own valueOf method that returns an object and + toString method that returns a string (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + var toStringAccessed = false; + var valueOfAccessed = false; + + Object.defineProperties(arr, { + length: { + value: { + toString: function () { + toStringAccessed = true; + return '2'; + }, + + valueOf: function () { + valueOfAccessed = true; + return {}; + } + } + } + }); + return arr.length === 2 && toStringAccessed && valueOfAccessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-145.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-145.js new file mode 100644 index 000000000..3e6c139d1 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-145.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-145 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is an Object + which has an own toString and valueOf method (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + var toStringAccessed = false; + var valueOfAccessed = false; + + Object.defineProperties(arr, { + length: { + value: { + toString: function () { + toStringAccessed = true; + return '2'; + }, + + valueOf: function () { + valueOfAccessed = true; + return 3; + } + } + } + }); + return arr.length === 3 && !toStringAccessed && valueOfAccessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-146.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-146.js new file mode 100644 index 000000000..cb6242cd6 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-146.js @@ -0,0 +1,45 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-146 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test TypeError is thrown when the [[Value]] field + of 'desc' is an Object that both toString and valueOf wouldn't + return primitive value (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + var toStringAccessed = false; + var valueOfAccessed = false; + + try { + Object.defineProperties(arr, { + length: { + value: { + toString: function () { + toStringAccessed = true; + return {}; + }, + + valueOf: function () { + valueOfAccessed = true; + return {}; + } + } + } + }); + + return false; + } catch (e) { + return (e instanceof TypeError) && toStringAccessed && valueOfAccessed; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-147.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-147.js new file mode 100644 index 000000000..a4392bbdf --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-147.js @@ -0,0 +1,50 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-147 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test using inherited valueOf method when the + [[Value]] field of 'desc' is an Objec with an own toString and + inherited valueOf methods (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + var toStringAccessed = false; + var valueOfAccessed = false; + + var proto = { + value: { + valueOf: function () { + valueOfAccessed = true; + return 2; + } + } + }; + + var Con = function () { }; + Con.prototype = proto; + + var child = new Con(); + Object.defineProperty(child, "value", { + value: { + toString: function () { + toStringAccessed = true; + return 3; + } + } + }); + + Object.defineProperties(arr, { + length: child + }); + return arr.length === 3 && toStringAccessed && !valueOfAccessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-148.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-148.js new file mode 100644 index 000000000..e53d756ac --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-148.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-148 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test RangeError is thrown when the [[Value]] + field of 'desc' is positive non-integer values (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + try { + Object.defineProperties(arr, { + length: { + value: 123.5 + } + }); + + return false; + } catch (e) { + return e instanceof RangeError && arr.length === 0; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-149.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-149.js new file mode 100644 index 000000000..5bef4be46 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-149.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-149 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test RangeError is thrown when the [[Value]] + field of 'desc' is negative non-integer values (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + try { + Object.defineProperties(arr, { + length: { + value: -4294967294.5 + } + }); + return false; + } catch (e) { + return e instanceof RangeError && arr.length === 0; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-15.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-15.js new file mode 100644 index 000000000..09c6d877d --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-15.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-15 +description: > + Object.defineProperties - 'O' is a Boolean object which implements + its own [[GetOwnProperty]] method to get 'P' (8.12.9 step 1 ) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = new Boolean(false); + + Object.defineProperty(obj, "prop", { + value: 11, + configurable: false + }); + + try { + Object.defineProperties(obj, { + prop: { + value: 12, + configurable: true + } + }); + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(obj, "prop", 11, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-150.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-150.js new file mode 100644 index 000000000..7ddfb6829 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-150.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-150 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is boundary + value 2^32 - 2 (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperties(arr, { + length: { + value: 4294967294 + } + }); + + return arr.length === 4294967294; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-151.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-151.js new file mode 100644 index 000000000..7070c47b1 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-151.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-151 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is boundary + value 2^32 - 1 (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperties(arr, { + length: { + value: 4294967295 + } + }); + + return arr.length === 4294967295; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-152.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-152.js new file mode 100644 index 000000000..076fc9286 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-152.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-152 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test RangeError is thrown when the [[Value]] + field of 'desc' is boundary value 2^32 (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + try { + Object.defineProperties(arr, { + length: { + value: 4294967296 + } + }); + return false; + } catch (e) { + return e instanceof RangeError && arr.length === 0; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-153.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-153.js new file mode 100644 index 000000000..88875433f --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-153.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-153 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test RangeError is thrown when the [[Value]] + field of 'desc' is boundary value 2^32 + 1 (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + try { + Object.defineProperties(arr, { + length: { + value: 4294967297 + } + }); + return false; + } catch (e) { + return e instanceof RangeError && arr.length === 0; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-155.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-155.js new file mode 100644 index 000000000..7aea9dad2 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-155.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-155 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', test the [[Value]] field of 'desc' which is + greater than value of the length property is defined into 'O' + without deleting any property with large index named (15.4.5.1 + step 3.f) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, , 2]; + + try { + Object.defineProperties(arr, { + length: { + value: 5 + } + }); + + return arr.length === 5 && arr[0] === 0 && !arr.hasOwnProperty("1") && arr[2] === 2; + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-156.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-156.js new file mode 100644 index 000000000..f2a2a5ef8 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-156.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-156 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', test the [[Value]] field of 'desc' which equals + to value of the length property is defined into 'O' without + deleting any property with large index named (15.4.5.1 step 3.f) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, , 2]; + try { + Object.defineProperties(arr, { + length: { + value: 3 + } + }); + + return arr.length === 3 && arr[0] === 0 && !arr.hasOwnProperty("1") && arr[2] === 2; + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-157.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-157.js new file mode 100644 index 000000000..ebd0878f8 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-157.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-157 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', test the [[Value]] field of 'desc' which is less + than value of the length property is defined into 'O' with + deleting properties with large index named (15.4.5.1 step 3.f) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, 1]; + + Object.defineProperties(arr, { + length: { + value: 1 + } + }); + return arr.length === 1 && !arr.hasOwnProperty("1") && arr[0] === 0; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-158.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-158.js new file mode 100644 index 000000000..4f406fe7e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-158.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-158 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is greater than + value of the length property, test TypeError is thrown when the + length property is not writable (15.4.5.1 step 3.f.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperty(arr, "length", { + writable: false + }); + + try { + Object.defineProperties(arr, { + length: { + value: 12 + } + }); + + return false; + } catch (e) { + return e instanceof TypeError && arr.length === 0; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-159.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-159.js new file mode 100644 index 000000000..ad39dbb14 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-159.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-159 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' equals to value of + the length property, test TypeError wouldn't be thrown when the + length property is not writable (15.4.5.1 step 3.f.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperty(arr, "length", { + writable: false + }); + + try { + Object.defineProperties(arr, { + length: { + value: 0 + } + }); + return true && arr.length === 0; + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-16.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-16.js new file mode 100644 index 000000000..47ec1565c --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-16.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-16 +description: > + Object.defineProperties - 'O' is a Number object which implements + its own [[GetOwnProperty]] method to get 'P' (8.12.9 step 1 ) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = new Number(-9); + + Object.defineProperty(obj, "prop", { + value: 11, + configurable: false + }); + + try { + Object.defineProperties(obj, { + prop: { + value: 12, + configurable: true + } + }); + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(obj, "prop", 11, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-160.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-160.js new file mode 100644 index 000000000..d08efeebc --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-160.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-160 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test TypeError is thrown when the + [[Writable]] attribute of the length property is false (15.4.5.1 + step 3.g) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, 1]; + + Object.defineProperty(arr, "length", { + writable: false + }); + + try { + Object.defineProperties(arr, { + length: { + value: 0 + } + }); + return false; + } catch (e) { + return e instanceof TypeError && arr.length === 2 && arr[0] === 0 && arr[1] === 1; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-161.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-161.js new file mode 100644 index 000000000..4b30d9288 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-161.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-161 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Writable]] attribute of the + length property is set to true at last after deleting properties + with large index named if the [[Writable]] field of 'desc' is + absent (15.4.5.1 step 3.h) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, 1]; + + Object.defineProperties(arr, { + length: { + value: 1 + } + }); + + arr.length = 10; //try to overwrite length value of arr + return !arr.hasOwnProperty("1") && arr.length === 10 && arr[0] === 0; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-162.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-162.js new file mode 100644 index 000000000..82f939a52 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-162.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-162 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Writable]] attribute of the + length property is set to true at last after deleting properties + with large index named if the [[Writable]] field of 'desc' is true + (15.4.5.1 step 3.h) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, 1]; + + Object.defineProperties(arr, { + length: { + value: 1, + writable: true + } + }); + + arr.length = 10; //try to overwrite length value of arr + return !arr.hasOwnProperty("1") && arr.length === 10 && arr[0] === 0; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-163.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-163.js new file mode 100644 index 000000000..de3c9f8e6 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-163.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-163 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Writable]] attribute of the + length property is set to false at last after deleting properties + with large index named if the [[Writable]] field of 'desc' is + false (15.4.5.1 step 3.i.ii) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, 1]; + + Object.defineProperties(arr, { + length: { + value: 1, + writable: false + } + }); + + arr.length = 10; //try to overwrite length value of arr + return !arr.hasOwnProperty("1") && arr.length === 1 && arr[0] === 0; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-164.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-164.js new file mode 100644 index 000000000..b88842d5e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-164.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-164 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Writable]] attribute of the + length property in 'O' is set as true before deleting properties + with large index named (15.4.5.1 step 3.i.iii) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, 1, 2]; + var result = 0; + + try { + Object.defineProperty(arr, "1", { + configurable: false + }); + + Object.defineProperties(arr, { + length: { + value: 0, + writable: false + } + }); + + return false; + } catch (e) { + result = (arr.length === 2); + arr.length = 10; + return (e instanceof TypeError) && result && arr.length === 2; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-165.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-165.js new file mode 100644 index 000000000..365358cfa --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-165.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-165 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the length property is decreased by + 1 (15.4.5.1 step 3.l.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, 1, 2]; + + Object.defineProperty(arr, "1", { + configurable: false + }); + + Object.defineProperty(arr, "2", { + configurable: true + }); + + try { + Object.defineProperties(arr, { + length: { + value: 1 + } + }); + return false; + } catch (e) { + return e instanceof TypeError && arr.length === 2 && + !arr.hasOwnProperty("2") && arr[0] === 0 && arr[1] === 1; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-166.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-166.js new file mode 100644 index 000000000..54049f7dc --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-166.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-166 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Configurable]] attribute of + own data property with large index named in 'O' can stop deleting + index named properties (15.4.5.1 step 3.l.ii) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, 1]; + + try { + Object.defineProperty(arr, "1", { + configurable: false + }); + + Object.defineProperties(arr, { + length: { + value: 1 + } + }); + + return false; + } catch (e) { + return (e instanceof TypeError) && arr.length === 2 && + arr.hasOwnProperty("1") && arr[0] === 0 && arr[1] === 1; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-167.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-167.js new file mode 100644 index 000000000..426f6a714 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-167.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-167 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Configurable]] attribute of + inherited data property with large index named in 'O' can't stop + deleting index named properties (15.4.5.1 step 3.l.ii) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, 1]; + try { + Array.prototype[1] = 2; //we are not allowed to set the [[Configurable]] attribute of property "1" to false here, since Array.prototype is a global object, and non-configurbale property can't revert to configurable + + Object.defineProperties(arr, { + length: { + value: 1 + } + }); + + return arr.length === 1 && !arr.hasOwnProperty("1") && arr[0] === 0 && Array.prototype[1] === 2; + } finally { + delete Array.prototype[1]; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-168.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-168.js new file mode 100644 index 000000000..9524eb81a --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-168.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-168 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Configurable]] attribute of + own data property with large index named in 'O' that overrides + inherited data property can stop deleting index named properties + (15.4.5.1 step 3.l.ii) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, 1]; + try { + Object.defineProperty(arr, "1", { + configurable: false + }); + + Array.prototype[1] = 2; + + Object.defineProperties(arr, { + length: { + value: 1 + } + }); + return false; + } catch (e) { + return e instanceof TypeError && arr.length === 2 && + arr.hasOwnProperty("1") && arr[0] === 0 && arr[1] === 1; + } finally { + delete Array.prototype[1]; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-169.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-169.js new file mode 100644 index 000000000..fed0e218e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-169.js @@ -0,0 +1,48 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-169 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Configurable]] attribute of + own data property with large index named in 'O' that overrides + inherited accessor property can stop deleting index named + properties (15.4.5.1 step 3.l.ii) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, 1]; + try { + Object.defineProperty(arr, "1", { + configurable: false + }); + + Object.defineProperty(Array.prototype, "1", { + get: function () { + return 2; + }, + configurable: true + }); + + Object.defineProperties(arr, { + length: { + value: 1 + } + }); + + return false; + } catch (e) { + return e instanceof TypeError && arr.length === 2 && arr.hasOwnProperty("1") && + arr[0] === 0 && arr[1] === 1 && Array.prototype[1] === 2; + } finally { + delete Array.prototype[1]; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-17.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-17.js new file mode 100644 index 000000000..8a6603c89 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-17.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-17 +description: > + Object.defineProperties - 'O' is the Math object which implements + its own [[GetOwnProperty]] method to get 'P' (8.12.9 step 1 ) +includes: [runTestCase.js] +---*/ + +function testcase() { + + try { + Object.defineProperty(Math, "prop", { + value: 11, + writable: true, + configurable: true + }); + var hasProperty = Math.hasOwnProperty("prop") && Math.prop === 11; + + Object.defineProperties(Math, { + prop: { + value: 12 + } + }); + return hasProperty && Math.prop === 12; + } finally { + delete Math.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-170.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-170.js new file mode 100644 index 000000000..e15ed1ef5 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-170.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-170 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Configurable]] attribute of + own accessor property with large index named in 'O' can stop + deleting index named properties (15.4.5.1 step 3.l.ii) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, 1]; + + try { + Object.defineProperty(arr, "1", { + get: function () { + return 1; + }, + configurable: false + }); + + Object.defineProperties(arr, { + length: { + value: 1 + } + }); + + return false; + } catch (e) { + return (e instanceof TypeError) && arr.length === 2 && + arr.hasOwnProperty("1") && arr[0] === 0 && arr[1] === 1; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-171.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-171.js new file mode 100644 index 000000000..4f7c446a8 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-171.js @@ -0,0 +1,40 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-171 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Configurable]] attribute of + inherited accessor property with large index named in 'O' can't + stop deleting index named properties (15.4.5.1 step 3.l.ii) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, 1]; + try { + Object.defineProperty(Array.prototype, "1", { + get: function () { + return 1; + }, + configurable: true //we are not allowed to set the [[Configurable]] attribute of property "1" to false here, since Array.prototype is a global object, and non-configurbale property can't revert to configurable + }); + + Object.defineProperties(arr, { + length: { + value: 1 + } + }); + + return arr.length === 1 && !arr.hasOwnProperty("1") && arr[0] === 0 && Array.prototype[1] === 1; + } finally { + delete Array.prototype[1]; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-172.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-172.js new file mode 100644 index 000000000..1702466bd --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-172.js @@ -0,0 +1,45 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-172 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Configurable]] attribute of + own accessor property with large index named in 'O' that overrides + inherited data property can stop deleting index named properties + (15.4.5.1 step 3.l.ii) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, 1]; + try { + Object.defineProperty(arr, "1", { + get: function () { + return 2; + }, + configurable: false + }); + + Array.prototype[1] = 3; + + Object.defineProperties(arr, { + length: { + value: 1 + } + }); + return false; + } catch (e) { + return e instanceof TypeError && arr.length === 2 && + arr.hasOwnProperty("1") && arr[0] === 0 && arr[1] === 2; + } finally { + delete Array.prototype[1]; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-173.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-173.js new file mode 100644 index 000000000..7fea4bc59 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-173.js @@ -0,0 +1,50 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-173 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Configurable]] attribute of + own accessor property with large index named in 'O' that overrides + inherited accessor property can stop deleting index named + properties (15.4.5.1 step 3.l.ii) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, 1]; + try { + Object.defineProperty(arr, "1", { + get: function () { + return 1; + }, + configurable: false + }); + + Object.defineProperty(Array.prototype, "1", { + get: function () { + return 2; + }, + configurable: true + }); + + Object.defineProperties(arr, { + length: { + value: 1 + } + }); + return false; + } catch (e) { + return e instanceof TypeError && arr.length === 2 && arr.hasOwnProperty("1") && + arr[0] === 0 && arr[1] === 1 && Array.prototype[1] === 2; + } finally { + delete Array.prototype[1]; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-174.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-174.js new file mode 100644 index 000000000..6a64e5d7a --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-174.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-174 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the configurable large index named + property of 'O' can be deleted (15.4.5.1 step 3.l.ii) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, 1]; + + Object.defineProperties(arr, { + length: { + value: 1 + } + }); + + return !arr.hasOwnProperty("1"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-175.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-175.js new file mode 100644 index 000000000..b84b2f86b --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-175.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-175 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test value of the length property is set + to the last non-configurable index named property of 'O' plus 1 + (15.4.5.1 step 3.l.iii.1) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, 1, 2, 3]; + + Object.defineProperty(arr, "1", { + configurable: false + }); + + try { + Object.defineProperties(arr, { + length: { + value: 1 + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && (arr.length === 2); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-176.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-176.js new file mode 100644 index 000000000..2dcebe5c5 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-176.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-176 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Writable]] attribute of the + length property is set to false at last when the [[Writable]] + field of 'desc' is false and 'O' contains non-configurable large + index named property (15.4.5.1 step 3.l.iii.2) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, 1]; + + try { + Object.defineProperty(arr, "1", { + configurable: false + }); + + Object.defineProperties(arr, { + length: { + value: 1, + writable: false + } + }); + return false; + } catch (e) { + arr.length = 10; //try to overwrite length value of arr + return e instanceof TypeError && arr.hasOwnProperty("1") && + arr.length === 2 && arr[0] === 0 && arr[1] === 1; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-177.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-177.js new file mode 100644 index 000000000..0fe59a849 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-177.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-177 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Writable]] attribute of the + length property is set to false at last when the [[Writable]] + field of 'desc' is false and 'O' doesn't contain non-configurable + large index named property (15.4.5.1 step 3.m) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0, 1]; + + try { + Object.defineProperties(arr, { + length: { + value: 0, + writable: false + } + }); + + arr.length = 10; //try to overwrite length value of arr + return !arr.hasOwnProperty("1") && arr.length === 0 && !arr.hasOwnProperty("0"); + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-178.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-178.js new file mode 100644 index 000000000..8ddede34b --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-178.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-178 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' is available String values that convert to + numbers (15.4.5.1 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = [0]; + + Object.defineProperties(arr, { + "0": { + value: 12 + } + }); + return arr[0] === 12; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-179.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-179.js new file mode 100644 index 000000000..783d69a24 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-179.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-179 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' is boundary value 2^32 - 2 (15.4.5.1 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arr = []; + + Object.defineProperties(arr, { + "4294967294": { + value: 100 + } + }); + + return arr.hasOwnProperty("4294967294") && arr.length === 4294967295 && arr[4294967294] === 100; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-18.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-18.js new file mode 100644 index 000000000..f645b3f8d --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-18.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-18 +description: > + Object.defineProperties - 'O' is a Date object which implements + its own [[GetOwnProperty]] method to get 'P' (8.12.9 step 1 ) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = new Date(); + + Object.defineProperty(obj, "prop", { + value: 11, + configurable: false + }); + + try { + Object.defineProperties(obj, { + prop: { + value: 12, + configurable: true + } + }); + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(obj, "prop", 11, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-180.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-180.js new file mode 100644 index 000000000..812991be4 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-180.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-180 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' is boundary value 2^32 - 1 (15.4.5.1 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arr = []; + + Object.defineProperties(arr, { + "4294967295": { + value: 100 + } + }); + + return arr.hasOwnProperty("4294967295") && arr.length === 0 && arr[4294967295] === 100; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-181.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-181.js new file mode 100644 index 000000000..60047b776 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-181.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-181 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' is boundary value 2^32 (15.4.5.1 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arr = []; + + Object.defineProperties(arr, { + "4294967296": { + value: 100 + } + }); + + return arr.hasOwnProperty("4294967296") && arr.length === 0 && arr[4294967296] === 100; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-182.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-182.js new file mode 100644 index 000000000..f7457f09c --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-182.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-182 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' is boundary value 2^32 + 1 (15.4.5.1 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arr = []; + + Object.defineProperties(arr, { + "4294967297": { + value: 100 + } + }); + + return arr.hasOwnProperty("4294967297") && arr.length === 0 && arr[4294967297] === 100; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-183.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-183.js new file mode 100644 index 000000000..e8df1fe06 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-183.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-183 +description: > + Object.defineProperties - TypeError is not thrown if 'O' is an + Array, 'P' is an array index named property, [[Writable]] + attribute of the length property in 'O' is false, value of 'P' is + less than value of the length property in'O' (15.4.5.1 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arr = [1, 2, 3]; + + Object.defineProperty(arr, "length", { + writable: false + }); + + Object.defineProperties(arr, { + "1": { + value: "abc" + } + }); + + return arr[0] === 1 && arr[1] === "abc" && arr[2] === 3; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-184.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-184.js new file mode 100644 index 000000000..58824dfc4 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-184.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-184 +description: > + Object.defineProperties - TypeError is thrown if 'O' is an Array, + 'P' is an array index named property,[[Writable]] attribute of the + length property in 'O' is false, value of 'P' is equal to value of + the length property in 'O' (15.4.5.1 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arr = [1, 2, 3]; + + Object.defineProperty(arr, "length", { + writable: false + }); + + try { + Object.defineProperties(arr, { + "3": { + value: "abc" + } + }); + + return false; + } catch (e) { + return e instanceof TypeError && arr[0] === 1 && + arr[1] === 2 && arr[2] === 3 && !arr.hasOwnProperty("3"); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-185.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-185.js new file mode 100644 index 000000000..87423daf5 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-185.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-185 +description: > + Object.defineProperties - TypeError is thrown if 'O' is an Array, + 'P' is an array index named property,[[Writable]] attribute of the + length property in 'O' is false, value of 'P' is bigger than value + of the length property in 'O' (15.4.5.1 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arr = [1, 2, 3]; + + Object.defineProperty(arr, "length", { + writable: false + }); + + try { + Object.defineProperties(arr, { + "4": { + value: "abc" + } + }); + + return false; + } catch (e) { + return e instanceof TypeError && arr[0] === 1 && arr[1] === 2 && + arr[2] === 3 && !arr.hasOwnProperty("3") && !arr.hasOwnProperty("4"); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-186.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-186.js new file mode 100644 index 000000000..f4877449d --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-186.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-186 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' is own data property (15.4.5.1 step 4.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arr = []; + Object.defineProperty(arr, 0, { + value: "ownDataProperty", + configurable: false + }); + + try { + Object.defineProperties(arr, { + "0": { + value: "abc", + configurable: true + } + }); + return false; + } catch (e) { + return e instanceof TypeError && arr[0] === "ownDataProperty"; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-187.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-187.js new file mode 100644 index 000000000..cf45cbe65 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-187.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-187 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' is inherited data property (15.4.5.1 step 4.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + try { + Object.defineProperty(Array.prototype, "0", { + value: 11, + configurable: true + }); + + var arr = []; + + Object.defineProperties(arr, { + "0": { + configurable: false + } + }); + return arr.hasOwnProperty("0") && typeof arr[0] === "undefined" && Array.prototype[0] === 11; + } finally { + delete Array.prototype[0]; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-188.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-188.js new file mode 100644 index 000000000..d35c05d0e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-188.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-188 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' is own data property that overrides an + inherited data property (15.4.5.1 step 4.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + try { + Object.defineProperty(Array.prototype, "0", { + value: 11, + configurable: true + }); + + var arr = []; + Object.defineProperty(arr, "0", { + value: 12, + configurable: false + }); + + Object.defineProperties(arr, { + "0": { + configurable: true + } + }); + return false; + } catch (e) { + return e instanceof TypeError && arr[0] === 12 && Array.prototype[0] === 11; + } finally { + delete Array.prototype[0]; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-189.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-189.js new file mode 100644 index 000000000..54d1574ba --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-189.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-189 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' is own data property that overrides an + inherited accessor property (15.4.5.1 step 4.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + try { + Object.defineProperty(Array.prototype, "0", { + get: function () { + return 11; + }, + configurable: true + }); + + var arr = []; + Object.defineProperty(arr, "0", { + value: 12, + configurable: false + }); + + Object.defineProperties(arr, { + "0": { + configurable: true + } + }); + return false; + } catch (e) { + return e instanceof TypeError && arr[0] === 12 && Array.prototype[0] === 11; + } finally { + delete Array.prototype[0]; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-19.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-19.js new file mode 100644 index 000000000..d6251e983 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-19.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-19 +description: > + Object.defineProperties - 'O' is a RegExp object which implements + its own [[GetOwnProperty]] method to get 'P' (8.12.9 step 1 ) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = new RegExp(); + + Object.defineProperty(obj, "prop", { + value: 11, + configurable: false + }); + + try { + Object.defineProperties(obj, { + prop: { + value: 12, + configurable: true + } + }); + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(obj, "prop", 11, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-190.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-190.js new file mode 100644 index 000000000..714dd6445 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-190.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-190 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' is own accessor property (15.4.5.1 step 4.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arr = []; + + Object.defineProperty(arr, "0", { + get: function () { + return 11; + }, + configurable: false + }); + + try { + Object.defineProperties(arr, { + "0": { + get: function () { + return 12; + }, + configurable: true + } + }); + return false; + } catch (e) { + return e instanceof TypeError && arr[0] === 11; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-191.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-191.js new file mode 100644 index 000000000..9c4292a13 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-191.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-191 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property, 'P' is inherited accessor property (15.4.5.1 step 4.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + try { + Object.defineProperty(Array.prototype, "0", { + get: function () { + return 11; + }, + configurable: true + }); + + var arr = []; + + Object.defineProperties(arr, { + "0": { + get: function () { + return 12; + }, + configurable: false + } + }); + return arr.hasOwnProperty("0") && arr[0] === 12 && Array.prototype[0] === 11; + } finally { + delete Array.prototype[0]; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-192.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-192.js new file mode 100644 index 000000000..71d5dd9e4 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-192.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-192 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' is own accessor property that overrides an + inherited data property (15.4.5.1 step 4.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + try { + Object.defineProperty(Array.prototype, "0", { + value: 11, + configurable: true + }); + + var arr = []; + Object.defineProperty(arr, "0", { + get: function () { + return 12; + }, + configurable: false + }); + + Object.defineProperties(arr, { + "0": { + configurable: true + } + }); + return false; + } catch (e) { + return e instanceof TypeError && arr[0] === 12 && Array.prototype[0] === 11; + } finally { + delete Array.prototype[0]; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-193.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-193.js new file mode 100644 index 000000000..1c97e586a --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-193.js @@ -0,0 +1,45 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-193 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' is own accessor property that overrides an + inherited accessor property (15.4.5.1 step 4.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + try { + Object.defineProperty(Array.prototype, "0", { + get: function () { + return 11; + }, + configurable: true + }); + + var arr = []; + Object.defineProperty(arr, "0", { + get: function () { + return 12; + }, + configurable: false + }); + + Object.defineProperties(arr, { + "0": { + configurable: true + } + }); + return false; + } catch (e) { + return e instanceof TypeError && arr[0] === 12 && Array.prototype[0] === 11; + } finally { + delete Array.prototype[0]; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-194.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-194.js new file mode 100644 index 000000000..69ebd5f23 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-194.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-194 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' property doesn't exist in 'O', test TypeError + is thrown when 'O' is not extensible (15.4.5.1 step 4.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arr = []; + Object.preventExtensions(arr); + + try { + Object.defineProperties(arr, { + "0": { + value: 1 + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && (arr.hasOwnProperty("0") === false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-195.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-195.js new file mode 100644 index 000000000..6bd51acb3 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-195.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-195 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' property doesn't exist in 'O', test 'P' is + defined as data property when 'desc' is generic descriptor + (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + Object.defineProperties(arr, { + "0": { + enumerable: true + } + }); + + return dataPropertyAttributesAreCorrect(arr, "0", undefined, false, true, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-196.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-196.js new file mode 100644 index 000000000..deefffca2 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-196.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-196 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' property doesn't exist in 'O', test [[Value]] + of 'P' property in 'Attributes' is set as undefined value if + [[Value]] is absent in data descriptor 'desc' (15.4.5.1 step 4.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arr = []; + + Object.defineProperties(arr, { + "0": { + writable: true, + enumerable: true, + configurable: false + } + }); + + return arr.hasOwnProperty("0") && typeof (arr[0]) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-197.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-197.js new file mode 100644 index 000000000..1303906dc --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-197.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-197 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' property doesn't exist in 'O', test + [[Writable]] of 'P' property in 'Attributes' is set as false value + if [[Writable]] is absent in data descriptor 'desc' (15.4.5.1 + step 4.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arr = []; + var isOwnProperty = false; + var canWritable = false; + + Object.defineProperties(arr, { + "0": { + value: 1001, + enumerable: true, + configurable: false + } + }); + + isOwnProperty = arr.hasOwnProperty("0"); + + arr[0] = 12; + + canWritable = (arr[0] === 12); + + return isOwnProperty && !canWritable && arr[0] === 1001; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-198.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-198.js new file mode 100644 index 000000000..d79db26a7 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-198.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-198 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' property doesn't exist in 'O', test + [[Enumerable]] of 'P' property in 'Attributes' is set as false + value if [[Enumerable]] is absent in data descriptor 'desc' + (15.4.5.1 step 4.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arr = []; + var isOwnProperty = false; + var canEnumerable = false; + + Object.defineProperties(arr, { + "0": { + value: 1001, + writable: true, + configurable: true + } + }); + + isOwnProperty = arr.hasOwnProperty("0"); + for (var i in arr) { + if (i === "0") { + canEnumerable = true; + } + } + return isOwnProperty && !canEnumerable && arr[0] === 1001; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-199.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-199.js new file mode 100644 index 000000000..e2b155f59 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-199.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-199 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' property doesn't exist in 'O', test + [[Configurable]] of 'P' property in 'Attributes' is set as false + value if [[Configurable]] is absent in data descriptor 'desc' + (15.4.5.1 step 4.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arr = []; + var beforeDeleted = false; + var afterDeleted = false; + + Object.defineProperties(arr, { + "0": { + value: 1001, + writable: true, + enumerable: true + } + }); + + beforeDeleted = arr.hasOwnProperty("0"); + delete arr[0]; + afterDeleted = arr.hasOwnProperty("0"); + return beforeDeleted && afterDeleted && arr[0] === 1001; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-2.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-2.js new file mode 100644 index 000000000..8622375b5 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-2.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-2 +description: > + Object.defineProperties - 'P' is inherited data property (8.12.9 + step 1 ) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var proto = {}; + Object.defineProperty(proto, "prop", { + value: 11, + configurable: false + }); + var Con = function () { }; + Con.prototype = proto; + + var obj = new Con(); + + Object.defineProperties(obj, { + prop: { + value: 12, + configurable: true + } + }); + + return dataPropertyAttributesAreCorrect(obj, "prop", 12, false, false, true); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-20.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-20.js new file mode 100644 index 000000000..fea6bec61 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-20.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-20 +description: > + Object.defineProperties - 'O' is a JSON object which implements + its own [[GetOwnProperty]] method to get 'P' (8.12.9 step 1 ) +includes: [runTestCase.js] +---*/ + +function testcase() { + + try { + Object.defineProperty(JSON, "prop", { + value: 11, + writable: true, + configurable: true + }); + var hasProperty = JSON.hasOwnProperty("prop") && JSON.prop === 11; + Object.defineProperties(JSON, { + prop: { + value: 12 + } + }); + return hasProperty && JSON.prop === 12; + } finally { + delete JSON.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-200.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-200.js new file mode 100644 index 000000000..63bcb0544 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-200.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-200 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'desc' is data descriptor, test updating all + attribute values of 'P' (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = [1]; // default value of attributes: writable: true, configurable: true, enumerable: true + + Object.defineProperties(arr, { + "0": { + value: 1001, + writable: false, + enumerable: false, + configurable: false + } + }); + + return dataPropertyAttributesAreCorrect(arr, "0", 1001, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-201.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-201.js new file mode 100644 index 000000000..5bda1f8d4 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-201.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-201 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' property doesn't exist in 'O', test [[Get]] of + 'P' property in 'Attributes' is set as undefined value if [[Get]] + is absent in accessor descriptor 'desc' (15.4.5.1 step 4.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arr = []; + + Object.defineProperties(arr, { + "0": { + set: function () { }, + enumerable: true, + configurable: true + } + }); + + return arr.hasOwnProperty("0") && typeof (arr[0]) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-202.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-202.js new file mode 100644 index 000000000..55734c44e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-202.js @@ -0,0 +1,48 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-202 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' property doesn't exist in 'O', test [[Set]] of + 'P' property in 'Attributes' is set as undefined value if [[Set]] + is absent in accessor descriptor 'desc' (15.4.5.1 step 4.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arr = []; + var getFunc = function () { + return 11; + }; + + Object.defineProperties(arr, { + "0": { + get: getFunc, + enumerable: true, + configurable: true + } + }); + + var verifyEnumerable = false; + for (var i in arr) { + if (i === "0" && arr.hasOwnProperty("0")) { + verifyEnumerable = true; + } + } + + var desc = Object.getOwnPropertyDescriptor(arr, "0"); + var propertyDefineCorrect = arr.hasOwnProperty("0"); + + var verifyConfigurable = false; + delete arr[0]; + verifyConfigurable = arr.hasOwnProperty("0"); + return typeof desc.set === "undefined" && propertyDefineCorrect && + desc.get === getFunc && !verifyConfigurable && verifyEnumerable; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-203.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-203.js new file mode 100644 index 000000000..a9f1f97dd --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-203.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-203 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' property doesn't exist in 'O', test + [[Enumerable]] of 'P' property in 'Attributes' is set as false + value if [[Enumerable]] is absent in accessor descriptor 'desc' + (15.4.5.1 step 4.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arr = []; + + Object.defineProperties(arr, { + "0": { + set: function () { }, + get: function () { }, + configurable: true + } + }); + + for (var i in arr) { + if (i === "0" && arr.hasOwnProperty("0")) { + return false; + } + } + return true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-204.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-204.js new file mode 100644 index 000000000..54b0004f0 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-204.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-204 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' property doesn't exist in 'O', test + [[Configurable]] of 'P' property in 'Attributes' is set as false + value if [[Configurable]] is absent in accessor descriptor 'desc' + (15.4.5.1 step 4.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arr = []; + var beforeDeleted = false; + var afterDeleted = false; + arr.verifySetter = 100; + + Object.defineProperties(arr, { + "0": { + set: function (value) { + arr.verifySetter = value; + }, + get: function () { + return arr.verifySetter; + }, + enumerable: true + } + }); + + beforeDeleted = arr.hasOwnProperty("0"); + delete arr[0]; + afterDeleted = arr.hasOwnProperty("0"); + + arr[0] = 101; + + return beforeDeleted && afterDeleted && arr[0] === 101 && arr.verifySetter === 101; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-205.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-205.js new file mode 100644 index 000000000..8fa5be67a --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-205.js @@ -0,0 +1,49 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-205 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'desc' is accessor descriptor, test updating all + attribute values of 'P' (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + Object.defineProperties(arr, { + "0": { + get: function () { + return 11; + }, + set: function () { }, + configurable: true, + enumerable: true + } + }); + + var setFun = function (value) { + arr.setVerifyHelpProp = value; + }; + var getFun = function () { + return 14; + }; + Object.defineProperties(arr, { + "0": { + get: getFun, + set: setFun, + configurable: false, + enumerable: false + } + }); + + return accessorPropertyAttributesAreCorrect(arr, "0", getFun, setFun, "setVerifyHelpProp", false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-206.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-206.js new file mode 100644 index 000000000..150ed4111 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-206.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-206 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' makes no change if every field in 'desc' is + absent (name is data property) (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + arr[0] = 101; // default value of attributes: writable: true, configurable: true, enumerable: true + + try { + Object.defineProperties(arr, { + "0": {} + }); + return dataPropertyAttributesAreCorrect(arr, "0", 101, true, true, true); + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-207.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-207.js new file mode 100644 index 000000000..406e09285 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-207.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-207 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' makes no change if every field in 'desc' is + absent (name is accessor property) (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + function get_func() { + return 11; + } + function set_func(value) { + arr.setVerifyHelpProp = value; + } + + Object.defineProperty(arr, "0", { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + }); + + try { + Object.defineProperties(arr, { + "0": {} + }); + return accessorPropertyAttributesAreCorrect(arr, "0", get_func, set_func, "setVerifyHelpProp", true, true); + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-208.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-208.js new file mode 100644 index 000000000..a0bc75abc --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-208.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-208 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' makes no change if the value of every field in + 'desc' is the same value as the corresponding field in 'P'(desc is + data property) (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + arr[0] = 100; // default value of attributes: writable: true, configurable: true, enumerable: true + + Object.defineProperties(arr, { + "0": { + value: 100, + writable: true, + enumerable: true, + configurable: true + } + }); + + return dataPropertyAttributesAreCorrect(arr, "0", 100, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-209.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-209.js new file mode 100644 index 000000000..5ba2fa5dd --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-209.js @@ -0,0 +1,45 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-209 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' makes no change if the value of every field in + 'desc' is the same value as the corresponding field in 'P'(desc is + accessor property) (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + var get_func = function () { + return "100"; + }; + var set_func = function (value) { + arr.setVerifyHelpProp = value; + }; + + var descObj = { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + }; + + var properties = { + "0": descObj + }; + + Object.defineProperty(arr, "0", descObj); + + Object.defineProperties(arr, properties); + + return accessorPropertyAttributesAreCorrect(arr, "0", get_func, set_func, "setVerifyHelpProp", true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-21.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-21.js new file mode 100644 index 000000000..d87892727 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-21.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-21 +description: > + Object.defineProperties - 'O' is an Error object which implements + its own [[GetOwnProperty]] method to get 'P' (8.12.9 step 1 ) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = new Error(); + + Object.defineProperty(obj, "prop", { + value: 11, + configurable: false + }); + + try { + Object.defineProperties(obj, { + prop: { + value: 12, + configurable: true + } + }); + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(obj, "prop", 11, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-210.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-210.js new file mode 100644 index 000000000..a3ae0fcab --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-210.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-210 +description: > + Object.defineProperties - 'O' is an Array, 'name' is an array + index property, both the [[Value]] field of 'desc' and the + [[Value]] attribute value of 'name' are undefined (15.4.5.1 step + 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + Object.defineProperty(arr, "0", { + value: undefined + }); + + Object.defineProperties(arr, { + "0": { + value: undefined + } + }); + return dataPropertyAttributesAreCorrect(arr, "0", undefined, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-211.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-211.js new file mode 100644 index 000000000..e732b47ac --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-211.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-211 +description: > + Object.defineProperties - 'O' is an Array, 'name' is an array + index property, both the [[Value]] field of 'desc' and the + [[Value]] attribute value of 'name' are null (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + Object.defineProperty(arr, "0", { + value: null + }); + + Object.defineProperties(arr, { + "0": { + value: null + } + }); + return dataPropertyAttributesAreCorrect(arr, "0", null, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-212.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-212.js new file mode 100644 index 000000000..9bec4223e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-212.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-212 +description: > + Object.defineProperties - 'O' is an Array, 'name' is an array + index property, both the [[Value]] field of 'desc' and the + [[Value]] attribute value of 'name' are NaN (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + Object.defineProperty(arr, "0", { + value: NaN + }); + + Object.defineProperties(arr, { + "0": { + value: NaN + } + }); + + return dataPropertyAttributesAreCorrect(arr, "0", NaN, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-213.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-213.js new file mode 100644 index 000000000..23b3b1ff0 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-213.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-213 +description: > + Object.defineProperties - 'O' is an Array, 'name' is an array + index property, the [[Value]] field of 'desc' is +0, and the + [[Value]] attribute value of 'name' is -0 (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + Object.defineProperty(arr, "0", { + value: -0 + }); + + try { + Object.defineProperties(arr, { + "0": { + value: +0 + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && dataPropertyAttributesAreCorrect(arr, "0", -0, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-214.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-214.js new file mode 100644 index 000000000..f6c82c521 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-214.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-214 +description: > + Object.defineProperties - 'O' is an Array, 'name' is an array + index property, the [[Value]] field of 'desc' is -0, and the + [[Value]] attribute value of 'name' is +0 (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + Object.defineProperty(arr, "0", { + value: +0 + }); + + try { + Object.defineProperties(arr, { + "0": { + value: -0 + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && dataPropertyAttributesAreCorrect(arr, "0", +0, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-215.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-215.js new file mode 100644 index 000000000..84b491581 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-215.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-215 +description: > + Object.defineProperties - 'O' is an Array, 'name' is an array + index property, the [[Value]] field of 'desc' and the [[Value]] + attribute value of 'name' are two numbers with same vaule + (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + Object.defineProperty(arr, "0", { + value: 101 + }); + + try { + Object.defineProperties(arr, { + "0": { + value: 101 + } + }); + return dataPropertyAttributesAreCorrect(arr, "0", 101, false, false, false); + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-216.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-216.js new file mode 100644 index 000000000..d31ab7a42 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-216.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-216 +description: > + Object.defineProperties - 'O' is an Array, 'name' is an array + index property, the [[Value]] field of 'desc' and the [[Value]] + attribute value of 'name' are two strings which have same length + and same characters in corresponding positions (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + Object.defineProperty(arr, "0", { + value: "abcd" + }); + + try { + Object.defineProperties(arr, { + "0": { + value: "abcd" + } + }); + return dataPropertyAttributesAreCorrect(arr, "0", "abcd", false, false, false); + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-217.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-217.js new file mode 100644 index 000000000..828b92555 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-217.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-217 +description: > + Object.defineProperties - 'O' is an Array, 'name' is an array + index property, the [[Value]] field of 'desc' and the [[Value]] + attribute value of 'name' are two booleans with same value + (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + Object.defineProperty(arr, "0", { + value: true + }); + + try { + Object.defineProperties(arr, { + "0": { + value: true + } + }); + return dataPropertyAttributesAreCorrect(arr, "0", true, false, false, false); + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-218.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-218.js new file mode 100644 index 000000000..79613d2e0 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-218.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-218 +description: > + Object.defineProperties - 'O' is an Array, 'name' is an array + index property, the [[Value]] field of 'desc' and the [[Value]] + attribute value of 'name' are two objects which refer to the same + object (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + var obj1 = { length: 10 }; + Object.defineProperty(arr, "0", { + value: obj1 + }); + + var properties = { + "0": { + value: obj1 + } + }; + try { + Object.defineProperties(arr, properties); + return dataPropertyAttributesAreCorrect(arr, "0", obj1, false, false, false); + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-219.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-219.js new file mode 100644 index 000000000..1ea718c28 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-219.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-219 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property that already exists on 'O' with [[Writable]] true, and + the [[Writable]] field of 'desc' is true (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + Object.defineProperty(arr, "0", { + writable: true + }); + + try { + Object.defineProperties(arr, { + "0": { + writable: true + } + }); + return dataPropertyAttributesAreCorrect(arr, "0", undefined, true, false, false); + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-22.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-22.js new file mode 100644 index 000000000..f4e43b93f --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-22.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-22 +description: > + Object.defineProperties - 'O' is the Arguments object which + implements its own [[GetOwnProperty]] method to get 'P' (8.12.9 + step 1 ) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arg = function () { + return arguments; + }(); + + Object.defineProperty(arg, "prop", { + value: 11, + configurable: false + }); + + try { + Object.defineProperties(arg, { + prop: { + value: 12, + configurable: true + } + }); + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-220.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-220.js new file mode 100644 index 000000000..ea67a91e2 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-220.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-220 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property that already exists on 'O' with [[Writable]] true, and + the [[Writable]] field of 'desc' is false (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + Object.defineProperty(arr, "0", { + writable: true, + configurable: true + }); + + try { + Object.defineProperties(arr, { + "0": { + writable: false + } + }); + return dataPropertyAttributesAreCorrect(arr, "0", undefined, false, false, true); + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-221.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-221.js new file mode 100644 index 000000000..63e162462 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-221.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-221 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property, the [[Get]] field of 'desc' and the [[Get]] attribute + value of 'P' are two objects which refer to the same object + (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + function get_func() { + return 10; + } + + Object.defineProperty(arr, "0", { + get: get_func + }); + + Object.defineProperties(arr, { + "0": { + get: get_func + } + }); + return accessorPropertyAttributesAreCorrect(arr, "0", get_func, undefined, undefined, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-222.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-222.js new file mode 100644 index 000000000..c982b46c1 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-222.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-222 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property, the [[Set]] field of 'desc' and the [[Set]] attribute + value of 'P' are two objects which refer to the same object + (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + function set_func(value) { + arr.setVerifyHelpProp = value; + } + + Object.defineProperty(arr, "0", { + set: set_func + }); + + try { + Object.defineProperties(arr, { + "0": { + set: set_func + } + }); + return accessorPropertyAttributesAreCorrect(arr, "0", undefined, set_func, "setVerifyHelpProp", false, false); + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-223.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-223.js new file mode 100644 index 000000000..0c587ae74 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-223.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-223 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property that already exists on 'O' with [[Enumerable]] true, the + [[Enumerable]] field of 'desc' is true (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + Object.defineProperty(arr, "0", { + enumerable: true + }); + + try { + Object.defineProperties(arr, { + "0": { + enumerable: true + } + }); + return dataPropertyAttributesAreCorrect(arr, "0", undefined, false, true, false); + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-224.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-224.js new file mode 100644 index 000000000..62274038e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-224.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-224 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property that already exists on 'O' with [[Enumerable]] true, the + [[Enumerable]] field of 'desc' is false (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + Object.defineProperty(arr, "0", { + enumerable: true, + configurable: true + }); + + try { + Object.defineProperties(arr, { + "0": { + enumerable: false + } + }); + return dataPropertyAttributesAreCorrect(arr, "0", undefined, false, false, true); + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-225.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-225.js new file mode 100644 index 000000000..a7f972595 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-225.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-225 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property that already exists on 'O' with [[Configurable]] true, + the [[Configurable]] field of 'desc' is true (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + Object.defineProperty(arr, "0", { + configurable: true + }); + + try { + Object.defineProperties(arr, { + "0": { + configurable: true + } + }); + return dataPropertyAttributesAreCorrect(arr, "0", undefined, false, false, true); + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-226.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-226.js new file mode 100644 index 000000000..f7d174a53 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-226.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-226 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property that already exists on 'O' with [[Configurable]] true, + the [[Configurable]] field of 'desc' is false (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + Object.defineProperty(arr, "0", { + configurable: true + }); + + try { + Object.defineProperties(arr, { + "0": { + configurable: false + } + }); + return dataPropertyAttributesAreCorrect(arr, "0", undefined, false, false, false); + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-227.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-227.js new file mode 100644 index 000000000..b89ee1eb8 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-227.js @@ -0,0 +1,40 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-227 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property, TypeError is thrown if the [[Configurable]] attribute + value of 'P' is false and the [[Configurable]] field of 'desc' is + true (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperty(arr, "1", { + value: 3, + configurable: false + }); + + try { + Object.defineProperties(arr, { + "1": { + value: 13, + configurable: true + } + }); + return false; + } catch (ex) { + return (ex instanceof TypeError) && dataPropertyAttributesAreCorrect(arr, "1", 3, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-228.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-228.js new file mode 100644 index 000000000..2e81f368d --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-228.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-228 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property, TypeError is thrown if the [[Configurable]] attribute + value of 'P' is false, and [[Enumerable]] of 'desc' is present and + its value is different from the [[Enumerable]] attribute value of + 'P' (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperty(arr, "1", { + value: 3, + configurable: false, + enumerable: false + + }); + + try { + Object.defineProperties(arr, { + "1": { + value: 13, + enumerable: true + } + }); + return false; + } catch (ex) { + return (ex instanceof TypeError) && dataPropertyAttributesAreCorrect(arr, "1", 3, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-229.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-229.js new file mode 100644 index 000000000..b58d7049e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-229.js @@ -0,0 +1,45 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-229 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property, TypeError is thrown if 'P' is accessor property, and + 'desc' is data descriptor, and the [[Configurable]] attribute + value of 'P' is false (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + + function set_fun(value) { + arr.setVerifyHelpProp = value; + } + + Object.defineProperty(arr, "1", { + set: set_fun, + configurable: false + + }); + + try { + Object.defineProperties(arr, { + "1": { + value: 13 + } + }); + return false; + + } catch (ex) { + return (ex instanceof TypeError) && accessorPropertyAttributesAreCorrect(arr, "1", undefined, set_fun, "setVerifyHelpProp", false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-230.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-230.js new file mode 100644 index 000000000..d242800b9 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-230.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-230 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property, TypeError is thrown if 'P' is data property, and'desc' + is accessor descriptor, and the [[Configurable]] attribute value + of 'P' is false (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperty(arr, "1", { + value: 3, + configurable: false + }); + + try { + Object.defineProperties(arr, { + "1": { + set: function () { } + } + }); + return false; + } catch (ex) { + return (ex instanceof TypeError) && dataPropertyAttributesAreCorrect(arr, "1", 3, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-231.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-231.js new file mode 100644 index 000000000..d96779415 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-231.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-231 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property, 'P' is data property and 'desc' is accessor descriptor, + and the [[Configurable]] attribute value of 'P' is true, test 'P' + is converted from data property to accessor property (15.4.5.1 + step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + arr[1] = 3; // default value of attributes: writable: true, configurable: true, enumerable: true + + function set_fun(value) { + arr.setVerifyHelpProp = value; + } + + Object.defineProperties(arr, { + "1": { + set: set_fun + } + }); + + return accessorPropertyAttributesAreCorrect(arr, "1", undefined, set_fun, "setVerifyHelpProp", true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-232.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-232.js new file mode 100644 index 000000000..f60491fb7 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-232.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-232 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property, 'P' is accessor property and 'desc' is data descriptor, + and the [[Configurable]] attribute value of 'P' is true, test 'P' + is converted from accessor property to data property (15.4.5.1 + step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + Object.defineProperty(arr, "1", { + get: function () { + return 3; + }, + configurable: true + + }); + + Object.defineProperties(arr, { + "1": { + value: 12 + } + }); + + return dataPropertyAttributesAreCorrect(arr, "1", 12, false, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-233.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-233.js new file mode 100644 index 000000000..f546ecea1 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-233.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-233 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property, 'P' is data property and 'desc' is data descriptor, and + the [[Configurable]] attribute value of 'P' is false, test + TypeError is thrown if the [[Writable]] attribute value of 'P' is + false and the [[Writable]] field of 'desc' is true. (15.4.5.1 + step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperty(arr, "1", { + configurable: false, + writable: false + + }); + + try { + Object.defineProperties(arr, { + "1": { + writable: true + } + }); + return false; + } catch (ex) { + return (ex instanceof TypeError) && dataPropertyAttributesAreCorrect(arr, "1", undefined, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-234.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-234.js new file mode 100644 index 000000000..5adafc9cc --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-234.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-234 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property, 'P' is data property and 'desc' is data descriptor, and + the [[Configurable]] attribute value of 'P' is false, test + TypeError is thrown if the [[Writable]] attribute value of 'P' is + false, and the type of the [[Value]] field of 'desc' is different + from the type of the [[Value]] attribute value of 'P' (15.4.5.1 + step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperty(arr, "1", { + value: 3, + configurable: false, + writable: false + }); + + try { + + Object.defineProperties(arr, { + "1": { + value: "abc" + } + }); + return false; + } catch (ex) { + return (ex instanceof TypeError) && dataPropertyAttributesAreCorrect(arr, "1", 3, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-235.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-235.js new file mode 100644 index 000000000..8c915439a --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-235.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-235 +description: > + Object.defineProperties - TypeError is thrown if 'O' is an Array, + 'P' is an array index named property that already exists on 'O' is + data property with [[Configurable]], [[Writable]] false, 'desc' + is data descriptor, [[Value]] field of 'desc' is +0, and the + [[Value]] attribute value of 'P' is -0 (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + Object.defineProperty(arr, "1", { + value: +0 + }); + + try { + Object.defineProperties(arr, { + "1": { + value: -0 + } + }); + return false; + } catch (ex) { + return (ex instanceof TypeError) && dataPropertyAttributesAreCorrect(arr, "1", +0, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-236.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-236.js new file mode 100644 index 000000000..6b8a8ad32 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-236.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-236 +description: > + Object.defineProperties - TypeError is thrown if 'O' is an Array, + 'P' is an array index named property that already exists on 'O' is + data property with [[Configurable]], [[Writable]] false, 'desc' + is data descriptor, [[Value]] field of 'desc' is -0, and the + [[Value]] attribute value of 'P' is +0 (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + Object.defineProperty(arr, "1", { + value: -0 + }); + + try { + Object.defineProperties(arr, { + "1": { + value: +0 + } + }); + + return false; + } catch (ex) { + return (ex instanceof TypeError) && dataPropertyAttributesAreCorrect(arr, "1", -0, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-237.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-237.js new file mode 100644 index 000000000..ac6fe0f2f --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-237.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-237 +description: > + Object.defineProperties - TypeError is thrown if 'O' is an Array, + 'P' is an array index named property that already exists on 'O' is + data property with [[Configurable]], [[Writable]] false, 'desc' + is data descriptor, [[Value]] field of 'desc' and the [[Value]] + attribute value of 'P' are two numbers with different vaule + (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + Object.defineProperty(arr, "1", { + value: 12 + }); + + try { + Object.defineProperties(arr, { + "1": { + value: 36 + } + }); + return false; + } catch (ex) { + return (ex instanceof TypeError) && dataPropertyAttributesAreCorrect(arr, "1", 12, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-238.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-238.js new file mode 100644 index 000000000..91573862c --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-238.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-238 +description: > + Object.defineProperties - TypeError is thrown if 'O' is an Array, + 'P' is an array index named property that already exists on 'O' is + data property with [[Configurable]], [[Writable]] false, 'desc' + is data descriptor, [[Value]] field of 'desc' and the [[Value]] + attribute value of 'P' are two strings with different values + (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + Object.defineProperty(arr, "1", { + value: "abcd" + }); + + try { + Object.defineProperties(arr, { + "1": { + value: "efgh" + } + }); + return false; + } catch (ex) { + return (ex instanceof TypeError) && dataPropertyAttributesAreCorrect(arr, "1", "abcd", false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-239.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-239.js new file mode 100644 index 000000000..ae155c7e4 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-239.js @@ -0,0 +1,40 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-239 +description: > + Object.defineProperties - TypeError is thrown if 'O' is an Array, + 'P' is an array index named property that already exists on 'O' is + data property with [[Configurable]], [[Writable]] false, 'desc' + is data descriptor, [[Value]] field of 'desc' and the [[Value]] + attribute value of 'P' are two booleans with different values + (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + Object.defineProperty(arr, "1", { + value: true + }); + + try { + Object.defineProperties(arr, { + "1": { + value: false + } + }); + + return false; + } catch (ex) { + return (ex instanceof TypeError) && dataPropertyAttributesAreCorrect(arr, "1", true, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-24.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-24.js new file mode 100644 index 000000000..c7272405d --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-24.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-24 +description: > + Object.defineProperties - 'O' is the global object which + implements its own [[GetOwnProperty]] method to get 'P' (8.12.9 + step 1 ) +includes: + - runTestCase.js + - fnGlobalObject.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + try { + Object.defineProperty(fnGlobalObject(), "prop", { + value: 11, + writable: true, + enumerable: true, + configurable: true + }); + + Object.defineProperties(fnGlobalObject(), { + prop: { + value: 12 + } + }); + return dataPropertyAttributesAreCorrect(fnGlobalObject(), "prop", 12, true, true, true); + } finally { + delete fnGlobalObject().prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-240.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-240.js new file mode 100644 index 000000000..ca06eceb2 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-240.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-240 +description: > + Object.defineProperties - TypeError is thrown if 'O' is an Array, + 'P' is an array index named property that already exists on 'O' is + data property with [[Configurable]], [[Writable]] false, 'desc' + is data descriptor, [[Value]] field of 'desc' and the [[Value]] + attribute value of 'P' are two objects which refer to the + different objects (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + var obj1 = { value: 12 }; + var obj2 = { value: 36 }; + + Object.defineProperty(arr, "1", { + value: obj1 + }); + + try { + Object.defineProperties(arr, { + "1": { + value: obj2 + } + }); + + return false; + } catch (ex) { + return (ex instanceof TypeError) && dataPropertyAttributesAreCorrect(arr, "1", obj1, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-241.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-241.js new file mode 100644 index 000000000..2b013a35c --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-241.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-241 +description: > + Object.defineProperties - TypeError is thrown if 'O' is an Array, + 'P' is an array index named property that already exists on 'O' is + accessor property with [[Configurable]] false, 'desc' is accessor + descriptor, the [[Set]] field of 'desc' is present, and the + [[Set]] field of 'desc' and the [[Set]] attribute value of 'P' are + two objects which refer to the different objects (15.4.5.1 step + 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + function set_fun(value) { + arr.setVerifyHelpProp = value; + } + Object.defineProperty(arr, "1", { + set: set_fun + }); + + try { + Object.defineProperties(arr, { + "1": { + set: function () { } + } + }); + + return false; + } catch (ex) { + return (ex instanceof TypeError) && accessorPropertyAttributesAreCorrect(arr, "1", undefined, set_fun, "setVerifyHelpProp", false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-242.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-242.js new file mode 100644 index 000000000..b3bf55825 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-242.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-242 +description: > + Object.defineProperties - TypeError is thrown if 'O' is an Array, + 'P' is an array index named property that already exists on 'O' is + accessor property with [[Configurable]] false, 'desc' is accessor + descriptor, the [[Set]] field of 'desc' is present, and the + [[Set]] field of 'desc' is an object and the [[Set]] attribute + value of 'P' is undefined (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + function set_fun(value) { + arr.setVerifyHelpProp = value; + } + Object.defineProperty(arr, "1", { + set: set_fun + }); + + try { + Object.defineProperties(arr, { + "1": { + set: undefined + } + }); + + return false; + } catch (ex) { + return (ex instanceof TypeError) && accessorPropertyAttributesAreCorrect(arr, "1", undefined, set_fun, "setVerifyHelpProp", false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-243.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-243.js new file mode 100644 index 000000000..61cef225c --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-243.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-243 +description: > + Object.defineProperties - TypeError is not thrown if 'O' is an + Array, 'P' is an array index named property that already exists on + 'O' is accessor property with [[Configurable]] false, 'desc' is + accessor descriptor, the [[Set]] field of 'desc' is present, and + the [[Set]] field of 'desc' and the [[Set]] attribute value of 'P' + are undefined (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + Object.defineProperty(arr, "1", { + set: undefined + }); + + Object.defineProperties(arr, { + "1": { + set: undefined + } + }); + + return accessorPropertyAttributesAreCorrect(arr, "1", undefined, undefined, undefined, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-244.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-244.js new file mode 100644 index 000000000..9737323fc --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-244.js @@ -0,0 +1,46 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-244 +description: > + Object.defineProperties - TypeError is thrown if 'O' is an Array, + 'P' is an array index named property that already exists on 'O' is + accessor property with [[Configurable]] false, 'desc' is accessor + descriptor, the [[Get]] field of 'desc' is present, and the + [[Get]] field of 'desc' and the [[Get]] attribute value of 'P' are + two objects which refer to the different objects (15.4.5.1 step + 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + function get_fun() { + return 36; + } + Object.defineProperty(arr, "1", { + get: get_fun + }); + + try { + Object.defineProperties(arr, { + "1": { + get: function () { + return 12; + } + } + }); + + return false; + } catch (ex) { + return (ex instanceof TypeError) && accessorPropertyAttributesAreCorrect(arr, "1", get_fun, undefined, undefined, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-245.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-245.js new file mode 100644 index 000000000..79e12c982 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-245.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-245 +description: > + Object.defineProperties - TypeError is thrown if 'O' is an Array, + 'P' is an array index named property that already exists on 'O' is + accessor property with [[Configurable]] false, 'desc' is accessor + descriptor, the [[Get]] field of 'desc' is present, and the + [[Get]] field of 'desc' is an object and the [[Get]] attribute + value of 'P' is undefined (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + function get_fun() { + return 36; + } + Object.defineProperty(arr, "1", { + get: get_fun + }); + + try { + Object.defineProperties(arr, { + "1": { + get: undefined + } + }); + return false; + } catch (ex) { + return (ex instanceof TypeError) && accessorPropertyAttributesAreCorrect(arr, "1", get_fun, undefined, undefined, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-246.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-246.js new file mode 100644 index 000000000..7b81c8297 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-246.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-246 +description: > + Object.defineProperties - TypeError is not thrown if ''O' is an + Array, 'P' is an array index named property that already exists on + 'O' is accessor property with [[Configurable]] false, 'desc' is + accessor descriptor, test TypeError is not thrown if the [[Get]] + field of 'desc' is present, and the [[Get]] field of 'desc' and + the [[Get]] attribute value of 'P' are undefined (15.4.5.1 step + 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + Object.defineProperty(arr, "1", { + get: undefined + }); + + try { + Object.defineProperties(arr, { + "1": { + get: undefined + } + }); + + return accessorPropertyAttributesAreCorrect(arr, "1", undefined, undefined, undefined, false, false); + } catch (ex) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-247.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-247.js new file mode 100644 index 000000000..7691b7938 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-247.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-247 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is data property and + 'desc' is data descriptor, test updating the [[Value]] attribute + value of 'P' (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = [12]; + + try { + Object.defineProperties(arr, { + "0": { + value: 36 + } + }); + return dataPropertyAttributesAreCorrect(arr, "0", 36, true, true, true); + } catch (ex) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-248.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-248.js new file mode 100644 index 000000000..a8aaac93f --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-248.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-248 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is data property and + 'desc' is data descriptor, test setting the [[Value]] attribute + value of 'P' as undefined (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = [12]; + + try { + Object.defineProperties(arr, { + "0": { + value: undefined + } + }); + return dataPropertyAttributesAreCorrect(arr, "0", undefined, true, true, true); + } catch (ex) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-249.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-249.js new file mode 100644 index 000000000..e79096ad8 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-249.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-249 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is data property and + 'desc' is data descriptor, test setting the [[Value]] attribute + value of 'P' from undefined to normal value (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = [undefined]; + + try { + Object.defineProperties(arr, { + "0": { + value: 12 + } + }); + return dataPropertyAttributesAreCorrect(arr, "0", 12, true, true, true); + } catch (ex) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-25.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-25.js new file mode 100644 index 000000000..17bb7b99f --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-25.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-25 +description: > + Object.defineProperties - 'P' doesn't exist in 'O', test TypeError + is thrown when 'O' is not extensible (8.12.9 step 3) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.preventExtensions(obj); + + try { + Object.defineProperties(obj, { + prop: { + value: 12, + configurable: true + } + }); + return false; + } catch (e) { + return e instanceof TypeError && !obj.hasOwnProperty("prop"); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-250.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-250.js new file mode 100644 index 000000000..b3bf8147b --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-250.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-250 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is data property and + 'desc' is data descriptor, test updating the [[Writable]] + attribute value of 'P' (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = [100]; + + try { + Object.defineProperties(arr, { + "0": { + writable: false + } + }); + return dataPropertyAttributesAreCorrect(arr, "0", 100, false, true, true); + } catch (ex) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-251.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-251.js new file mode 100644 index 000000000..93dea5d52 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-251.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-251 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is data property and + 'desc' is data descriptor, test updating the [[Enumerable]] + attribute value of 'P' (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = [12]; + + try { + Object.defineProperties(arr, { + "0": { + enumerable: false + } + }); + return dataPropertyAttributesAreCorrect(arr, "0", 12, true, false, true); + } catch (ex) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-252.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-252.js new file mode 100644 index 000000000..e9ae90c36 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-252.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-252 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is data property and + 'desc' is data descriptor, test updating the [[Configurable]] + attribute value of 'P' (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = [12]; + + try { + Object.defineProperties(arr, { + "0": { + configurable: false + } + }); + return dataPropertyAttributesAreCorrect(arr, "0", 12, true, true, false); + } catch (ex) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-253.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-253.js new file mode 100644 index 000000000..bb7079b9c --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-253.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-253 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is data property and + 'desc' is data descriptor, test updating multiple attribute values + of 'P' (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = [12]; + + try { + Object.defineProperties(arr, { + "0": { + value: 36, + writable: false, + configurable: false + } + }); + return dataPropertyAttributesAreCorrect(arr, "0", 36, false, true, false); + } catch (ex) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-254.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-254.js new file mode 100644 index 000000000..37b3fd8f3 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-254.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-254 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is accessor property and + 'desc' is accessor descriptor, test updating the [[Get]] attribute + value of 'P' with different getter function (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + + function get_fun() { + return 36; + } + + Object.defineProperty(arr, "0", { + get: function () { + return 12; + }, + configurable: true + }); + + Object.defineProperties(arr, { + "0": { + get: get_fun + } + }); + return accessorPropertyAttributesAreCorrect(arr, "0", get_fun, undefined, undefined, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-255.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-255.js new file mode 100644 index 000000000..1dc6b1551 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-255.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-255 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is accessor property and + 'desc' is accessor descriptor, test setting the [[Get]] attribute + value of 'P' as undefined (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperty(arr, "0", { + get: function () { + return 12; + }, + configurable: true + }); + + Object.defineProperties(arr, { + "0": { + get: undefined + } + }); + return accessorPropertyAttributesAreCorrect(arr, "0", undefined, undefined, undefined, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-256.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-256.js new file mode 100644 index 000000000..b81817a23 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-256.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-256 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is accessor property and + 'desc' is accessor descriptor, test updating the [[Get]] attribute + value of 'P' from undefined to function (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + + function get_fun() { + return 36; + } + + Object.defineProperty(arr, "0", { + get: undefined, + configurable: true + }); + + Object.defineProperties(arr, { + "0": { + get: get_fun + } + }); + return accessorPropertyAttributesAreCorrect(arr, "0", get_fun, undefined, undefined, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-257.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-257.js new file mode 100644 index 000000000..eee053f64 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-257.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-257 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is accessor property and + 'desc' is accessor descriptor, test updating the [[Set]] attribute + value of 'P' with different getter function (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + + function set_fun(value) { + arr.setVerifyHelpProp = value; + } + + Object.defineProperty(arr, "0", { + set: function () { }, + configurable: true + }); + + try { + Object.defineProperties(arr, { + "0": { + set: set_fun + } + }); + return accessorPropertyAttributesAreCorrect(arr, "0", undefined, set_fun, "setVerifyHelpProp", false, true); + } catch (ex) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-258.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-258.js new file mode 100644 index 000000000..006ca0621 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-258.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-258 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is accessor property and + 'desc' is accessor descriptor, test setting the [[Set]] attribute + value of 'P' as undefined (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperty(arr, "0", { + set: function () { }, + configurable: true + }); + + Object.defineProperties(arr, { + "0": { + set: undefined + } + }); + return accessorPropertyAttributesAreCorrect(arr, "0", undefined, undefined, undefined, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-259.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-259.js new file mode 100644 index 000000000..eaa40a6eb --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-259.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-259 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is accessor property and + 'desc' is accessor descriptor, test updating the [[Set]] attribute + value of 'P' from undefined to function (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + + function set_fun(value) { + arr.setVerifyHelpProp = value; + } + Object.defineProperty(arr, "0", { + set: undefined, + configurable: true + }); + + try { + Object.defineProperties(arr, { + "0": { + set: set_fun + } + }); + return accessorPropertyAttributesAreCorrect(arr, "0", undefined, set_fun, "setVerifyHelpProp", false, true); + } catch (ex) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-26.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-26.js new file mode 100644 index 000000000..0ce274aba --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-26.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-26 +description: > + Object.defineProperties - 'P' doesn't exist in 'O', test 'P' is + defined as data property when 'desc' is generic descriptor (8.12.9 + step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + prop: { + configurable: true, + enumerable: true + } + }); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc.hasOwnProperty("value") && typeof desc.value === "undefined" && + desc.hasOwnProperty("writable") && desc.writable === false && + desc.hasOwnProperty("configurable") && desc.configurable === true && + desc.hasOwnProperty("enumerable") && desc.enumerable === true && + !desc.hasOwnProperty("get") && !desc.hasOwnProperty("set"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-260.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-260.js new file mode 100644 index 000000000..867cb5c62 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-260.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-260 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is accessor property and + 'desc' is accessor descriptor, test updating the [[Enumerable]] + attribute value of 'P' (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + + function set_fun(value) { + arr.setVerifyHelpProp = value; + } + Object.defineProperty(arr, "0", { + set: set_fun, + enumerable: true, + configurable: true + }); + + try { + Object.defineProperties(arr, { + "0": { + enumerable: false + } + }); + return accessorPropertyAttributesAreCorrect(arr, "0", undefined, set_fun, "setVerifyHelpProp", false, true); + } catch (ex) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-261.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-261.js new file mode 100644 index 000000000..009830375 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-261.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-261 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is accessor property and + 'desc' is accessor descriptor, test updating the [[Configurable]] + attribute value of 'P' (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + + function set_fun(value) { + arr.setVerifyHelpProp = value; + } + Object.defineProperty(arr, "0", { + set: set_fun, + configurable: true + }); + + try { + Object.defineProperties(arr, { + "0": { + configurable: false + } + }); + return accessorPropertyAttributesAreCorrect(arr, "0", undefined, set_fun, "setVerifyHelpProp", false, false); + } catch (ex) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-262.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-262.js new file mode 100644 index 000000000..cf4f32fa2 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-262.js @@ -0,0 +1,51 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-262 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is accessor property and + 'desc' is accessor descriptor, test updating multiple attribute + values of 'P' (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + + function get_fun() { + return 36; + } + function set_fun(value) { + arr.setVerifyHelpProp = value; + } + Object.defineProperty(arr, "0", { + get: function () { + return 12; + }, + set: set_fun, + enumerable: true, + configurable: true + }); + + try { + Object.defineProperties(arr, { + "0": { + get: get_fun, + enumerable: false, + configurable: false + } + }); + return accessorPropertyAttributesAreCorrect(arr, "0", get_fun, set_fun, "setVerifyHelpProp", false, false); + } catch (ex) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-263.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-263.js new file mode 100644 index 000000000..65034fa2e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-263.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-263 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, test the length property of 'O' is not changed if + ToUint32('P') is less than value of the length property in 'O' + (15.4.5.1 step 4.e) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + arr.length = 3; // default value of length: writable: true, configurable: false, enumerable: false + + Object.defineProperties(arr, { + "1": { + value: 26 + } + }); + return arr.length === 3 && arr[1] === 26; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-264.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-264.js new file mode 100644 index 000000000..aa9941004 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-264.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-264 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, test the length property of 'O' is set as + ToUint32('P') + 1 if ToUint32('P') equals to value of the length + property in 'O' (15.4.5.1 step 4.e.ii) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + arr.length = 3; // default value of length: writable: true, configurable: false, enumerable: false + + Object.defineProperties(arr, { + "3": { + value: 26 + } + }); + return arr.length === 4 && arr[3] === 26; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-265.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-265.js new file mode 100644 index 000000000..62ff57b15 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-265.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-265 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, test the length property of 'O' is set as + ToUint32('P') + 1 if ToUint32('P') is greater than value of the + length property in 'O' (15.4.5.1 step 4.e.ii) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperties(arr, { + "5": { + value: 26 + } + }); + return arr.length === 6 && arr[5] === 26; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-266.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-266.js new file mode 100644 index 000000000..4db292bd3 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-266.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-266 +description: > + Object.defineProperties - 'O' is an Array, 'P' is generic property + that won't exist on 'O', and 'desc' is data descriptor, test 'P' + is defined in 'O' with all correct attribute values (15.4.5.1 step + 5) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperties(arr, { + "property": { + value: 12, + writable: true, + enumerable: true, + configurable: true + } + }); + return dataPropertyAttributesAreCorrect(arr, "property", 12, true, true, true) && arr.length === 0; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-267.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-267.js new file mode 100644 index 000000000..7b8d81bdc --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-267.js @@ -0,0 +1,40 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-267 +description: > + Object.defineProperties - 'O' is an Array, 'P' is generic + property, and 'desc' is accessor descriptor, test 'P' is defined + in 'O' with all correct attribute values (15.4.5.1 step 5) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + + function get_fun() { + return 12; + } + function set_fun(value) { + arr.setVerifyHelpProp = value; + } + + Object.defineProperties(arr, { + "property": { + get: get_fun, + set: set_fun, + enumerable: true, + configurable: true + } + }); + return accessorPropertyAttributesAreCorrect(arr, "property", get_fun, set_fun, "setVerifyHelpProp", true, true) && + arr.length === 0; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-268.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-268.js new file mode 100644 index 000000000..c302b57a8 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-268.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-268 +description: > + Object.defineProperties - 'O' is an Array, 'P' is generic own + accessor property of 'O', and 'desc' is accessor descriptor, test + updating multiple attribute values of 'P' (15.4.5.1 step 5) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + function get_fun() { + return 12; + } + function set_fun(value) { + arr.verifySetFun = value; + } + Object.defineProperty(arr, "property", { + get: function () { + return 36; + }, + enumerable: true, + configurable: true + }); + + Object.defineProperties(arr, { + "property": { + get: get_fun, + set: set_fun, + enumerable: false + } + }); + return accessorPropertyAttributesAreCorrect(arr, "property", get_fun, set_fun, "verifySetFun", false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-269.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-269.js new file mode 100644 index 000000000..84b60a4e0 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-269.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-269 +description: > + Object.defineProperties - 'O' is an Array, 'P' is generic own data + property of 'O', and 'desc' is data descriptor, test updating + multiple attribute values of 'P' (15.4.5.1 step 5) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + arr.property = 12; // default value of attributes: writable: true, configurable: true, enumerable: true + + Object.defineProperties(arr, { + "property": { + writable: false, + enumerable: false, + configurable: false + } + }); + return dataPropertyAttributesAreCorrect(arr, "property", 12, false, false, false) && arr.length === 0; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-27.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-27.js new file mode 100644 index 000000000..9a7948f91 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-27.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-27 +description: > + Object.defineProperties - 'P' doesn't exist in 'O', test [[Value]] + of 'P' is set as undefined value if absent in data descriptor + 'desc' (8.12.9 step 4.a.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + prop: { + writable: true + } + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc.hasOwnProperty("value") && typeof desc.value === "undefined" && + desc.hasOwnProperty("writable") && desc.writable === true && + desc.hasOwnProperty("configurable") && desc.configurable === false && + desc.hasOwnProperty("enumerable") && desc.enumerable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-270.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-270.js new file mode 100644 index 000000000..8ddf5151c --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-270.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-270 +description: > + Object.defineProperties - 'O' is an Array, 'P' is generic own data + property of 'O', test TypeError is thrown when updating the + [[Value]] attribute value of 'P' which is defined as unwritable + and non-configurable (15.4.5.1 step 5) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperty(arr, "property", { + value: 12 + }); + + try { + Object.defineProperties(arr, { + "property": { + value: 36 + } + }); + return false; + } catch (ex) { + return (ex instanceof TypeError) && dataPropertyAttributesAreCorrect(arr, "property", 12, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-271.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-271.js new file mode 100644 index 000000000..6cefedf40 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-271.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-271 +description: > + Object.defineProperties -'O' is an Array, 'P' is generic own data + property of 'O', test TypeError is thrown when updating the + [[Writable]] attribute value of 'P' which is defined as + non-configurable (15.4.5.1 step 5) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperty(arr, "property", { + writable: false + }); + + try { + Object.defineProperties(arr, { + "property": { + writable: true + } + }); + return false; + } catch (ex) { + return (ex instanceof TypeError) && dataPropertyAttributesAreCorrect(arr, "property", undefined, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-272.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-272.js new file mode 100644 index 000000000..2630e340d --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-272.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-272 +description: > + Object.defineProperties - 'O' is an Array, 'P' is generic own data + property of 'O', test TypeError is thrown when updating the + [[Enumerable]] attribute value of 'P' which is defined as + non-configurable (15.4.5.1 step 5) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperty(arr, "property", { + value: 12, + enumerable: false + }); + + try { + Object.defineProperties(arr, { + "property": { + enumerable: true + } + }); + return false; + } catch (ex) { + return (ex instanceof TypeError) && dataPropertyAttributesAreCorrect(arr, "property", 12, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-273.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-273.js new file mode 100644 index 000000000..f22658d7c --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-273.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-273 +description: > + Object.defineProperties - 'O' is an Array, 'P' is generic own data + property of 'O', test TypeError is thrown when updating the + [[Configurable]] attribute value of 'P' which is defined as + non-configurable (15.4.5.1 step 5) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + + Object.defineProperty(arr, "property", { + value: 12 + }); + + try { + Object.defineProperties(arr, { + "property": { + configurable: true + } + }); + return false; + } catch (ex) { + return (ex instanceof TypeError) && dataPropertyAttributesAreCorrect(arr, "property", 12, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-274.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-274.js new file mode 100644 index 000000000..2f27559b3 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-274.js @@ -0,0 +1,47 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-274 +description: > + Object.defineProperties - 'O' is an Array, 'P' is generic own + accessor property of 'O', test TypeError is thrown when updating + the [[Get]] attribute value of 'P' which is defined as + non-configurable (15.4.5.1 step 5) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arr = []; + + function get_fun() { + return 37; + } + function set_fun(value) { + arr.verifySetFun = value; + } + Object.defineProperty(arr, "property", { + get: get_fun, + set: set_fun + }); + + try { + Object.defineProperties(arr, { + "property": { + get: function () { + return 36; + } + } + }); + return false; + } catch (ex) { + return (ex instanceof TypeError) && + accessorPropertyAttributesAreCorrect(arr, "property", get_fun, set_fun, "verifySetFun", false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-275.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-275.js new file mode 100644 index 000000000..db153cc1f --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-275.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-275 +description: > + Object.defineProperties - 'O' is an Array, 'P' is generic own + accessor property of 'O', test TypeError is thrown when updating + the [[Set]] attribute value of 'P' which is defined as + non-configurable (15.4.5.1 step 5) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + + function set_fun(value) { + arr.setVerifyHelpProp = value; + } + Object.defineProperty(arr, "property", { + set: set_fun + }); + + try { + Object.defineProperties(arr, { + "property": { + set: function () { } + } + }); + return false; + } catch (ex) { + return (ex instanceof TypeError) && accessorPropertyAttributesAreCorrect(arr, "property", undefined, set_fun, "setVerifyHelpProp", false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-276.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-276.js new file mode 100644 index 000000000..f39432a20 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-276.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-276 +description: > + Object.defineProperties - 'O' is an Array, 'P' is generic own + accessor property of 'O', test TypeError is thrown when updating + the [[Enumerable]] attribute value of 'P' which is defined as + non-configurable (15.4.5.1 step 5) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + + function set_fun(value) { + arr.setVerifyHelpProp = value; + } + Object.defineProperty(arr, "property", { + set: set_fun, + enumerable: false + }); + + try { + Object.defineProperties(arr, { + "property": { + enumerable: true + } + }); + return false; + } catch (ex) { + return (ex instanceof TypeError) && accessorPropertyAttributesAreCorrect(arr, "property", undefined, set_fun, "setVerifyHelpProp", false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-277.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-277.js new file mode 100644 index 000000000..2e327ca23 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-277.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-277 +description: > + Object.defineProperties - 'O' is an Array, 'P' is generic own + accessor property of 'O', test TypeError is thrown when updating + the [[Configurable]] attribute value of 'P' which is defined as + non-configurable (15.4.5.1 step 5) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arr = []; + + function set_fun(value) { + arr.setVerifyHelpProp = value; + } + Object.defineProperty(arr, "property", { + set: set_fun, + configurable: false + }); + + try { + Object.defineProperties(arr, { + "property": { + configurable: true + } + }); + return false; + } catch (ex) { + return (ex instanceof TypeError) && accessorPropertyAttributesAreCorrect(arr, "property", undefined, set_fun, "setVerifyHelpProp", false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-278.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-278.js new file mode 100644 index 000000000..020367e28 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-278.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-278 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is own + property which is ever defined in both [[ParameterMap]] of 'O' and + 'O', and is deleted afterwards, and 'desc' is data descriptor, + test 'P' is redefined in 'O' with all correct attribute values + (10.6 [[DefineOwnProperty]] step 3) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arg; + + (function fun(a, b, c) { + arg = arguments; + }(0, 1, 2)); + + delete arg[0]; + + Object.defineProperties(arg, { + "0": { + value: 10, + writable: true, + enumerable: true, + configurable: true + } + }); + + return dataPropertyAttributesAreCorrect(arg, "0", 10, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-279.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-279.js new file mode 100644 index 000000000..445d5719d --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-279.js @@ -0,0 +1,48 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-279 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is own + property which is ever defined in both [[ParameterMap]] of 'O' and + 'O', and is deleted afterwards, and 'desc' is accessor descriptor, + test 'P' is redefined in 'O' with all correct attribute values + (10.6 [[DefineOwnProperty]] step 3) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arg; + + (function fun(a, b, c) { + arg = arguments; + }(0, 1, 2)); + + delete arg[0]; + + function get_func() { + return 10; + } + function set_func(value) { + arg.setVerifyHelpProp = value; + } + + Object.defineProperties(arg, { + "0": { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + } + }); + + return accessorPropertyAttributesAreCorrect(arg, "0", get_func, set_func, "setVerifyHelpProp", true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-28.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-28.js new file mode 100644 index 000000000..3627e0084 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-28.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-28 +description: > + Object.defineProperties - 'P' doesn't exist in 'O', test + [[Writable]] of 'P' is set as false value if absent in data + descriptor 'desc' (8.12.9 step 4.a.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + prop: { + value: 1001 + } + }); + obj.prop = 1002; + return obj.hasOwnProperty("prop") && obj.prop === 1001; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-280.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-280.js new file mode 100644 index 000000000..e47d631ec --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-280.js @@ -0,0 +1,51 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-280 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is own + accessor property of 'O' which is also defined in [[ParameterMap]] + of 'O', and 'desc' is accessor descriptor, test updating multiple + attribute values of 'P' (10.6 [[DefineOwnProperty]] step 3) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arg; + + (function fun(a, b, c) { + arg = arguments; + } (0, 1, 2)); + + function get_func1() { + return 10; + } + + Object.defineProperty(arg, "0", { + get: get_func1, + enumerable: true, + configurable: true + }); + + function get_func2() { + return 20; + } + + Object.defineProperties(arg, { + "0": { + get: get_func2, + enumerable: false, + configurable: false + } + }); + + var desc = Object.getOwnPropertyDescriptor(arg, "0"); + return desc.get === get_func2 && typeof desc.set === "undefined" && + desc.configurable === false && desc.enumerable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-281.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-281.js new file mode 100644 index 000000000..cf0de9523 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-281.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-281 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is own + data property of 'O' which is also defined in [[ParameterMap]] of + 'O', and 'desc' is data descriptor, test updating multiple + attribute values of 'P' (10.6 [[DefineOwnProperty]] step 3) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arg; + + (function fun(a, b, c) { + arg = arguments; + }(0, 1, 2)); + + Object.defineProperties(arg, { + "0": { + value: 20, + writable: false, + enumerable: false, + configurable: false + } + }); + + return dataPropertyAttributesAreCorrect(arg, "0", 20, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-282.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-282.js new file mode 100644 index 000000000..f8dc1ff7b --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-282.js @@ -0,0 +1,46 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-282 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is own + data property of 'O' which is also defined in [[ParameterMap]] of + 'O', test TypeError is thrown when updating the [[Value]] + attribute value of 'P' whose writable and configurable attributes + are false (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arg; + + (function fun(a, b, c) { + arg = arguments; + }(0, 1, 2)); + + Object.defineProperty(arg, "0", { + value: 0, + writable: false, + configurable: false + }); + + try { + Object.defineProperties(arg, { + "0": { + value: 10 + } + }); + + return false; + } catch (e) { + return (e instanceof TypeError) && dataPropertyAttributesAreCorrect(arg, "0", 0, false, true, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-283.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-283.js new file mode 100644 index 000000000..1f43637be --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-283.js @@ -0,0 +1,47 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-283 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is own + data property of 'O' which is also defined in [[ParameterMap]] of + 'O', test TypeError is thrown when updating the [[Writable]] + attribute value of 'P' which is defined as non-configurable (10.6 + [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arg; + + (function fun(a, b, c) { + arg = arguments; + }(0, 1, 2)); + + Object.defineProperty(arg, "0", { + value: 0, + writable: false, + enumerable: false, + configurable: false + }); + + try { + Object.defineProperties(arg, { + "0": { + writable: true + } + }); + + return false; + } catch (e) { + return (e instanceof TypeError) && dataPropertyAttributesAreCorrect(arg, "0", 0, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-284.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-284.js new file mode 100644 index 000000000..62bda9ef7 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-284.js @@ -0,0 +1,47 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-284 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is own + data property of 'O' which is also defined in [[ParameterMap]] of + 'O', test TypeError is thrown when updating the [[Enumerable]] + attribute value of 'P' which is defined as non-configurable (10.6 + [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arg; + + (function fun(a, b, c) { + arg = arguments; + }(0, 1, 2)); + + Object.defineProperty(arg, "0", { + value: 0, + writable: false, + enumerable: true, + configurable: false + }); + + try { + Object.defineProperties(arg, { + "0": { + enumerable: false + } + }); + + return false; + } catch (e) { + return (e instanceof TypeError) && dataPropertyAttributesAreCorrect(arg, "0", 0, false, true, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-285.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-285.js new file mode 100644 index 000000000..9b00b79ee --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-285.js @@ -0,0 +1,47 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-285 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is own + data property of 'O' which is also defined in [[ParameterMap]] of + 'O', test TypeError is thrown when updating the [[Configurable]] + attribute value of 'P' which is defined as non-configurable (10.6 + [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arg; + + (function fun(a, b, c) { + arg = arguments; + }(0, 1, 2)); + + Object.defineProperty(arg, "0", { + value: 0, + writable: false, + enumerable: false, + configurable: false + }); + + try { + Object.defineProperties(arg, { + "0": { + configurable: true + } + }); + + return false; + } catch (e) { + return (e instanceof TypeError) && dataPropertyAttributesAreCorrect(arg, "0", 0, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-286.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-286.js new file mode 100644 index 000000000..362ef9c73 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-286.js @@ -0,0 +1,53 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-286 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is own + accessor property of 'O' which is also defined in [[ParameterMap]] + of 'O', test TypeError is thrown when updating the [[Get]] + attribute value of 'P' which is defined as non-configurable (10.6 + [[DefineOwnProperty]] step 4) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arg; + + (function fun(a, b, c) { + arg = arguments; + } (0, 1, 2)); + + function get_func1() { + return 0; + } + + Object.defineProperty(arg, "0", { + get: get_func1, + enumerable: false, + configurable: false + }); + + function get_func2() { + return 10; + } + try { + Object.defineProperties(arg, { + "0": { + get: get_func2 + } + }); + + return false; + } catch (e) { + var desc = Object.getOwnPropertyDescriptor(arg, "0"); + return e instanceof TypeError && desc.get === get_func1 && typeof desc.set === "undefined" && + desc.enumerable === false && desc.configurable === false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-287.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-287.js new file mode 100644 index 000000000..4ca7f80ca --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-287.js @@ -0,0 +1,54 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-287 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is own + accessor property of 'O' which is also defined in [[ParameterMap]] + of 'O', test TypeError is thrown when updating the [[Set]] + attribute value of 'P' which is defined as non-configurable (10.6 + [[DefineOwnProperty]] step 4) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arg; + + (function fun(a, b, c) { + arg = arguments; + }(0, 1, 2)); + + function get_func() { + return 0; + } + + Object.defineProperty(arg, "0", { + get: get_func, + set: undefined, + enumerable: false, + configurable: false + }); + + function set_func(value) { + arg.setVerifyHelpProp = value; + } + try { + Object.defineProperties(arg, { + "0": { + set: set_func + } + }); + + return false; + } catch (e) { + var desc = Object.getOwnPropertyDescriptor(arg, "0"); + return e instanceof TypeError && desc.get === get_func && typeof desc.set === "undefined" && + desc.enumerable === false && desc.configurable === false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-288.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-288.js new file mode 100644 index 000000000..1c3e584d5 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-288.js @@ -0,0 +1,50 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-288 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is own + accessor property of 'O' which is also defined in [[ParameterMap]] + of 'O', test TypeError is thrown when updating the [[Enumerable]] + attribute value of 'P' which is defined as non-configurable (10.6 + [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arg; + + (function fun(a, b, c) { + arg = arguments; + }(0, 1, 2)); + + function get_func() { + return 0; + } + + Object.defineProperty(arg, "0", { + get: get_func, + enumerable: true, + configurable: false + }); + + try { + Object.defineProperties(arg, { + "0": { + enumerable: false + } + }); + + return false; + } catch (e) { + return (e instanceof TypeError) && accessorPropertyAttributesAreCorrect(arg, "0", get_func, undefined, undefined, true, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-289.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-289.js new file mode 100644 index 000000000..d7b9bf466 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-289.js @@ -0,0 +1,50 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-289 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is own + accessor property of 'O' which is also defined in [[ParameterMap]] + of 'O', test TypeError is thrown when updating the + [[Configurable]] attribute value of 'P' which is defined as + non-configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arg; + + (function fun(a, b, c) { + arg = arguments; + }(0, 1, 2)); + + function get_func() { + return 0; + } + + Object.defineProperty(arg, "0", { + get: get_func, + enumerable: true, + configurable: false + }); + + try { + Object.defineProperties(arg, { + "0": { + configurable: true + } + }); + + return false; + } catch (e) { + return (e instanceof TypeError) && accessorPropertyAttributesAreCorrect(arg, "0", get_func, undefined, undefined, true, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-29.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-29.js new file mode 100644 index 000000000..06a3dc89e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-29.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-29 +description: > + Object.defineProperties - 'P' doesn't exist in 'O', test + [[Enumerable]] of 'P' is set as false value if absent in data + descriptor 'desc' (8.12.9 step 4.a.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + prop: { value: 1001} + }); + + for (var prop in obj) { + if (obj.hasOwnProperty(prop)) { + if (prop === "prop") { + return false; + } + } + } + return true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-290.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-290.js new file mode 100644 index 000000000..7dc503f5e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-290.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-290 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is an + array index named property of 'O' but not defined in + [[ParameterMap]] of 'O', and 'desc' is data descriptor, test 'P' + is defined in 'O' with all correct attribute values (10.6 + [[DefineOwnProperty]] step 3) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arg; + + (function fun() { + arg = arguments; + }(0, 1, 2)); + + delete arg[0]; + + Object.defineProperties(arg, { + "0": { + value: 10, + writable: false, + enumerable: false, + configurable: false + } + }); + + return dataPropertyAttributesAreCorrect(arg, "0", 10, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-291.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-291.js new file mode 100644 index 000000000..c9eabffa5 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-291.js @@ -0,0 +1,48 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-291 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is an + array index named property of 'O' but not defined in + [[ParameterMap]] of 'O', and 'desc' is accessor descriptor, test + 'P' is defined in 'O' with all correct attribute values (10.6 + [[DefineOwnProperty]] step 3) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arg; + + (function fun() { + arg = arguments; + }(0, 1, 2)); + + delete arg[0]; + + function get_func() { + return 10; + } + function set_func(value) { + arg.setVerifyHelpProp = value; + } + + Object.defineProperties(arg, { + "0": { + get: get_func, + set: set_func, + enumerable: false, + configurable: false + } + }); + + return accessorPropertyAttributesAreCorrect(arg, "0", get_func, set_func, "setVerifyHelpProp", false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-292.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-292.js new file mode 100644 index 000000000..3f9f98792 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-292.js @@ -0,0 +1,52 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-292 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is an + array index named accessor property of 'O' but not defined in + [[ParameterMap]] of 'O', and 'desc' is accessor descriptor, test + updating multiple attribute values of 'P' (10.6 + [[DefineOwnProperty]] step 3) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arg; + + (function fun() { + arg = arguments; + }(0, 1, 2)); + + function get_func1() { + return 10; + } + + Object.defineProperty(arg, "0", { + get: get_func1, + enumerable: true, + configurable: true + }); + + function get_func2() { + return 20; + } + + Object.defineProperties(arg, { + "0": { + get: get_func2, + enumerable: false, + configurable: false + } + }); + + return accessorPropertyAttributesAreCorrect(arg, "0", get_func2, undefined, undefined, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-293.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-293.js new file mode 100644 index 000000000..5c2ceab3f --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-293.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-293 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is an + array index named data property of 'O' but not defined in + [[ParameterMap]] of 'O', and 'desc' is data descriptor, test + updating multiple attribute values of 'P' (10.6 + [[DefineOwnProperty]] step 3) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arg; + + (function fun() { + arg = arguments; + }(0, 1, 2)); + + Object.defineProperties(arg, { + "0": { + value: 20, + writable: false, + enumerable: false, + configurable: false + } + }); + + return dataPropertyAttributesAreCorrect(arg, "0", 20, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-294.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-294.js new file mode 100644 index 000000000..39fd992a0 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-294.js @@ -0,0 +1,46 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-294 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is an + array index named data property of 'O' but not defined in + [[ParameterMap]] of 'O', test TypeError is thrown when updating + the [[Value]] attribute value of 'P' which is not writable and not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arg; + + (function fun() { + arg = arguments; + }()); + + Object.defineProperty(arg, "0", { + value: 0, + writable: false, + configurable: false + }); + + try { + Object.defineProperties(arg, { + "0": { + value: 10 + } + }); + + return false; + } catch (e) { + return (e instanceof TypeError) && dataPropertyAttributesAreCorrect(arg, "0", 0, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-295.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-295.js new file mode 100644 index 000000000..30e5f1762 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-295.js @@ -0,0 +1,47 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-295 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is an + array index named data property of 'O' but not defined in + [[ParameterMap]] of 'O', test TypeError is thrown when updating + the [[Writable]] attribute value of 'P' which is not configurable + (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arg; + + (function fun() { + arg = arguments; + }()); + + Object.defineProperty(arg, "0", { + value: 0, + writable: false, + enumerable: false, + configurable: false + }); + + try { + Object.defineProperties(arg, { + "0": { + writable: true + } + }); + + return false; + } catch (e) { + return (e instanceof TypeError) && dataPropertyAttributesAreCorrect(arg, "0", 0, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-296.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-296.js new file mode 100644 index 000000000..8c8d62846 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-296.js @@ -0,0 +1,47 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-296 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is an + array index named data property of 'O' but not defined in + [[ParameterMap]] of 'O', test TypeError is thrown when updating + the [[Enumerable]] attribute value of 'P' which is not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arg; + + (function fun() { + arg = arguments; + }()); + + Object.defineProperty(arg, "0", { + value: 0, + writable: false, + enumerable: true, + configurable: false + }); + + try { + Object.defineProperties(arg, { + "0": { + enumerable: false + } + }); + + return false; + } catch (e) { + return (e instanceof TypeError) && dataPropertyAttributesAreCorrect(arg, "0", 0, false, true, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-297.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-297.js new file mode 100644 index 000000000..1a0fa728a --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-297.js @@ -0,0 +1,47 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-297 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is an + array index named data property of 'O' but not defined in + [[ParameterMap]] of 'O', test TypeError is thrown when updating + the [[Configurable]] attribute value of 'P' which is not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arg; + + (function fun() { + arg = arguments; + }()); + + Object.defineProperty(arg, "0", { + value: 0, + writable: false, + enumerable: false, + configurable: false + }); + + try { + Object.defineProperties(arg, { + "0": { + configurable: true + } + }); + + return false; + } catch (e) { + return (e instanceof TypeError) && dataPropertyAttributesAreCorrect(arg, "0", 0, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-298.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-298.js new file mode 100644 index 000000000..0c72e56b9 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-298.js @@ -0,0 +1,52 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-298 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is an + array index named accessor property of 'O' but not defined in + [[ParameterMap]] of 'O', test TypeError is thrown when updating + the [[Get]] attribute value of 'P' which is not configurable (10.6 + [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arg; + + (function fun() { + arg = arguments; + }()); + + function get_func1() { + return 0; + } + + Object.defineProperty(arg, "0", { + get: get_func1, + enumerable: false, + configurable: false + }); + + function get_func2() { + return 10; + } + try { + Object.defineProperties(arg, { + "0": { + get: get_func2 + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && accessorPropertyAttributesAreCorrect(arg, "0", get_func1, undefined, undefined, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-299.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-299.js new file mode 100644 index 000000000..f42e1cd30 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-299.js @@ -0,0 +1,53 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-299 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is an + array index named accessor property of 'O' but not defined in + [[ParameterMap]] of 'O', test TypeError is thrown when updating + the [[Set]] attribute value of 'P' which is not configurable (10.6 + [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arg; + + (function fun() { + arg = arguments; + }()); + + function get_func() { + return 0; + } + + Object.defineProperty(arg, "0", { + get: get_func, + set: undefined, + enumerable: false, + configurable: false + }); + + function set_func(value) { + arg.setVerifyHelpProp = value; + } + try { + Object.defineProperties(arg, { + "0": { + set: set_func + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && accessorPropertyAttributesAreCorrect(arg, "0", get_func, undefined, undefined, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-3.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-3.js new file mode 100644 index 000000000..a2c2ef6ef --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-3.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-3 +description: > + Object.defineProperties - 'P' is own data property that overrides + an inherited data property (8.12.9 step 1 ) +includes: [runTestCase.js] +---*/ + +function testcase() { + var proto = {}; + Object.defineProperty(proto, "prop", { + value: 11, + configurable: true + }); + var Con = function () { }; + Con.prototype = proto; + + var obj = new Con(); + Object.defineProperty(obj, "prop", { + value: 12, + configurable: false + }); + + try { + Object.defineProperties(obj, { + prop: { + value: 13, + configurable: true + } + }); + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-30.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-30.js new file mode 100644 index 000000000..97b89b2ff --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-30.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-30 +description: > + Object.defineProperties - 'P' doesn't exist in 'O', test + [[Configurable]] of 'P' is set as false value if absent in data + descriptor 'desc' (8.12.9 step 4.a.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + + Object.defineProperties(obj, { + prop: { value: 1001 } + }); + delete obj.prop; + return obj.hasOwnProperty("prop") && obj.prop === 1001; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-300.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-300.js new file mode 100644 index 000000000..34362547f --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-300.js @@ -0,0 +1,49 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-300 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is an + array index named accessor property of 'O' but not defined in + [[ParameterMap]] of 'O', test TypeError is thrown when updating + the [[Enumerable]] attribute value of 'P' which is not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arg; + + (function fun() { + arg = arguments; + }()); + + function get_func() { + return 0; + } + + Object.defineProperty(arg, "0", { + get: get_func, + enumerable: true, + configurable: false + }); + + try { + Object.defineProperties(arg, { + "0": { + enumerable: false + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && accessorPropertyAttributesAreCorrect(arg, "0", get_func, undefined, undefined, true, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-301.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-301.js new file mode 100644 index 000000000..a642570d1 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-301.js @@ -0,0 +1,49 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-301 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is an + array index named accessor property of 'O' but not defined in + [[ParameterMap]] of 'O', test TypeError is thrown when updating + the [[Configurable]] attribute value of 'P' which is not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arg; + + (function fun() { + arg = arguments; + }()); + + function get_func() { + return 0; + } + + Object.defineProperty(arg, "0", { + get: get_func, + enumerable: true, + configurable: false + }); + + try { + Object.defineProperties(arg, { + "0": { + configurable: true + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && accessorPropertyAttributesAreCorrect(arg, "0", get_func, undefined, undefined, true, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-302.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-302.js new file mode 100644 index 000000000..cd827ebbb --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-302.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-302 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is + generic property, and 'desc' is data descriptor, test 'P' is + defined in 'O' with all correct attribute values (10.6 + [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arg = (function () { + return arguments; + }(1, 2, 3)); + + Object.defineProperties(arg, { + "genericProperty": { + value: 1001, + writable: true, + enumerable: true, + configurable: true + } + }); + + return dataPropertyAttributesAreCorrect(arg, "genericProperty", 1001, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-303.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-303.js new file mode 100644 index 000000000..f5eff7cec --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-303.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-303 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is + generic property, and 'desc' is accessor descriptor, test 'P' is + defined in 'O' with all correct attribute values (10.6 + [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arg = (function () { + return arguments; + }(1, 2, 3)); + + function getFun() { + return "getFunctionString"; + } + function setFun(value) { + arg.testGetFunction = value; + } + Object.defineProperties(arg, { + "genericProperty": { + get: getFun, + set: setFun, + enumerable: true, + configurable: true + } + }); + + return accessorPropertyAttributesAreCorrect(arg, "genericProperty", getFun, setFun, "testGetFunction", true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-304.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-304.js new file mode 100644 index 000000000..faa10b168 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-304.js @@ -0,0 +1,52 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-304 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is + generic own accessor property of 'O', and 'desc' is accessor + descriptor, test updating multiple attribute values of 'P' (10.6 + [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arg = (function () { + return arguments; + }(1, 2, 3)); + + Object.defineProperty(arg, "genericProperty", { + get: function () { + return 1001; + }, + set: function (value) { + arg.testGetFunction1 = value; + }, + enumerable: true, + configurable: true + }); + + function getFun() { + return "getFunctionString"; + } + function setFun(value) { + arg.testGetFunction = value; + } + Object.defineProperties(arg, { + "genericProperty": { + get: getFun, + set: setFun, + enumerable: false, + configurable: false + } + }); + + return accessorPropertyAttributesAreCorrect(arg, "genericProperty", getFun, setFun, "testGetFunction", false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-305.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-305.js new file mode 100644 index 000000000..641833ad3 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-305.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-305 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is + generic own data property of 'O', and 'desc' is data descriptor, + test updating multiple attribute values of 'P' (10.6 + [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arg = (function () { + return arguments; + }(1, 2, 3)); + + Object.defineProperty(arg, "genericProperty", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + + Object.defineProperties(arg, { + "genericProperty": { + value: 1002, + enumerable: false, + configurable: false + } + }); + + return dataPropertyAttributesAreCorrect(arg, "genericProperty", 1002, true, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-306.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-306.js new file mode 100644 index 000000000..44ce844fe --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-306.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-306 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is + generic own data property of 'O', test TypeError is thrown when + updating the [[Value]] attribute value of 'P' which is not + writable and not configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arg = (function () { + return arguments; + }(1, 2, 3)); + + Object.defineProperty(arg, "genericProperty", { + value: 1001, + writable: false, + configurable: false + }); + + try { + Object.defineProperties(arg, { + "genericProperty": { + value: 1002 + } + }); + + return false; + } catch (ex) { + return ex instanceof TypeError && + dataPropertyAttributesAreCorrect(arg, "genericProperty", 1001, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-307.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-307.js new file mode 100644 index 000000000..106bb6c80 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-307.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-307 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is + generic own data property of 'O', test TypeError is thrown when + updating the [[Writable]] attribute value of 'P' which is not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arg = (function () { + return arguments; + }(1, 2, 3)); + + Object.defineProperty(arg, "genericProperty", { + writable: false, + configurable: false + }); + + try { + Object.defineProperties(arg, { + "genericProperty": { + writable: true + } + }); + + return false; + } catch (ex) { + return ex instanceof TypeError && + dataPropertyAttributesAreCorrect(arg, "genericProperty", undefined, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-308.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-308.js new file mode 100644 index 000000000..f25243da3 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-308.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-308 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is + generic own data property of 'O', test TypeError is thrown when + updating the [[Enumerable]] attribute value of 'P' which is not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arg = (function () { + return arguments; + }(1, 2, 3)); + + Object.defineProperty(arg, "genericProperty", { + enumerable: true, + configurable: false + }); + + try { + Object.defineProperties(arg, { + "genericProperty": { + enumerable: false + } + }); + + return false; + } catch (ex) { + return ex instanceof TypeError && + dataPropertyAttributesAreCorrect(arg, "genericProperty", undefined, false, true, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-309.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-309.js new file mode 100644 index 000000000..acf8ce431 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-309.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-309 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is + generic own data property of 'O', test TypeError is thrown when + updating the [[Configurable]] attribute value of 'P' which is not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arg = (function () { + return arguments; + }(1, 2, 3)); + + Object.defineProperty(arg, "genericProperty", { + configurable: false + }); + + try { + Object.defineProperties(arg, { + "genericProperty": { + configurable: true + } + }); + + return false; + } catch (ex) { + return ex instanceof TypeError && + dataPropertyAttributesAreCorrect(arg, "genericProperty", undefined, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-31.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-31.js new file mode 100644 index 000000000..4ae995865 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-31.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-31 +description: > + Object.defineProperties - 'desc' is data descriptor, test setting + all attribute values of 'P' (8.12.9 step 4.a.i) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { + prop: { + value: 1002, + writable: false, + enumerable: false, + configurable: false + } + }); + return dataPropertyAttributesAreCorrect(obj, "prop", 1002, false, false, false); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-310.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-310.js new file mode 100644 index 000000000..f2dc102f5 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-310.js @@ -0,0 +1,51 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-310 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is + generic own accessor property of 'O', test TypeError is thrown + when updating the [[Get]] attribute value of 'P' which is not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arg = (function () { + return arguments; + } (1, 2, 3)); + + function getFun() { + return "genericPropertyString"; + } + function setFun(value) { + arg.verifySetFun = value; + } + Object.defineProperty(arg, "genericProperty", { + get: getFun, + set: setFun, + configurable: false + }); + + try { + Object.defineProperties(arg, { + "genericProperty": { + get: function () { + return "overideGenericPropertyString"; + } + } + }); + + return false; + } catch (ex) { + return ex instanceof TypeError && + accessorPropertyAttributesAreCorrect(arg, "genericProperty", getFun, setFun, "verifySetFun", false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-311.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-311.js new file mode 100644 index 000000000..ddbd7e60c --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-311.js @@ -0,0 +1,47 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-311 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is + generic own accessor property of 'O', test TypeError is thrown + when updating the [[Set]] attribute value of 'P' which is not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arg = (function () { + return arguments; + }(1, 2, 3)); + + function setFun(value) { + arg.genericPropertyString = value; + } + Object.defineProperty(arg, "genericProperty", { + set: setFun, + configurable: false + }); + + try { + Object.defineProperties(arg, { + "genericProperty": { + set: function (value) { + arg.genericPropertyString1 = value; + } + } + }); + + return false; + } catch (ex) { + return ex instanceof TypeError && + accessorPropertyAttributesAreCorrect(arg, "genericProperty", undefined, setFun, "genericPropertyString", false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-312.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-312.js new file mode 100644 index 000000000..3717eb0c3 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-312.js @@ -0,0 +1,46 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-312 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is + generic own accessor property of 'O', test TypeError is thrown + when updating the [[Enumerable]] attribute value of 'P' which is + not configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arg = (function () { + return arguments; + }(1, 2, 3)); + + function setFun(value) { + arg.genericPropertyString = value; + } + Object.defineProperty(arg, "genericProperty", { + set: setFun, + enumerable: true, + configurable: false + }); + + try { + Object.defineProperties(arg, { + "genericProperty": { + enumerable: false + } + }); + + return false; + } catch (ex) { + return ex instanceof TypeError && + accessorPropertyAttributesAreCorrect(arg, "genericProperty", undefined, setFun, "genericPropertyString", true, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-313.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-313.js new file mode 100644 index 000000000..28f1e1440 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-313.js @@ -0,0 +1,45 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-313 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is + generic own accessor property of 'O', test TypeError is thrown + when updating the [[Configurable]] attribute value of 'P' which is + not configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arg = (function () { + return arguments; + }(1, 2, 3)); + + function setFun(value) { + arg.genericPropertyString = value; + } + Object.defineProperty(arg, "genericProperty", { + set: setFun, + configurable: false + }); + + try { + Object.defineProperties(arg, { + "genericProperty": { + configurable: true + } + }); + + return false; + } catch (ex) { + return ex instanceof TypeError && + accessorPropertyAttributesAreCorrect(arg, "genericProperty", undefined, setFun, "genericPropertyString", false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-314.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-314.js new file mode 100644 index 000000000..ec1a271c7 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-314.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-314 +description: > + Object.defineProperties - 'O' is an Arguments object, 'name' is + own property of [[ParameterMap]] of 'O', test 'name' is deleted if + 'name' is configurable and 'desc' is accessor descriptor (10.6 + [[DefineOwnProperty]] step 5.a.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arg = (function () { + return arguments; + }(1, 2, 3)); + var accessed = false; + + Object.defineProperties(arg, { + "0": { + get: function () { + accessed = true; + return 12; + } + } + }); + + return arg[0] === 12 && accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-32.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-32.js new file mode 100644 index 000000000..edb2aea63 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-32.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-32 +description: > + Object.defineProperties - 'desc' is generic descriptor without any + attribute, test 'P' is defined in 'obj' with all default attribute + values (8.12.9 step 4.a.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperties(obj, { prop: {} }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc.hasOwnProperty("value") && typeof desc.value === "undefined" && + desc.hasOwnProperty("writable") && desc.writable === false && + desc.hasOwnProperty("configurable") && desc.configurable === false && + desc.hasOwnProperty("enumerable") && desc.enumerable === false && + !desc.hasOwnProperty("get") && !desc.hasOwnProperty("set"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-33.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-33.js new file mode 100644 index 000000000..0c254b1ca --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-33.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-33 +description: > + Object.defineProperties - 'P' doesn't exist in 'O', test [[Get]] + of 'P' is set as undefined value if absent in accessor descriptor + 'desc' (8.12.9 step 4.b) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = {}; + var setFun = function (value) { + obj.setVerifyHelpProp = value; + }; + + Object.defineProperties(obj, { + prop: { + set: setFun, + enumerable: true, + configurable: true + } + }); + return accessorPropertyAttributesAreCorrect(obj, "prop", undefined, setFun, "setVerifyHelpProp", true, true); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-34.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-34.js new file mode 100644 index 000000000..23d555cbe --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-34.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-34 +description: > + Object.defineProperties - 'P' doesn't exist in 'O', test [[Set]] + of 'P' is set as undefined value if absent in accessor descriptor + 'desc' (8.12.9 step 4.b.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var getFunc = function () { + return 10; + }; + + Object.defineProperties(obj, { + prop: { + get: getFunc, + enumerable: true, + configurable: true + } + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + return obj.hasOwnProperty("prop") && typeof (desc.set) === "undefined"; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-35.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-35.js new file mode 100644 index 000000000..bbacd3f26 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-35.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-35 +description: > + Object.defineProperties - 'P' doesn't exist in 'O', test + [[Enumerable]] of 'P' is set as false value if absent in accessor + descriptor 'desc' (8.12.9 step 4.b.i) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = {}; + var getFun = function () { + return 10; + }; + var setFun = function (value) { + obj.setVerifyHelpProp = value; + }; + + Object.defineProperties(obj, { + prop: { + set: setFun, + get: getFun, + configurable: true + } + }); + return accessorPropertyAttributesAreCorrect(obj, "prop", getFun, setFun, "setVerifyHelpProp", false, true); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-36.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-36.js new file mode 100644 index 000000000..f8c1d276b --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-36.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-36 +description: > + Object.defineProperties - 'P' doesn't exist in 'O', test + [[Configurable]] of 'P' is set as false value if absent in + accessor descriptor 'desc' (8.12.9 step 4.b.i) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = {}; + var getFun = function () { + return 10; + }; + var setFun = function (value) { + obj.setVerifyHelpProp = value; + }; + + Object.defineProperties(obj, { + prop: { + set: setFun, + get: getFun, + enumerable: true + } + }); + return accessorPropertyAttributesAreCorrect(obj, "prop", getFun, setFun, "setVerifyHelpProp", true, false); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-37.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-37.js new file mode 100644 index 000000000..fd0bca98c --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-37.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-37 +description: > + Object.defineProperties - 'desc' is accessor descriptor, test + setting all attribute values of 'P' (8.12.9 step 4.b.i) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = {}; + var getFun = function () { + return 10; + }; + var setFun = function (value) { + obj.setVerifyHelpProp = value; + }; + + Object.defineProperties(obj, { + prop: { + get: getFun, + set: setFun, + enumerable: false, + configurable: false + } + }); + return accessorPropertyAttributesAreCorrect(obj, "prop", getFun, setFun, "setVerifyHelpProp", false, false); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-38-1.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-38-1.js new file mode 100644 index 000000000..368a1f12d --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-38-1.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-38-1 +description: > + Object.defineProperties - 'P' exists in 'O' is an accessor + property, test 'P' makes no change if 'desc' is generic descriptor + without any attribute (8.12.9 step 5) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + var getFunc = function () { + return 12; + }; + Object.defineProperties(obj, { + foo: { + get: getFunc, + enumerable: true, + configurable: true + } + }); + + Object.defineProperties(obj, { foo: {} }); + + return accessorPropertyAttributesAreCorrect(obj, "foo", getFunc, undefined, undefined, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-38.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-38.js new file mode 100644 index 000000000..20dd52651 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-38.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-38 +description: > + Object.defineProperties - 'P' exists in 'O', test 'P' makes no + change if 'desc' is generic descriptor without any attribute + (8.12.9 step 5) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + obj.foo = 100; // default value of attributes: writable: true, configurable: true, enumerable: true + + Object.defineProperties(obj, { foo: {} }); + return dataPropertyAttributesAreCorrect(obj, "foo", 100, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-39.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-39.js new file mode 100644 index 000000000..4849a6cf9 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-39.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-39 +description: > + Object.defineProperties - 'P' is data descriptor and every fields + in 'desc' is the same with 'P' (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + obj.foo = 101; // default value of attributes: writable: true, configurable: true, enumerable: true + + Object.defineProperties(obj, { + foo: { + value: 101, + enumerable: true, + writable: true, + configurable: true + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", 101, true, true, true); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-4.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-4.js new file mode 100644 index 000000000..744774231 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-4.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-4 +description: > + Object.defineProperties - 'P' is own data property that overrides + an inherited accessor property (8.12.9 step 1 ) +includes: [runTestCase.js] +---*/ + +function testcase() { + var proto = {}; + Object.defineProperty(proto, "prop", { + get: function () { + return 11; + }, + configurable: true + }); + var Con = function () { }; + Con.prototype = proto; + + var obj = new Con(); + Object.defineProperty(obj, "prop", { + value: 12, + configurable: false + }); + + try { + Object.defineProperties(obj, { + prop: { + value: 13, + configurable: true + } + }); + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-40.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-40.js new file mode 100644 index 000000000..c823e8a65 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-40.js @@ -0,0 +1,47 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-40 +description: > + Object.defineProperties - 'P' is accessor descriptor and every + fields in 'desc' is the same with 'P' (8.12.9 step 6) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function get_func() { + return 0; + } + function set_func(value) { + obj.setVerifyHelpProp = value; + } + var desc = { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + }; + + Object.defineProperty(obj, "foo", desc); + + Object.defineProperties(obj, { + foo: { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + } + }); + return accessorPropertyAttributesAreCorrect(obj, "foo", get_func, set_func, "setVerifyHelpProp", true, true); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-41.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-41.js new file mode 100644 index 000000000..2e16082d4 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-41.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-41 +description: > + Object.defineProperties - type of desc.value is different from + type of P.value (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + obj.foo = 101; // default value of attributes: writable: true, configurable: true, enumerable: true + + Object.defineProperties(obj, { + foo: { + value: "102" + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", "102", true, true, true); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-42.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-42.js new file mode 100644 index 000000000..4d1958eae --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-42.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-42 +description: > + Object.defineProperties - both desc.value and P.value are + undefined (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + var desc = { value: undefined }; + Object.defineProperty(obj, "foo", desc); + + Object.defineProperties(obj, { + foo: { + value: undefined + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", undefined, false, false, false); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-43.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-43.js new file mode 100644 index 000000000..640630cce --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-43.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-43 +description: > + Object.defineProperties - both desc.value and P.value are null + (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + var desc = { value: null }; + Object.defineProperty(obj, "foo", desc); + + Object.defineProperties(obj, { + foo: { + value: null + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", null, false, false, false); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-44.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-44.js new file mode 100644 index 000000000..b573b3b85 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-44.js @@ -0,0 +1,45 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-44 +description: > + Object.defineProperties - both desc.value and P.value are NaN + (8.12.9 step 6) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + var desc = { value: NaN }; + Object.defineProperty(obj, "foo", desc); + + Object.defineProperties(obj, { + foo: { + value: NaN + } + }); + + var verifyEnumerable = false; + for (var p in obj) { + if (p === "foo") { + verifyEnumerable = true; + } + } + + var verifyValue = false; + obj.prop = "overrideData"; + verifyValue = obj.foo !== obj.foo && isNaN(obj.foo); + + var verifyConfigurable = false; + delete obj.foo; + verifyConfigurable = obj.hasOwnProperty("foo"); + + return verifyConfigurable && !verifyEnumerable && verifyValue; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-45.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-45.js new file mode 100644 index 000000000..a993f783e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-45.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-45 +description: > + Object.defineProperties - desc.value is +0 and P.value is -0 + (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + var desc = { value: -0 }; + Object.defineProperty(obj, "foo", desc); + + try { + Object.defineProperties(obj, { + foo: { + value: +0 + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && dataPropertyAttributesAreCorrect(obj, "foo", -0, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-46.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-46.js new file mode 100644 index 000000000..701be15e4 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-46.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-46 +description: > + Object.defineProperties - desc.value is -0 and P.value is +0 + (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + var desc = { value: +0 }; + Object.defineProperty(obj, "foo", desc); + + try { + Object.defineProperties(obj, { + foo: { + value: -0 + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && dataPropertyAttributesAreCorrect(obj, "foo", +0, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-47.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-47.js new file mode 100644 index 000000000..a67240e60 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-47.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-47 +description: > + Object.defineProperties - desc.value and P.value are two numbers + with the same value (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + var desc = { value: 101 }; + Object.defineProperty(obj, "foo", desc); + + Object.defineProperties(obj, { + foo: { + value: 101 + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", 101, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-48.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-48.js new file mode 100644 index 000000000..5c00c5a11 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-48.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-48 +description: > + Object.defineProperties - desc.value and P.value are two numbers + with different values (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + obj.foo = 101; // default value of attributes: writable: true, configurable: true, enumerable: true + + Object.defineProperties(obj, { + foo: { + value: 102 + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", 102, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-49.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-49.js new file mode 100644 index 000000000..e40d0f9ce --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-49.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-49 +description: > + Object.defineProperties - both desc.value and P.value are two + strings which have same length and same characters in + corresponding positions (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + var desc = { value: "abcd" }; + Object.defineProperty(obj, "foo", desc); + + Object.defineProperties(obj, { + foo: { + value: "abcd" + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", "abcd", false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-5.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-5.js new file mode 100644 index 000000000..74783d010 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-5.js @@ -0,0 +1,40 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-5 +description: > + Object.defineProperties - 'P' is own accessor property (8.12.9 + step 1 ) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = {}; + function getFunc() { + return 11; + } + + Object.defineProperty(obj, "prop", { + get: getFunc, + configurable: false + }); + + try { + Object.defineProperties(obj, { + prop: { + value: 12, + configurable: true + } + }); + return false; + } catch (e) { + return e instanceof TypeError && accessorPropertyAttributesAreCorrect(obj, "prop", getFunc, undefined, undefined, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-50.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-50.js new file mode 100644 index 000000000..72ca8054d --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-50.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-50 +description: > + Object.defineProperties - desc.value and P.value are two strings + with different values (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + obj.foo = "abcd"; // default value of attributes: writable: true, configurable: true, enumerable: true + + Object.defineProperties(obj, { + foo: { + value: "fghj" + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", "fghj", true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-51.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-51.js new file mode 100644 index 000000000..173acbb8b --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-51.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-51 +description: > + Object.defineProperties - both desc.value and P.value are boolean + values with the same value (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + var desc = { value: true }; + Object.defineProperty(obj, "foo", desc); + + Object.defineProperties(obj, { + foo: { + value: true + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", true, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-52.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-52.js new file mode 100644 index 000000000..968030f31 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-52.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-52 +description: > + Object.defineProperties - desc.value and P.value are two boolean + values with different values (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + obj.foo = true; // default value of attributes: writable: true, configurable: true, enumerable: true + + Object.defineProperties(obj, { + foo: { + value: false + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", false, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-53.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-53.js new file mode 100644 index 000000000..2396efc19 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-53.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-53 +description: > + Object.defineProperties - both desc.value and P.value are Ojbects + which refer to the same Object (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + var obj1 = { length: 10 }; + var desc = { value: obj1 }; + Object.defineProperty(obj, "foo", desc); + + Object.defineProperties(obj, { + foo: { + value: obj1 + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", obj1, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-54.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-54.js new file mode 100644 index 000000000..d5aa5a11d --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-54.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-54 +description: > + Object.defineProperties - desc.value and P.value are two Ojbects + which refer to the different objects (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + var obj1 = { length: 10 }; + obj.foo = obj1; // default value of attributes: writable: true, configurable: true, enumerable: true + + var obj2 = { length: 20 }; + + Object.defineProperties(obj, { + foo: { + value: obj2 + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", obj2, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-55.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-55.js new file mode 100644 index 000000000..253e7c7b1 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-55.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-55 +description: > + Object.defineProperties - both desc.writable and P.writable are + boolean values with the same value (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + var desc = { writable: false }; + Object.defineProperty(obj, "foo", desc); + + Object.defineProperties(obj, { + foo: { + writable: false + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", undefined, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-56.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-56.js new file mode 100644 index 000000000..bc9b5be00 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-56.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-56 +description: > + Object.defineProperties - desc.writable and P.writable are two + boolean values with different values (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + var desc = { writable: false, configurable: true }; + Object.defineProperty(obj, "foo", desc); + + Object.defineProperties(obj, { + foo: { + writable: true, + configurable: true + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", undefined, true, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-57.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-57.js new file mode 100644 index 000000000..1fe32cd97 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-57.js @@ -0,0 +1,50 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-57 +description: > + Object.defineProperties - both desc.[[Get]] and P.[[Get]] are two + objects which refer to the same object (8.12.9 step 6) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + function get_Func() { + return 10; + } + + Object.defineProperty(obj, "foo", { + get: get_Func + }); + + Object.defineProperties(obj, { + foo: { + get: get_Func + } + }); + + var verifyEnumerable = false; + for (var p in obj) { + if (p === "foo") { + verifyEnumerable = true; + } + } + + var verifyValue = false; + verifyValue = (obj.foo === 10); + + var verifyConfigurable = false; + delete obj.foo; + verifyConfigurable = obj.hasOwnProperty("foo"); + + var desc = Object.getOwnPropertyDescriptor(obj, "foo"); + return verifyConfigurable && !verifyEnumerable && verifyValue && typeof (desc.set) === "undefined" && desc.get === get_Func; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-58.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-58.js new file mode 100644 index 000000000..dc8532994 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-58.js @@ -0,0 +1,56 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-58 +description: > + Object.defineProperties - desc.[[Get]] and P.[[Get]] are two + objects which refer to the different objects (8.12.9 step 6) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + function get_Func1() { + return 10; + } + + Object.defineProperty(obj, "foo", { + get: get_Func1, + configurable: true + }); + + function get_Func2() { + return 20; + } + + Object.defineProperties(obj, { + foo: { + get: get_Func2 + } + }); + + var verifyEnumerable = false; + for (var p in obj) { + if (p === "foo") { + verifyEnumerable = true; + } + } + + var verifyValue = false; + verifyValue = (obj.foo === 20); + + var desc = Object.getOwnPropertyDescriptor(obj, "foo"); + + var verifyConfigurable = false; + delete obj.foo; + verifyConfigurable = obj.hasOwnProperty("foo"); + + return !verifyConfigurable && !verifyEnumerable && verifyValue && typeof (desc.set) === "undefined" && desc.get === get_Func2; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-59.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-59.js new file mode 100644 index 000000000..3e68bf787 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-59.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-59 +description: > + Object.defineProperties - both desc.[[Set]] and P.[[Set]] are two + objects which refer to the same object (8.12.9 step 6) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function set_func(value) { + obj.setVerifyHelpProp = value; + } + + Object.defineProperty(obj, "foo", { + set: set_func + }); + + Object.defineProperties(obj, { + foo: { + set: set_func + } + }); + return accessorPropertyAttributesAreCorrect(obj, "foo", undefined, set_func, "setVerifyHelpProp", false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-6.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-6.js new file mode 100644 index 000000000..3f9916564 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-6.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-6 +description: > + Object.defineProperties - 'P' is inherited accessor property + (8.12.9 step 1 ) +includes: [runTestCase.js] +---*/ + +function testcase() { + var proto = {}; + Object.defineProperty(proto, "prop", { + get: function () { + return 11; + }, + configurable: false + }); + var Con = function () { }; + Con.prototype = proto; + + var obj = new Con(); + + Object.defineProperties(obj, { + prop: { + get: function () { + return 12; + }, + configurable: true + } + }); + return obj.hasOwnProperty("prop") && obj.prop === 12; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-60.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-60.js new file mode 100644 index 000000000..b190d2349 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-60.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-60 +description: > + Object.defineProperties - desc.[[Set]] and P.[[Set]] are two + objects which refer to the different objects (8.12.9 step 6) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function set_func1() {} + + Object.defineProperty(obj, "foo", { + set: set_func1, + configurable: true + }); + + function set_func2(value) { + obj.setVerifyHelpProp = value; + } + + Object.defineProperties(obj, { + foo: { + set: set_func2 + } + }); + return accessorPropertyAttributesAreCorrect(obj, "foo", undefined, set_func2, "setVerifyHelpProp", false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-61.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-61.js new file mode 100644 index 000000000..7628964a8 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-61.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-61 +description: > + Object.defineProperties - both desc.enumerable and P.enumerable + are boolean values with the same value (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: 10, + enumerable: false + }); + + Object.defineProperties(obj, { + foo: { + enumerable: false + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", 10, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-62.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-62.js new file mode 100644 index 000000000..7caea92ed --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-62.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-62 +description: > + Object.defineProperties - desc.enumerable and P.enumerable are two + boolean values with different values (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: 10, + enumerable: false, + configurable: true + }); + + Object.defineProperties(obj, { + foo: { + enumerable: true + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", 10, false, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-63.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-63.js new file mode 100644 index 000000000..3da10b24b --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-63.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-63 +description: > + Object.defineProperties - both desc.configurable and + P.configurable are boolean values with the same value (8.12.9 step + 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: 10, + configurable: false + }); + + Object.defineProperties(obj, { + foo: { + configurable: false + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", 10, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-64.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-64.js new file mode 100644 index 000000000..7ca8d0582 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-64.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-64 +description: > + Object.defineProperties - desc.configurable and P.configurable are + two boolean values with different values (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: 10, + configurable: true + }); + + Object.defineProperties(obj, { + foo: { + configurable: false + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", 10, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-65.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-65.js new file mode 100644 index 000000000..1b85ed9e1 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-65.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-65 +description: > + Object.defineProperties throws TypeError when P.configurable is + false and desc.configurable is true (8.12.9 step 7.a) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: 10, + configurable: false + }); + + try { + Object.defineProperties(obj, { + foo: { + configurable: true + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && dataPropertyAttributesAreCorrect(obj, "foo", 10, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-66-1.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-66-1.js new file mode 100644 index 000000000..7e28fd8d0 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-66-1.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-66-1 +description: > + Object.defineProperties throws TypeError when P.configurable is + false, P.enumerable and desc.enumerable has different values + (8.12.9 step 7.b) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: 10, + enumerable: false, + configurable: false + }); + + try { + Object.defineProperties(obj, { + foo: { + enumerable: true + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && dataPropertyAttributesAreCorrect(obj, "foo", 10, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-66.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-66.js new file mode 100644 index 000000000..c2e204fdb --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-66.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-66 +description: > + Object.defineProperties throws TypeError when P.configurable is + false, P.enumerable and desc.enumerable has different values + (8.12.9 step 7.b) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: 10, + enumerable: true, + configurable: false + }); + + try { + Object.defineProperties(obj, { + foo: { + enumerable: false + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && dataPropertyAttributesAreCorrect(obj, "foo", 10, false, true, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-67.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-67.js new file mode 100644 index 000000000..d800cad55 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-67.js @@ -0,0 +1,57 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-67 +description: > + Object.defineProperties throws TypeError when P is accessor + property and P.configurable is false, desc is data property + (8.12.9 step 9.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + function get_Func() { + return 10; + } + + Object.defineProperty(obj, "foo", { + get: get_Func, + configurable: false + }); + + try { + Object.defineProperties(obj, { + foo: { + value: 11 + } + }); + return false; + } catch (e) { + var verifyEnumerable = false; + for (var p in obj) { + if (p === "foo") { + verifyEnumerable = true; + } + } + + var verifyValue = false; + verifyValue = (obj.foo === 10); + + var desc = Object.getOwnPropertyDescriptor(obj, "foo"); + + var verifyConfigurable = false; + delete obj.foo; + verifyConfigurable = obj.hasOwnProperty("foo"); + + return e instanceof TypeError && verifyConfigurable && !verifyEnumerable && + verifyValue && typeof (desc.set) === "undefined" && desc.get === get_Func; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-68.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-68.js new file mode 100644 index 000000000..21417771b --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-68.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-68 +description: > + Object.defineProperties throws TypeError when P is data property + and P.configurable is false, desc is accessor property (8.12.9 + step 9.a) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: 10, + configurable: false + }); + + function get_func() { + return 11; + } + + try { + Object.defineProperties(obj, { + foo: { + get: get_func + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && dataPropertyAttributesAreCorrect(obj, "foo", 10, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-69.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-69.js new file mode 100644 index 000000000..9e89d7547 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-69.js @@ -0,0 +1,53 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-69 +description: > + Object.defineProperties - 'P' is data property and P.configurable + is true, desc is accessor property (8.12.9 step 9.b.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: 10, + configurable: true + }); + + function get_Func() { + return 20; + } + + Object.defineProperties(obj, { + foo: { + get: get_Func + } + }); + + var verifyEnumerable = false; + for (var p in obj) { + if (p === "foo") { + verifyEnumerable = true; + } + } + + var verifyValue = false; + verifyValue = (obj.foo === 20); + + var desc = Object.getOwnPropertyDescriptor(obj, "foo"); + + var verifyConfigurable = true; + delete obj.foo; + verifyConfigurable = obj.hasOwnProperty("foo"); + + return !verifyConfigurable && !verifyEnumerable && verifyValue && + typeof desc.set === "undefined" && desc.get === get_Func; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-7.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-7.js new file mode 100644 index 000000000..e9654946f --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-7.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-7 +description: > + Object.defineProperties - 'P' is own accessor property that + overrides an inherited data property (8.12.9 step 1 ) +includes: [runTestCase.js] +---*/ + +function testcase() { + var proto = {}; + Object.defineProperty(proto, "prop", { + value: 11, + configurable: true + }); + var Con = function () { }; + Con.prototype = proto; + + var obj = new Con(); + Object.defineProperty(obj, "prop", { + get: function () { + return 12; + }, + configurable: false + }); + + try { + Object.defineProperties(obj, { + prop: { + value: 13, + configurable: true + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && obj.prop === 12; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-70.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-70.js new file mode 100644 index 000000000..332480ccd --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-70.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-70 +description: > + Object.defineProperties - 'P' is accessor property and + P.configurable is true, 'desc' in 'Properties' is data property + (8.12.9 step 9.c.i) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function get_func() { + return 10; + } + + Object.defineProperty(obj, "foo", { + get: get_func, + configurable: true + }); + + Object.defineProperties(obj, { + foo: { + value: 12 + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", 12, false, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-71.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-71.js new file mode 100644 index 000000000..720bfcfbc --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-71.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-71 +description: > + Object.defineProperties throws TypeError when 'P' is data property + and P.configurable is false, P.writable is false, desc is data + property and desc.writable is true (8.12.9 step 10.a.i) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: 10, + writable: false, + configurable: false + }); + + try { + Object.defineProperties(obj, { + foo: { + writable: true + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && dataPropertyAttributesAreCorrect(obj, "foo", 10, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-72.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-72.js new file mode 100644 index 000000000..8932e5856 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-72.js @@ -0,0 +1,40 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-72 +description: > + Object.defineProperties throws TypeError when P is data property + and P.configurable is false, P.writable is false, desc is data + property and desc.value is not equal to P.value (8.12.9 step + 10.a.ii.1) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: 10, + writable: false, + configurable: false + }); + + try { + Object.defineProperties(obj, { + foo: { + value: 20 + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && dataPropertyAttributesAreCorrect(obj, "foo", 10, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-73.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-73.js new file mode 100644 index 000000000..3e094e30b --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-73.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-73 +description: > + Object.defineProperties will not throw TypeError if P.configurable + is false, P.writalbe is false, P.value is undefined and + properties.value is undefined (8.12.9 step 10.a.ii.1) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: undefined, + writable: false, + configurable: false + }); + + Object.defineProperties(obj, { + foo: { + value: undefined + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", undefined, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-74.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-74.js new file mode 100644 index 000000000..2c304da32 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-74.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-74 +description: > + Object.defineProperties will not throw TypeError if P.configurable + is false, P.writalbe is false, P.value is null and + properties.value is null (8.12.9 step 10.a.ii.1) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: null, + writable: false, + configurable: false + }); + + Object.defineProperties(obj, { + foo: { + value: null + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", null, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-75.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-75.js new file mode 100644 index 000000000..305a4fc34 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-75.js @@ -0,0 +1,52 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-75 +description: > + Object.defineProperties will not throw TypeError if P.configurable + is false, P.writalbe is false, P.value is NaN and properties.value + is NaN (8.12.9 step 10.a.ii.1) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "foo", { + value: NaN, + writable: false, + configurable: false + }); + + Object.defineProperties(obj, { + foo: { + value: NaN + } + }); + + var verifyEnumerable = false; + for (var p in obj) { + if (p === "foo") { + verifyEnumerable = true; + } + } + + obj.prop = "overrideData"; + var verifyValue = false; + verifyValue = obj.foo !== obj.foo && isNaN(obj.foo); + + var desc = Object.getOwnPropertyDescriptor(obj, "foo"); + + var verifyConfigurable = false; + delete obj.foo; + verifyConfigurable = obj.hasOwnProperty("foo"); + + return verifyValue && !verifyEnumerable && verifyConfigurable; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-76.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-76.js new file mode 100644 index 000000000..554f369a2 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-76.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-76 +description: > + Object.defineProperties throws TypeError when P.configurable is + false, P.writalbe is false, properties.value is +0 and P.value is + -0 (8.12.9 step 10.a.ii.1) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: -0, + writable: false, + configurable: false + }); + + try { + Object.defineProperties(obj, { + foo: { + value: +0 + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && dataPropertyAttributesAreCorrect(obj, "foo", -0, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-77.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-77.js new file mode 100644 index 000000000..34fe3b6c5 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-77.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-77 +description: > + Object.defineProperties throws TypeError when P.configurable is + false, P.writalbe is false, properties.value is +0 and P.value is + -0 (8.12.9 step 10.a.ii.1) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: +0, + writable: false, + configurable: false + }); + + try { + Object.defineProperties(obj, { + foo: { + value: -0 + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && dataPropertyAttributesAreCorrect(obj, "foo", +0, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-78.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-78.js new file mode 100644 index 000000000..cdf8636ca --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-78.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-78 +description: > + Object.defineProperties will not throw TypeError when + P.configurable is false, P.writalbe is false, properties.value and + P.value are two numbers with the same value (8.12.9 step 10.a.ii.1) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: 100, + writable: false, + configurable: false + }); + + Object.defineProperties(obj, { + foo: { + value: 100 + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", 100, false, false, false); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-79.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-79.js new file mode 100644 index 000000000..b4b9b841a --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-79.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-79 +description: > + Object.defineProperties throws TypeError when P.configurable is + false, P.writalbe is false, properties.value and P.value are two + numbers with different values (8.12.9 step 10.a.ii.1) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: 10, + writable: false, + configurable: false + }); + + try { + Object.defineProperties(obj, { + foo: { + value: 20 + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && dataPropertyAttributesAreCorrect(obj, "foo", 10, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-8.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-8.js new file mode 100644 index 000000000..721546270 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-8.js @@ -0,0 +1,46 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-8 +description: > + Object.defineProperties - 'P' is own accessor property that + overrides an inherited accessor property (8.12.9 step 1 ) +includes: [runTestCase.js] +---*/ + +function testcase() { + var proto = {}; + Object.defineProperty(proto, "prop", { + get: function() { + return 11; + }, + configurable: true + }); + var Con = function () { }; + Con.prototype = proto; + + var obj = new Con(); + Object.defineProperty(obj, "prop", { + get: function () { + return 12; + }, + configurable: false + }); + + try { + Object.defineProperties(obj, { + prop: { + value: 13, + configurable: true + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && obj.prop === 12; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-80.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-80.js new file mode 100644 index 000000000..b74bf81dd --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-80.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-80 +description: > + Object.defineProperties will not throw TypeError when + P.configurable is false, P.writalbe is false, properties.value and + P.value are two strings with the same value (8.12.9 step 10.a.ii.1) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: "abcd", + writable: false, + configurable: false + }); + + Object.defineProperties(obj, { + foo: { + value: "abcd" + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", "abcd", false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-81.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-81.js new file mode 100644 index 000000000..e0a225461 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-81.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-81 +description: > + Object.defineProperties throws TypeError when P.configurable is + false, P.writalbe is false, properties.value and P.value are two + strings with different values (8.12.9 step 10.a.ii.1) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: "abcd", + writable: false, + configurable: false + }); + + try { + Object.defineProperties(obj, { + foo: { + value: "defg" + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && dataPropertyAttributesAreCorrect(obj, "foo", "abcd", false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-82.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-82.js new file mode 100644 index 000000000..8e8406a35 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-82.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-82 +description: > + Object.defineProperties will not throw TypeError when + P.configurable is false, P.writalbe is false, properties.value and + P.value are two booleans with the same value (8.12.9 step + 10.a.ii.1) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: false, + writable: false, + configurable: false + }); + + Object.defineProperties(obj, { + foo: { + value: false + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", false, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-83.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-83.js new file mode 100644 index 000000000..5a0cf3c05 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-83.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-83 +description: > + Object.defineProperties throws TypeError when P.configurable is + false, P.writalbe is false, properties.value and P.value are two + booleans with different values (8.12.9 step 10.a.ii.1) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: false, + writable: false, + configurable: false + }); + + try { + Object.defineProperties(obj, { + foo: { + value: true + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && dataPropertyAttributesAreCorrect(obj, "foo", false, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-84-1.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-84-1.js new file mode 100644 index 000000000..c77f23793 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-84-1.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-84-1 +description: > + Object.defineProperties will not throw TypeError when + P.configurable is false, P.writalbe is false, properties.value and + P.value are two Objects refer to the same object which has been + updated before use it to update the object (8.12.9 step 10.a.ii.1) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + var obj1 = { length: 10 }; + + Object.defineProperty(obj, "foo", { + value: obj1, + writable: false, + configurable: false + }); + + var obj2 = obj1; + obj2.y = "hello"; + + Object.defineProperties(obj, { + foo: { + value: obj2 + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", obj1, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-84.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-84.js new file mode 100644 index 000000000..d5f9f878f --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-84.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-84 +description: > + Object.defineProperties will not throw TypeError when + P.configurable is false, P.writalbe is false, properties.value and + P.value are two Objects refer to the same object (8.12.9 step + 10.a.ii.1) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + var obj1 = { length: 10 }; + + Object.defineProperty(obj, "foo", { + value: obj1, + writable: false, + configurable: false + }); + + Object.defineProperties(obj, { + foo: { + value: obj1 + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", obj1, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-85.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-85.js new file mode 100644 index 000000000..0e7b1f0e0 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-85.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-85 +description: > + Object.defineProperties throws TypeError when P.configurable is + false, P.writalbe is false, properties.value and P.value are two + objects with different values (8.12.9 step 10.a.ii.1) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + var obj1 = { length: 10 }; + + Object.defineProperty(obj, "foo", { + value: obj1, + writable: false, + configurable: false + }); + + var obj2 = { length: 20 }; + + try { + Object.defineProperties(obj, { + foo: { + value: obj2 + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && dataPropertyAttributesAreCorrect(obj, "foo", obj1, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-86-1.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-86-1.js new file mode 100644 index 000000000..0463add58 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-86-1.js @@ -0,0 +1,46 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-86-1 +description: > + Object.defineProperties will not throw TypeError when + P.configurable is false, both properties.[[Set]] and P.[[Set]] are + two objects which refer to the same object and the object has been + updated after defined(8.12.9 step 11.a.i) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + var set_func = function (value) { + obj.setVerifyHelpProp = value; + } + + Object.defineProperty(obj, "foo", { + set: set_func, + configurable: false + }); + + set_func = function (value) { + obj.setVerifyHelpProp1 = value; + } + + try { + Object.defineProperties(obj, { + foo: { + set: set_func + } + }); + } catch (e) { + return accessorPropertyAttributesAreCorrect(obj, "foo", undefined, set_func, "setVerifyHelpProp", false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-86.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-86.js new file mode 100644 index 000000000..786272d8e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-86.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-86 +description: > + Object.defineProperties will not throw TypeError when + P.configurable is false, both properties.[[Set]] and P.[[Set]] are + two objects which refer to the same object (8.12.9 step 11.a.i) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function set_func(value) { + obj.setVerifyHelpProp = value; + } + + Object.defineProperty(obj, "foo", { + set: set_func, + configurable: false + }); + + Object.defineProperties(obj, { + foo: { + set: set_func + } + }); + return accessorPropertyAttributesAreCorrect(obj, "foo", undefined, set_func, "setVerifyHelpProp", false, false); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-87.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-87.js new file mode 100644 index 000000000..d06e7f744 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-87.js @@ -0,0 +1,45 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-87 +description: > + Object.defineProperties throws TypeError when P.configurable is + false, both properties.[[Set]] and P.[[Set]] are two objects which + refer to different objects (8.12.9 step 11.a.i) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function set_func1(value) { + obj.setVerifyHelpProp = value; + } + + Object.defineProperty(obj, "foo", { + set: set_func1, + configurable: false + }); + + function set_func2() {} + + try { + Object.defineProperties(obj, { + foo: { + set: set_func2 + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && accessorPropertyAttributesAreCorrect(obj, "foo", undefined, set_func1, "setVerifyHelpProp", false, false); + } + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-88.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-88.js new file mode 100644 index 000000000..c2f741608 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-88.js @@ -0,0 +1,57 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-88 +description: > + Object.defineProperties throws TypeError when P.configurable is + false, P.[[Set]] is undefined, properties.[[Set]] refers to an + objcet (8.12.9 step 11.a.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + function get_Func() { + return 0; + } + + Object.defineProperty(obj, "foo", { + set: undefined, + get: get_Func, + enumerable: false, + configurable: false + }); + + function set_Func() { } + + try { + Object.defineProperties(obj, { + foo: { + set: set_Func + } + }); + return false; + } catch (e) { + var verifyEnumerable = false; + for (var p in obj) { + if (p === "foo") { + verifyEnumerable = true; + } + } + + var desc = Object.getOwnPropertyDescriptor(obj, "foo"); + + var verifyConfigurable = false; + delete obj.foo; + verifyConfigurable = obj.hasOwnProperty("foo"); + + return e instanceof TypeError && !verifyEnumerable && verifyConfigurable && typeof (desc.set) === "undefined"; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-89.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-89.js new file mode 100644 index 000000000..208bbd3b0 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-89.js @@ -0,0 +1,52 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-89 +description: > + Object.defineProperties will not throw TypeError when + P.configurable is false, P.[[Set]] and properties.[[Set]] are + undefined (8.12.9 step 11.a.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + function get_Func() { + return 0; + } + + Object.defineProperty(obj, "foo", { + get: get_Func, + set: undefined, + enumerable: false, + configurable: false + }); + + Object.defineProperties(obj, { + foo: { + set: undefined + } + }); + + var verifyEnumerable = false; + for (var p in obj) { + if (p === "foo") { + verifyEnumerable = true; + } + } + + var desc = Object.getOwnPropertyDescriptor(obj, "foo"); + + var verifyConfigurable = false; + delete obj.foo; + verifyConfigurable = obj.hasOwnProperty("foo"); + + return verifyConfigurable && !verifyEnumerable && typeof (desc.set) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-9.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-9.js new file mode 100644 index 000000000..a969a199b --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-9.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-9 +description: > + Object.defineProperties - 'P' is own accessor property without a + get function (8.12.9 step 1 ) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, "prop", { + set: function () { }, + configurable: false + }); + + try { + Object.defineProperties(obj, { + prop: { + get: function () { }, + configurable: true + } + }); + return false; + } catch (e) { + return (e instanceof TypeError); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-90.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-90.js new file mode 100644 index 000000000..c453b3347 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-90.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-90 +description: > + Object.defineProperties will not throw TypeError when + P.configurable is false, both properties.[[Get]] and P.[[Get]] are + two objects which refer to the same object (8.12.9 step 11.a.ii) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function set_func(value) { + obj.setVerifyHelpProp = value; + } + function get_func() { + return 10; + } + + Object.defineProperty(obj, "foo", { + get: get_func, + set: set_func, + enumerable: false, + configurable: false + }); + + Object.defineProperties(obj, { + foo: { + get: get_func + } + }); + return accessorPropertyAttributesAreCorrect(obj, "foo", get_func, set_func, "setVerifyHelpProp", false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-91.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-91.js new file mode 100644 index 000000000..0af65538e --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-91.js @@ -0,0 +1,52 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-91 +description: > + Object.defineProperties throws TypeError when P.configurable is + false, both properties.[[Get]] and P.[[Get]] are two objects which + refer to different objects (8.12.9 step 11.a.ii) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function set_func(value) { + obj.setVerifyHelpProp = value; + } + function get_func1() { + return 10; + } + + Object.defineProperty(obj, "foo", { + get: get_func1, + set: set_func, + enumerable: false, + configurable: false + }); + + function get_func2() { + return 20; + } + + try { + Object.defineProperties(obj, { + foo: { + get: get_func2 + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && accessorPropertyAttributesAreCorrect(obj, "foo", get_func1, set_func, "setVerifyHelpProp", false, false); + } + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-92.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-92.js new file mode 100644 index 000000000..de8e0f3a4 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-92.js @@ -0,0 +1,48 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-92 +description: > + Object.defineProperties throws TypeError when P.configurable is + false, P.[[Get]] is undefined, properties.[[Get]] refers to an + objcet (8.12.9 step 11.a.ii) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function set_func(value) { + obj.setVerifyHelpProp = value; + } + + Object.defineProperty(obj, "foo", { + get: undefined, + set: set_func, + enumerable: false, + configurable: false + }); + + function get_func() { + return 0; + } + + try { + Object.defineProperties(obj, { + foo: { + get: get_func + } + }); + return false; + } catch (e) { + return (e instanceof TypeError) && accessorPropertyAttributesAreCorrect(obj, "foo", undefined, set_func, "setVerifyHelpProp", false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-93-1.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-93-1.js new file mode 100644 index 000000000..0eb423ff4 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-93-1.js @@ -0,0 +1,52 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-93-1 +description: > + Object.defineProperties will update [[Value]] attribute of named + data property 'P' successfully when [[Configurable]] attribute is + true and [[Writable]] attribute is false but not when both are + false (8.12.9 - step Note & 10.a.ii.1) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "property", { + value: 1001, + writable: false, + configurable: true + }); + + Object.defineProperty(obj, "property1", { + value: 1003, + writable: false, + configurable: false + }); + + try { + Object.defineProperties(obj, { + property: { + value: 1002 + }, + property1: { + value: 1004 + } + }); + + return false; + } catch (e) { + return e instanceof TypeError && + dataPropertyAttributesAreCorrect(obj, "property", 1002, false, false, true) && + dataPropertyAttributesAreCorrect(obj, "property1", 1003, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-93-2.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-93-2.js new file mode 100644 index 000000000..1c00fce1a --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-93-2.js @@ -0,0 +1,52 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-93-2 +description: > + Object.defineProperties will update [[Value]] attribute of indexed + data property 'P' successfully when [[Configurable]] attribute is + true and [[Writable]] attribute is false but not when both are + false (8.12.9 - step Note & 10.a.ii.1) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "0", { + value: 1001, + writable: false, + configurable: true + }); + + Object.defineProperty(obj, "1", { + value: 1003, + writable: false, + configurable: false + }); + + try { + Object.defineProperties(obj, { + 0: { + value: 1002 + }, + 1: { + value: 1004 + } + }); + + return false; + } catch (e) { + return e instanceof TypeError && + dataPropertyAttributesAreCorrect(obj, "0", 1002, false, false, true) && + dataPropertyAttributesAreCorrect(obj, "1", 1003, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-93-3.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-93-3.js new file mode 100644 index 000000000..bb2d61cf1 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-93-3.js @@ -0,0 +1,52 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-93-3 +description: > + Object.defineProperties will not fail to update [[Value]] + attribute of named data property 'P' when [[Configurable]] + attribute of first updating property is false (8.12.9 - step Note + & 10.a.ii.1) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "property", { + value: 1001, + writable: false, + configurable: false + }); + + Object.defineProperty(obj, "property1", { + value: 1003, + writable: false, + configurable: true + }); + + try { + Object.defineProperties(obj, { + property: { + value: 1002 + }, + property1: { + value: 1004 + } + }); + + return false; + } catch (e) { + return e instanceof TypeError && + dataPropertyAttributesAreCorrect(obj, "property", 1001, false, false, false) && + dataPropertyAttributesAreCorrect(obj, "property1", 1004, false, false, true); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-93-4.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-93-4.js new file mode 100644 index 000000000..151a5f839 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-93-4.js @@ -0,0 +1,52 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-93-4 +description: > + Object.defineProperties will not fail to update [[Value]] + attribute of indexed data property 'P' when [[Configurable]] + attribute of first updating property are false (8.12.9 - step + Note & 10.a.ii.1) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "0", { + value: 1001, + writable: false, + configurable: false + }); + + Object.defineProperty(obj, "1", { + value: 1003, + writable: false, + configurable: true + }); + + try { + Object.defineProperties(obj, { + 0: { + value: 1002 + }, + 1: { + value: 1004 + } + }); + + return false; + } catch (e) { + return e instanceof TypeError && + dataPropertyAttributesAreCorrect(obj, "0", 1001, false, false, false) && + dataPropertyAttributesAreCorrect(obj, "1", 1004, false, false, true); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-93.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-93.js new file mode 100644 index 000000000..9b472a691 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-93.js @@ -0,0 +1,40 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-93 +description: > + Object.defineProperties will not throw TypeError when + P.configurable is false, P.[[Get]] and properties.[[Get]] are + undefined (8.12.9 step 11.a.ii) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function set_func(value) { + obj.setVerifyHelpProp = value; + } + + Object.defineProperty(obj, "foo", { + get: undefined, + set: set_func, + enumerable: false, + configurable: false + }); + + Object.defineProperties(obj, { + foo: { + get: undefined + } + }); + return accessorPropertyAttributesAreCorrect(obj, "foo", undefined, set_func, "setVerifyHelpProp", false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-94.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-94.js new file mode 100644 index 000000000..9f95b6b70 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-94.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-94 +description: > + Object.defineProperties - 'P' is data property, properties.value + and P.value are two different values (8.12.9 step 12) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + obj.foo = 100; // default value of attributes: writable: true, configurable: true, enumerable: true + + Object.defineProperties(obj, { + foo: { + value: 200 + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", 200, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-95.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-95.js new file mode 100644 index 000000000..3ecad959c --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-95.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-95 +description: > + Object.defineProperties - 'P' is data property, P.value is present + and properties.value is undefined (8.12.9 step 12) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: 200, + enumerable: true, + writable: true, + configurable: true + }); + + Object.defineProperties(obj, { + foo: { + value: undefined + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", undefined, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-96.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-96.js new file mode 100644 index 000000000..931496de9 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-96.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-96 +description: > + Object.defineProperties - 'P' is data property, properties.value + is present and P.value is undefined (8.12.9 step 12) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + Object.defineProperties(obj, { + foo: { + value: 200 + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", 200, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-97.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-97.js new file mode 100644 index 000000000..a666b975b --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-97.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-97 +description: > + Object.defineProperties - 'P' is data property, P.writable and + properties.writable are different values (8.12.9 step 12) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: 100, + enumerable: true, + writable: false, + configurable: true + }); + + Object.defineProperties(obj, { + foo: { + writable: true + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", 100, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-98.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-98.js new file mode 100644 index 000000000..c9a1cf1a1 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-98.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-98 +description: > + Object.defineProperties - 'P' is data property, P.enumerable and + properties.enumerable are different values (8.12.9 step 12) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: 200, + enumerable: false, + writable: true, + configurable: true + }); + + Object.defineProperties(obj, { + foo: { + enumerable: true + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", 200, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperties/15.2.3.7-6-a-99.js b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-99.js new file mode 100644 index 000000000..bafcc5943 --- /dev/null +++ b/test/built-ins/Object/defineProperties/15.2.3.7-6-a-99.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.7-6-a-99 +description: > + Object.defineProperties - 'P' is data property, P.configurable is + true and properties.configurable is false +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: 200, + enumerable: true, + writable: true, + configurable: true + }); + + Object.defineProperties(obj, { + foo: { + configurable: false + } + }); + return dataPropertyAttributesAreCorrect(obj, "foo", 200, true, true, false); + } +runTestCase(testcase); |