diff options
Diffstat (limited to 'test/built-ins/Object/defineProperty')
1121 files changed, 39924 insertions, 0 deletions
diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-0-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-0-1.js new file mode 100644 index 000000000..5abe35b1f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-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.6-0-1 +description: Object.defineProperty must exist as a function +includes: [runTestCase.js] +---*/ + +function testcase() { + var f = Object.defineProperty; + if (typeof(f) === "function") { + return true; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-0-2.js b/test/built-ins/Object/defineProperty/15.2.3.6-0-2.js new file mode 100644 index 000000000..a9b99ccec --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-0-2.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.6-0-2 +description: Object.defineProperty must exist as a function taking 3 parameters +includes: [runTestCase.js] +---*/ + +function testcase() { + if (Object.defineProperty.length === 3) { + return true; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-1-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-1-1.js new file mode 100644 index 000000000..74fd5c34b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-1-1.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.6-1-1 +description: Object.defineProperty applied to undefined throws a TypeError +includes: [runTestCase.js] +---*/ + +function testcase() { + try { + Object.defineProperty(undefined, "foo", {}); + return false; + } catch (e) { + return e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-1-2.js b/test/built-ins/Object/defineProperty/15.2.3.6-1-2.js new file mode 100644 index 000000000..4bd68f83c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-1-2.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.6-1-2 +description: Object.defineProperty applied to null throws a TypeError +includes: [runTestCase.js] +---*/ + +function testcase() { + try { + Object.defineProperty(null, "foo", {}); + return false; + } catch (e) { + return e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-1-3.js b/test/built-ins/Object/defineProperty/15.2.3.6-1-3.js new file mode 100644 index 000000000..a4c6afd4b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-1-3.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.6-1-3 +description: > + Object.defineProperty applied to number primitive throws a + TypeError +includes: [runTestCase.js] +---*/ + +function testcase() { + try { + Object.defineProperty(5, "foo", {}); + return false; + } catch (e) { + return e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-1-4.js b/test/built-ins/Object/defineProperty/15.2.3.6-1-4.js new file mode 100644 index 000000000..e9c8f5296 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-1-4.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.6-1-4 +description: > + Object.defineProperty applied to string primitive throws a + TypeError +includes: [runTestCase.js] +---*/ + +function testcase() { + try { + Object.defineProperty("hello\nworld\\!", "foo", {}); + return false; + } catch (e) { + return e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-1.js new file mode 100644 index 000000000..d6c6792c8 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-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.6-1 +description: > + Object.defineProperty throws TypeError if type of first param is + not Object +includes: [runTestCase.js] +---*/ + +function testcase() { + try { + Object.defineProperty(true, "foo", {}); + } + catch (e) { + if (e instanceof TypeError) { + return true; + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-1.js new file mode 100644 index 000000000..a613839af --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-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.6-2-1 +description: > + Object.defineProperty - argument 'P' is undefined that converts to + string 'undefined' +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, undefined, {}); + + return obj.hasOwnProperty("undefined"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-10.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-10.js new file mode 100644 index 000000000..fa06f51a4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-10.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.6-2-10 +description: > + Object.defineProperty - argument 'P' is a number that converts to + a string (value is a negative number) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, -20, {}); + + return obj.hasOwnProperty("-20"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-11.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-11.js new file mode 100644 index 000000000..955529fea --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-11.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.6-2-11 +description: > + Object.defineProperty - argument 'P' is a number that converts to + a string (value is Infinity) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, Infinity, {}); + + return obj.hasOwnProperty("Infinity"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-12.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-12.js new file mode 100644 index 000000000..c9ec29860 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-12.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.6-2-12 +description: > + Object.defineProperty - argument 'P' is a number that converts to + a string (value is +Infinity) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, +Infinity, {}); + + return obj.hasOwnProperty("Infinity"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-13.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-13.js new file mode 100644 index 000000000..6ead89a9a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-13.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.6-2-13 +description: > + Object.defineProperty - argument 'P' is a number that converts to + a string (value is -Infinity) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, -Infinity, {}); + + return obj.hasOwnProperty("-Infinity"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-14.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-14.js new file mode 100644 index 000000000..2d9fd6c80 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-14.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.6-2-14 +description: > + Object.defineProperty - argument 'P' is a number that converts to + a string (value is 1(following 20 zeros)) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, 100000000000000000000, {}); + + return obj.hasOwnProperty("100000000000000000000"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-15.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-15.js new file mode 100644 index 000000000..5d2168084 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-15.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.6-2-15 +description: > + Object.defineProperty - argument 'P' is a number that converts to + a string (value is 1(following 21 zeros)) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, 1000000000000000000000, {}); + + return obj.hasOwnProperty("1e+21"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-16.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-16.js new file mode 100644 index 000000000..d56418509 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-16.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.6-2-16 +description: > + Object.defineProperty - argument 'P' is a number that converts to + a string (value is 1(following 22 zeros)) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, 10000000000000000000000, {}); + + return obj.hasOwnProperty("1e+22"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-17-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-17-1.js new file mode 100644 index 000000000..14ab142c7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-17-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.6-2-17-1 +description: > + Object.defineProperty - argument 'P' is a number that converts to + a string (value is 1(trailing 5 zeros)) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, 000001, {}); + + return obj.hasOwnProperty("1"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-17.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-17.js new file mode 100644 index 000000000..b21ea2800 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-17.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.6-2-17 +description: > + Object.defineProperty - argument 'P' is a number that converts to + a string (value is 1e+20) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, 1e+20, {}); + + return obj.hasOwnProperty("100000000000000000000"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-18.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-18.js new file mode 100644 index 000000000..f9b9df8e7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-18.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.6-2-18 +description: > + Object.defineProperty - argument 'P' is a number that converts to + string (value is 1e+21) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, 1e+21, {}); + + return obj.hasOwnProperty("1e+21"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-19.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-19.js new file mode 100644 index 000000000..2f61b2e3f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-19.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.6-2-19 +description: > + Object.defineProperty - argument 'P' is a number that converts to + string (value is 1e+22) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, 1e+22, {}); + + return obj.hasOwnProperty("1e+22"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-2.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-2.js new file mode 100644 index 000000000..aff23462f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-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.6-2-2 +description: > + Object.defineProperty - argument 'P' is null that converts to + string 'null' +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, null, {}); + + return obj.hasOwnProperty("null"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-20.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-20.js new file mode 100644 index 000000000..f76f6668f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-20.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.6-2-20 +description: > + Object.defineProperty - argument 'P' is a number that converts to + a string (value is 0.000001) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, 0.000001, {}); + + return obj.hasOwnProperty("0.000001"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-21.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-21.js new file mode 100644 index 000000000..c10786b4e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-21.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.6-2-21 +description: > + Object.defineProperty - argument 'P' is a number that converts to + a string (value is 0.0000001) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, 0.0000001, {}); + + return obj.hasOwnProperty("1e-7"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-22.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-22.js new file mode 100644 index 000000000..2366d0320 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-22.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.6-2-22 +description: > + Object.defineProperty - argument 'P' is a number that converts to + a string (value is 0.00000001) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, 0.00000001, {}); + + return obj.hasOwnProperty("1e-8"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-23.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-23.js new file mode 100644 index 000000000..5081ea39c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-23.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.6-2-23 +description: > + Object.defineProperty - argument 'P' is a number that converts to + a string (value is 1e-7) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, 1e-7, {}); + + return obj.hasOwnProperty("1e-7"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-24.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-24.js new file mode 100644 index 000000000..45449b570 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-24.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.6-2-24 +description: > + Object.defineProperty - argument 'P' is a number that converts to + a string (value is 1e-6) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, 1e-6, {}); + + return obj.hasOwnProperty("0.000001"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-25.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-25.js new file mode 100644 index 000000000..beac3bcfc --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-25.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.6-2-25 +description: > + Object.defineProperty - argument 'P' is a number that converts to + a string (value is 1e-5) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, 1e-5, {}); + + return obj.hasOwnProperty("0.00001"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-26.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-26.js new file mode 100644 index 000000000..dd9540320 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-26.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.6-2-26 +description: > + Object.defineProperty - argument 'P' is an integer that converts + to a string (value is 123) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, 123, {}); + + return obj.hasOwnProperty("123"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-27.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-27.js new file mode 100644 index 000000000..957a12e9c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-27.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.6-2-27 +description: > + Object.defineProperty - argument 'P' is a decimal that converts to + a string (value is 123.456) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, 123.456, {}); + + return obj.hasOwnProperty("123.456"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-28.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-28.js new file mode 100644 index 000000000..d7743d433 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-28.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.6-2-28 +description: > + Object.defineProperty - argument 'P' is a number that converts to + a string (value is 1(following 19 zeros).1) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, 10000000000000000000.1, {}); + + return obj.hasOwnProperty("10000000000000000000"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-29.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-29.js new file mode 100644 index 000000000..b3af7b920 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-29.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.6-2-29 +description: > + Object.defineProperty - argument 'P' is a number that converts to + a string (value is 1(following 20 zeros).1) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, 100000000000000000000.1, {}); + + return obj.hasOwnProperty("100000000000000000000"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-3.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-3.js new file mode 100644 index 000000000..c880b6b28 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-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.6-2-3 +description: > + Object.defineProperty - argument 'P' is a boolean whose value is + false +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, false, {}); + + return obj.hasOwnProperty("false"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-30.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-30.js new file mode 100644 index 000000000..f23f8e02b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-30.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.6-2-30 +description: > + Object.defineProperty - argument 'P' is a number that converts to + a string (value is 1(following 21 zeros).1) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, 1000000000000000000000.1, {}); + + return obj.hasOwnProperty("1e+21"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-31.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-31.js new file mode 100644 index 000000000..27435938f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-31.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.6-2-31 +description: > + Object.defineProperty - argument 'P' is a number that converts to + a string (value is 1(following 22 zeros).1) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, 10000000000000000000000.1, {}); + + return obj.hasOwnProperty("1e+22"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-32.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-32.js new file mode 100644 index 000000000..50abe86ab --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-32.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.6-2-32 +description: > + Object.defineProperty - argument 'P' is a number that converts to + a string (value is 123.1234567) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, 123.1234567, {}); + + return obj.hasOwnProperty("123.1234567"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-33.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-33.js new file mode 100644 index 000000000..7d2b21fa5 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-33.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.6-2-33 +description: Object.defineProperty - argument 'P' is applied to an empty string +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, "", {}); + + return obj.hasOwnProperty(""); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-34.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-34.js new file mode 100644 index 000000000..6a15ee8a5 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-34.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.6-2-34 +description: Object.defineProperty - argument 'P' is applied to string 'AB \cd' +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, "AB\n\\cd", {}); + + return obj.hasOwnProperty("AB\n\\cd"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-35.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-35.js new file mode 100644 index 000000000..7157f4297 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-35.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.6-2-35 +description: > + Object.defineProperty - argument 'P' is applied to string + 'undefined' +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, "undefined", {}); + + return obj.hasOwnProperty("undefined"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-36.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-36.js new file mode 100644 index 000000000..3480258f0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-36.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.6-2-36 +description: Object.defineProperty - argument 'P' is applied to string 'null' +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, "null", {}); + + return obj.hasOwnProperty("null"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-37.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-37.js new file mode 100644 index 000000000..d70cfb676 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-37.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.6-2-37 +description: > + Object.defineProperty - argument 'P' is applied to string + '123αβπcd' +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, "123αβπcd", {}); + + return obj.hasOwnProperty("123αβπcd"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-38.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-38.js new file mode 100644 index 000000000..d2a17b77a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-38.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.6-2-38 +description: Object.defineProperty - argument 'P' is applied to string '1' +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, "1", {}); + + return obj.hasOwnProperty("1"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-39.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-39.js new file mode 100644 index 000000000..d71449d44 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-39.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.6-2-39 +description: > + Object.defineProperty - argument 'P' is an array that converts to + a string +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, [1, 2], {}); + + return obj.hasOwnProperty("1,2"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-4.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-4.js new file mode 100644 index 000000000..deb854fb6 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-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.6-2-4 +description: > + Object.defineProperty - argument 'P' is a boolean whose value is + true +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, true, {}); + + return obj.hasOwnProperty("true"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-40.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-40.js new file mode 100644 index 000000000..19ea0fa14 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-40.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.6-2-40 +description: > + Object.defineProperty - argument 'P' is a String Object that + converts to a string +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, new String("Hello"), {}); + + return obj.hasOwnProperty("Hello"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-41.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-41.js new file mode 100644 index 000000000..6cbe301d2 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-41.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.6-2-41 +description: > + Object.defineProperty - argument 'P' is a Boolean Object that + converts to a string +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, new Boolean(false), {}); + + return obj.hasOwnProperty("false"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-42.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-42.js new file mode 100644 index 000000000..37479f10e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-42.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.6-2-42 +description: > + Object.defineProperty - argument 'P' is a Number Object that + converts to a string +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, new Number(123), {}); + + return obj.hasOwnProperty("123"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-43.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-43.js new file mode 100644 index 000000000..039ff4aad --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-43.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.6-2-43 +description: > + Object.defineProperty - argument 'P' is an object that has an own + toString method +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var ownProp = { + toString: function () { + return "abc"; + } + }; + + Object.defineProperty(obj, ownProp, {}); + + return obj.hasOwnProperty("abc"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-44.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-44.js new file mode 100644 index 000000000..a2047a789 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-44.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.6-2-44 +description: > + Object.defineProperty - argument 'P' is an object that has an own + valueOf method +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var ownProp = { + valueOf: function () { + return "abc"; + }, + toString: undefined + }; + + Object.defineProperty(obj, ownProp, {}); + + return obj.hasOwnProperty("abc"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-45.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-45.js new file mode 100644 index 000000000..3b4cb49aa --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-45.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.6-2-45 +description: > + Object.defineProperty - argument 'P' is an object whose toString + method returns an object and whose valueOf method returns a + primitive value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var toStringAccessed = false; + var valueOfAccessed = false; + + var ownProp = { + toString: function () { + toStringAccessed = true; + return {}; + }, + valueOf: function () { + valueOfAccessed = true; + return "abc"; + } + }; + + Object.defineProperty(obj, ownProp, {}); + + return obj.hasOwnProperty("abc") && valueOfAccessed && toStringAccessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-46.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-46.js new file mode 100644 index 000000000..fbf51d975 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-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.6-2-46 +description: > + Object.defineProperty - argument 'P' is an object that has an own + toString and valueOf method +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var toStringAccessed = false; + var valueOfAccessed = false; + + var ownProp = { + toString: function () { + toStringAccessed = true; + return "abc"; + }, + valueOf: function () { + valueOfAccessed = true; + return "prop"; + } + }; + Object.defineProperty(obj, ownProp, {}); + + return obj.hasOwnProperty("abc") && !valueOfAccessed && toStringAccessed; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-47.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-47.js new file mode 100644 index 000000000..81adbe5cc --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-47.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.6-2-47 +description: > + Object.defineProperty - TypeError exception is thrown when 'P' is + an object that neither toString nor valueOf returns a primitive + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var toStringAccessed = false; + var valueOfAccessed = false; + + var ownProp = { + toString: function () { + toStringAccessed = true; + return {}; + }, + valueOf: function () { + valueOfAccessed = true; + return {}; + } + }; + + try { + Object.defineProperty(obj, ownProp, {}); + return false; + } catch (e) { + return valueOfAccessed && toStringAccessed && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-48.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-48.js new file mode 100644 index 000000000..321623126 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-48.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.6-2-48 +description: > + Object.defineProperty - an inherited toString method is invoked + when 'P' is an object with an own valueOf and an inherited + toString methods +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var toStringAccessed = false; + var valueOfAccessed = false; + + var proto = { + toString: function () { + toStringAccessed = true; + return "test"; + } + }; + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + child.valueOf = function () { + valueOfAccessed = true; + return "10"; + }; + + Object.defineProperty(obj, child, {}); + + return obj.hasOwnProperty("test") && !valueOfAccessed && toStringAccessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-5.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-5.js new file mode 100644 index 000000000..954a83b5b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-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.6-2-5 +description: > + Object.defineProperty - argument 'P' is a number that converts to + a string (value is NaN) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, NaN, {}); + + return obj.hasOwnProperty("NaN"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-6.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-6.js new file mode 100644 index 000000000..8db3c94c0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-6.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.6-2-6 +description: > + Object.defineProperty - argument 'P' is a number that converts to + a string (value is 0) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, 0, {}); + + return obj.hasOwnProperty("0"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-7.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-7.js new file mode 100644 index 000000000..c9788310b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-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.6-2-7 +description: > + Object.defineProperty - argument 'P' is a number that converts to + a string (value is +0) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, +0, {}); + + return obj.hasOwnProperty("0"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-8.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-8.js new file mode 100644 index 000000000..282e72393 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-8.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.6-2-8 +description: > + Object.defineProperty - argument 'P' is a number that converts to + a string (value is -0) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, -0, {}); + + return obj.hasOwnProperty("0"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-2-9.js b/test/built-ins/Object/defineProperty/15.2.3.6-2-9.js new file mode 100644 index 000000000..4f4bf026f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-2-9.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.6-2-9 +description: > + Object.defineProperty - argument 'P' is a number that converts to + a string (value is a positive number) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, 30, {}); + + return obj.hasOwnProperty("30"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-1.js new file mode 100644 index 000000000..fc532647c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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. + +/*--- +info: > + The abtract operation ToPropertyDescriptor is used to package the + into a property desc. Step 10 of ToPropertyDescriptor throws a TypeError + if the property desc ends up having a mix of accessor and data property elements. +es5id: 15.2.3.6-3-1 +description: > + Object.defineProperty throws TypeError if desc has 'get' and + 'value' present(8.10.5 step 9.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // dummy getter + var getter = function () { return 1; } + var desc = { get: getter, value: 101}; + + try { + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError && + (o.hasOwnProperty("foo") === false)) { + return true; + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-10.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-10.js new file mode 100644 index 000000000..504701c9b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-10.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. + +/*--- +info: > + The abtract operation ToPropertyDescriptor is used to package the + into a property desc. Step 10 of ToPropertyDescriptor throws a TypeError + if the property desc ends up having a mix of accessor and data property elements. +es5id: 15.2.3.6-3-10 +description: > + Object.defineProperty throws TypeError if setter is not callable + but not undefined (Number)(8.10.5 step 8.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // dummy setter + var setter = 42; + var desc = { set: setter }; + + try { + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError && + (o.hasOwnProperty("foo") === false)) { + return true; + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-100.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-100.js new file mode 100644 index 000000000..ea910978e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-100.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.6-3-100 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + null (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + Object.defineProperty(obj, "property", { configurable: null }); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + + return beforeDeleted === true && afterDeleted === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-101.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-101.js new file mode 100644 index 000000000..f878d1a3f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-101 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + true (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { configurable: true }); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-102.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-102.js new file mode 100644 index 000000000..895f16d93 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-102 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + false (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + Object.defineProperty(obj, "property", { configurable: false }); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + + return beforeDeleted === true && afterDeleted === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-103.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-103.js new file mode 100644 index 000000000..893ab5fd4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-103 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + 0 (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + Object.defineProperty(obj, "property", { configurable: 0 }); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + + return beforeDeleted === true && afterDeleted === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-104.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-104.js new file mode 100644 index 000000000..af48c109c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-104.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.6-3-104 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + +0 (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { configurable: +0 }); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + + return beforeDeleted === true && afterDeleted === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-105.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-105.js new file mode 100644 index 000000000..977f5035f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-105 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + -0 (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + Object.defineProperty(obj, "property", { configurable: -0 }); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + + return beforeDeleted === true && afterDeleted === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-106.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-106.js new file mode 100644 index 000000000..5861657f4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-106 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + NaN (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + Object.defineProperty(obj, "property", { configurable: NaN }); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + + return beforeDeleted === true && afterDeleted === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-107.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-107.js new file mode 100644 index 000000000..cb8f44dd6 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-107.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.6-3-107 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + a positive number (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { configurable: 12345 }); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-108.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-108.js new file mode 100644 index 000000000..8b8d3d042 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-108.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.6-3-108 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + a negative number (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { configurable: -12345 }); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-109.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-109.js new file mode 100644 index 000000000..a02187def --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-109.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.6-3-109 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + an empty string (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + Object.defineProperty(obj, "property", { configurable: "" }); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + + return beforeDeleted === true && afterDeleted === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-11.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-11.js new file mode 100644 index 000000000..a879caf09 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-11.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. + +/*--- +info: > + The abtract operation ToPropertyDescriptor is used to package the + into a property desc. Step 10 of ToPropertyDescriptor throws a TypeError + if the property desc ends up having a mix of accessor and data property elements. +es5id: 15.2.3.6-3-11 +description: > + Object.defineProperty throws TypeError if setter is not callable + but not undefined (Boolean)(8.10.5 step 8.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // dummy setter + var setter = true; + var desc = { set: setter }; + + try { + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError && + (o.hasOwnProperty("foo") === false)) { + return true; + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-110.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-110.js new file mode 100644 index 000000000..225a6518e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-110.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.6-3-110 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + a non-empty string (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { configurable: " " }); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-111.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-111.js new file mode 100644 index 000000000..79fe42fd9 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-111.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.6-3-111 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + a Function object (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { + configurable: function () { } + }); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-112.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-112.js new file mode 100644 index 000000000..d137fc14b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-112.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.6-3-112 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + an Array object (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { configurable: [1, 2, 3] }); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-113.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-113.js new file mode 100644 index 000000000..13aeecc47 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-113.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.6-3-113 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + a String object (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { configurable: new String("bbq") }); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-114.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-114.js new file mode 100644 index 000000000..3f95b0345 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-114.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.6-3-114 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + a Boolean object (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { configurable: new Boolean(true) }); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-115.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-115.js new file mode 100644 index 000000000..dba2c11bd --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-115.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.6-3-115 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + a Number object (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { configurable: new Number(0) }); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-116.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-116.js new file mode 100644 index 000000000..76a21eb47 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-116.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.6-3-116 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + the Math object (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { configurable: Math }); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-117.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-117.js new file mode 100644 index 000000000..25ddc300f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-117.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.6-3-117 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + a Date object (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { configurable: new Date() }); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-118.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-118.js new file mode 100644 index 000000000..287b0817f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-118 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + a RegExp object (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var attr = { + configurable: new RegExp() + }; + + Object.defineProperty(obj, "property", attr); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-119.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-119.js new file mode 100644 index 000000000..07dbca46a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-119.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.6-3-119 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + the JSON object (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var attr = { + configurable: JSON + }; + + Object.defineProperty(obj, "property", attr); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-12.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-12.js new file mode 100644 index 000000000..af90faf54 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-12.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. + +/*--- +info: > + The abtract operation ToPropertyDescriptor is used to package the + into a property desc. Step 10 of ToPropertyDescriptor throws a TypeError + if the property desc ends up having a mix of accessor and data property elements. +es5id: 15.2.3.6-3-12 +description: > + Object.defineProperty throws TypeError if setter is not callable + but not undefined (String)(8.10.5 step 8.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // dummy setter + var setter = "abc"; + var desc = { set: setter }; + + try { + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError && + (o.hasOwnProperty("foo") === false)) { + return true; + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-120.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-120.js new file mode 100644 index 000000000..64ef26ed8 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-120.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.6-3-120 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + a Error object (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var attr = { + configurable: new SyntaxError() + }; + + Object.defineProperty(obj, "property", attr); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-121.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-121.js new file mode 100644 index 000000000..dc104742e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-121.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.6-3-121 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + the Argument object (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var argObj = (function () { return arguments; })(1, true, "a"); + + var attr = { + configurable: argObj + }; + + Object.defineProperty(obj, "property", attr); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-123.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-123.js new file mode 100644 index 000000000..73a89c462 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-123.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.6-3-123 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + the global object (8.10.5 step 4.b) +includes: + - runTestCase.js + - fnGlobalObject.js +---*/ + +function testcase() { + var obj = {}; + + var attr = { + configurable: fnGlobalObject() + }; + + Object.defineProperty(obj, "property", attr); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-124.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-124.js new file mode 100644 index 000000000..a90e21cb0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-124.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.6-3-124 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + treated as true when it is a string (value is 'false') (8.10.5 + step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var attr = { + configurable: "false" + }; + + Object.defineProperty(obj, "property", attr); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-125.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-125.js new file mode 100644 index 000000000..a39811e03 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-125.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.6-3-125 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + treated as true when it is new Boolean(false) (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var attr = { + configurable: new Boolean(false) + }; + + Object.defineProperty(obj, "property", attr); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-126.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-126.js new file mode 100644 index 000000000..fa9d6ff0e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-126.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.6-3-126 +description: > + Object.defineProperty - 'value' property in 'Attributes' is + present (8.10.5 step 5) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var attr = { value: 100 }; + + Object.defineProperty(obj, "property", attr); + + return obj.property === 100; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-127.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-127.js new file mode 100644 index 000000000..5191395c3 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-127 +description: > + Object.defineProperty - 'value' property in 'Attributes' is not + present (8.10.5 step 5) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var attr = { + writable: true + }; + + Object.defineProperty(obj, "property", attr); + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-129.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-129.js new file mode 100644 index 000000000..69c122c4f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-129 +description: > + Object.defineProperty - 'value' property in 'Attributes' is an + inherited data property (8.10.5 step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var proto = { + value: "inheritedDataProperty" + }; + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + + Object.defineProperty(obj, "property", child); + + return obj.property === "inheritedDataProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-13.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-13.js new file mode 100644 index 000000000..9f3c3f861 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-13.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. + +/*--- +info: > + The abtract operation ToPropertyDescriptor is used to package the + into a property desc. Step 10 of ToPropertyDescriptor throws a TypeError + if the property desc ends up having a mix of accessor and data property elements. +es5id: 15.2.3.6-3-13 +description: > + Object.defineProperty throws TypeError if the setter in desc is + not callable (Null)(8.10.5 step 8.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // dummy setter + var setter = null; + var desc = { set: setter }; + + try { + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError && + (o.hasOwnProperty("foo") === false)) { + return true; + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-130.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-130.js new file mode 100644 index 000000000..ed4c549c1 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-130.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.6-3-130 +description: > + Object.defineProperty - 'value' property in 'Attributes' 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 ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + + child.value = "ownDataProperty"; + + Object.defineProperty(obj, "property", child); + + return obj.property === "ownDataProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-131.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-131.js new file mode 100644 index 000000000..85283b1c3 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-131.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.6-3-131 +description: > + Object.defineProperty - 'value' property in 'Attributes' 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 ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + Object.defineProperty(child, "value", { + value: "ownDataProperty" + }); + + Object.defineProperty(obj, "property", child); + + return obj.property === "ownDataProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-132.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-132.js new file mode 100644 index 000000000..11117074e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-132 +description: > + Object.defineProperty - 'value' property in 'Attributes' is own + accessor property (8.10.5 step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var attr = {}; + Object.defineProperty(attr, "value", { + get: function () { + return "ownAccessorProperty"; + } + }); + + Object.defineProperty(obj, "property", attr); + + return obj.property === "ownAccessorProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-133.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-133.js new file mode 100644 index 000000000..c31417353 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-133.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.6-3-133 +description: > + Object.defineProperty - 'value' property in 'Attributes' is 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 ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + + Object.defineProperty(obj, "property", child); + + return obj.property === "inheritedAccessorProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-134.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-134.js new file mode 100644 index 000000000..8114741f6 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-134.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.6-3-134 +description: > + Object.defineProperty - 'value' property in 'Attributes' 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 ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + Object.defineProperty(child, "value", { + get: function () { + return "ownAccessorProperty"; + } + }); + + Object.defineProperty(obj, "property", child); + + return obj.property === "ownAccessorProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-135.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-135.js new file mode 100644 index 000000000..198d51770 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-135.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.6-3-135 +description: > + Object.defineProperty - 'value' property in 'Attributes' 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 ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + Object.defineProperty(child, "value", { + get: function () { + return "ownAccessorProperty"; + } + }); + + Object.defineProperty(obj, "property", child); + + return obj.property === "ownAccessorProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-136.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-136.js new file mode 100644 index 000000000..4c9504301 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-136.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.6-3-136 +description: > + Object.defineProperty - 'value' property in 'Attributes' is own + accessor property without a get function (8.10.5 step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var attr = {}; + Object.defineProperty(attr, "value", { + set: function () { } + }); + + Object.defineProperty(obj, "property", attr); + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-137.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-137.js new file mode 100644 index 000000000..e91218fe5 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-137.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.6-3-137 +description: > + Object.defineProperty - 'value' property in 'Attributes' 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 ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + Object.defineProperty(child, "value", { + set : function () { } + }); + + Object.defineProperty(obj, "property", child); + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-138.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-138.js new file mode 100644 index 000000000..d42fe862f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-138.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.6-3-138 +description: > + Object.defineProperty - 'value' property in 'Attributes' is an + inherited accessor property without a get function (8.10.5 step + 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { property : 120 }; + + var proto = {}; + Object.defineProperty(proto, "value", { + set: function () { } + }); + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + + Object.defineProperty(obj, "property", child); + + return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-139-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-139-1.js new file mode 100644 index 000000000..07216abce --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-139-1.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.6-3-139-1 +description: > + Object.defineProperty - 'Attributes' is a Function object which + implements its own [[Get]] method to access the 'value' property + of prototype object (8.10.5 step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Function.prototype.value = "Function"; + var funObj = function (a, b) { + return a + b; + }; + + Object.defineProperty(obj, "property", funObj); + + return obj.property === "Function"; + } finally { + delete Function.prototype.value; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-139.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-139.js new file mode 100644 index 000000000..85ff4c3c0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-139.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.6-3-139 +description: > + Object.defineProperty - 'Attributes' is a Function object which + implements its own [[Get]] method to access the 'value' property + (8.10.5 step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var funObj = function (a, b) { + return a + b; + }; + + funObj.value = "Function"; + + Object.defineProperty(obj, "property", funObj); + + return obj.property === "Function"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-14.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-14.js new file mode 100644 index 000000000..a4de681f7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-14.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. + +/*--- +info: > + The abtract operation ToPropertyDescriptor is used to package the + into a property desc. Step 10 of ToPropertyDescriptor throws a TypeError + if the property desc ends up having a mix of accessor and data property elements. +es5id: 15.2.3.6-3-14 +description: > + Object.defineProperty throws TypeError if setter is not callable + but not undefined (Object)(8.10.5 step 8.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // dummy getter + var setter = { a: 1 }; + var desc = { set: setter }; + + try { + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError && + (o.hasOwnProperty("foo") === false)) { + return true; + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-140-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-140-1.js new file mode 100644 index 000000000..e821ab8d0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-140-1.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.6-3-140-1 +description: > + Object.defineProperty - 'Attributes' is an Array object that uses + Object's [[Get]] method to access the 'value' property of + prototype object (8.10.5 step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Array.prototype.value = "Array"; + var arrObj = [1, 2, 3]; + + Object.defineProperty(obj, "property", arrObj); + + return obj.property === "Array"; + } finally { + delete Array.prototype.value; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-140.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-140.js new file mode 100644 index 000000000..69dee9595 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-140 +description: > + Object.defineProperty - 'Attributes' is an Array object that uses + Object's [[Get]] method to access the 'value' property (8.10.5 + step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var arrObj = [1, 2, 3]; + + arrObj.value = "Array"; + + Object.defineProperty(obj, "property", arrObj); + + return obj.property === "Array"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-141-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-141-1.js new file mode 100644 index 000000000..2222e356f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-141-1.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.6-3-141-1 +description: > + Object.defineProperty - 'Attributes' is a String object that uses + Object's [[Get]] method to access the 'value' property of + prototype object (8.10.5 step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + String.prototype.value = "String"; + var strObj = new String("abc"); + + Object.defineProperty(obj, "property", strObj); + + return obj.property === "String"; + } finally { + delete String.prototype.value; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-141.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-141.js new file mode 100644 index 000000000..17feb99f1 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-141.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.6-3-141 +description: > + Object.defineProperty - 'Attributes' is a String object that uses + Object's [[Get]] method to access the 'value' property (8.10.5 + step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var strObj = new String("abc"); + + strObj.value = "String"; + + Object.defineProperty(obj, "property", strObj); + + return obj.property === "String"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-142-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-142-1.js new file mode 100644 index 000000000..fe7466733 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-142-1.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.6-3-142-1 +description: > + Object.defineProperty - 'Attributes' is a Boolean object that uses + Object's [[Get]] method to access the 'value' property of + prototype object (8.10.5 step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Boolean.prototype.value = "Boolean"; + var boolObj = new Boolean(true); + + Object.defineProperty(obj, "property", boolObj); + + return obj.property === "Boolean"; + } finally { + delete Boolean.prototype.value; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-142.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-142.js new file mode 100644 index 000000000..c8d2075a4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-142.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.6-3-142 +description: > + Object.defineProperty - 'Attributes' is a Boolean object that uses + Object's [[Get]] method to access the 'value' property (8.10.5 + step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var boolObj = new Boolean(true); + + boolObj.value = "Boolean"; + + Object.defineProperty(obj, "property", boolObj); + + return obj.property === "Boolean"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-143-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-143-1.js new file mode 100644 index 000000000..e55b95cfa --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-143-1.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.6-3-143-1 +description: > + Object.defineProperty - 'Attributes' is a Number object that uses + Object's [[Get]] method to access the 'value' property of + prototype object (8.10.5 step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Number.prototype.value = "Number"; + var numObj = new Number(-2); + + Object.defineProperty(obj, "property", numObj); + + return obj.property === "Number"; + } finally { + delete Number.prototype.value; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-143.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-143.js new file mode 100644 index 000000000..6937caacf --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-143.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.6-3-143 +description: > + Object.defineProperty - 'Attributes' is a Number object that uses + Object's [[Get]] method to access the 'value' property (8.10.5 + step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var numObj = new Number(-2); + + numObj.value = "Number"; + + Object.defineProperty(obj, "property", numObj); + + return obj.property === "Number"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-144-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-144-1.js new file mode 100644 index 000000000..336b7d714 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-144-1.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.6-3-144-1 +description: > + Object.defineProperty - 'Attributes' is the Math object that uses + Object's [[Get]] method to access the 'value' property of + prototype object (8.10.5 step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + Object.prototype.value = "Math"; + + Object.defineProperty(obj, "property", Math); + + return obj.property === "Math"; + } finally { + delete Object.prototype.value; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-144.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-144.js new file mode 100644 index 000000000..615b8fb1a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-144.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.6-3-144 +description: > + Object.defineProperty - 'Attributes' is the Math object that uses + Object's [[Get]] method to access the 'value' property (8.10.5 + step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + Math.value = "Math"; + + Object.defineProperty(obj, "property", Math); + + return obj.property === "Math"; + } finally { + delete Math.value; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-145-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-145-1.js new file mode 100644 index 000000000..461aa00ac --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-145-1.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.6-3-145-1 +description: > + Object.defineProperty - 'Attributes' is a Date object that uses + Object's [[Get]] method to access the 'value' property of + prototype object (8.10.5 step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Date.prototype.value = "Date"; + var dateObj = new Date(); + + Object.defineProperty(obj, "property", dateObj); + + return obj.property === "Date"; + } finally { + delete Date.prototype.value; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-145.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-145.js new file mode 100644 index 000000000..857800b2c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-145.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.6-3-145 +description: > + Object.defineProperty - 'Attributes' is a Date object that uses + Object's [[Get]] method to access the 'value' property (8.10.5 + step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var dateObj = new Date(); + + dateObj.value = "Date"; + + Object.defineProperty(obj, "property", dateObj); + + return obj.property === "Date"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-146-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-146-1.js new file mode 100644 index 000000000..530b66338 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-146-1.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.6-3-146-1 +description: > + Object.defineProperty - 'Attributes' is a RegExp object that uses + Object's [[Get]] method to access the 'value' property of + prototype object (8.10.5 step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + RegExp.prototype.value = "RegExp"; + var regObj = new RegExp(); + + Object.defineProperty(obj, "property", regObj); + + return obj.property === "RegExp"; + } finally { + delete RegExp.prototype.value; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-146.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-146.js new file mode 100644 index 000000000..faca06d19 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-146.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.6-3-146 +description: > + Object.defineProperty - 'Attributes' is a RegExp object that uses + Object's [[Get]] method to access the 'value' property (8.10.5 + step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var regObj = new RegExp(); + + regObj.value = "RegExp"; + + Object.defineProperty(obj, "property", regObj); + + return obj.property === "RegExp"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-147-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-147-1.js new file mode 100644 index 000000000..b617e4d24 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-147-1.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.6-3-147-1 +description: > + Object.defineProperty - 'Attributes' is the JSON object that uses + Object's [[Get]] method to access the 'value' property of + prototype object (8.10.5 step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + Object.prototype.value = "JSON"; + + Object.defineProperty(obj, "property", JSON); + + return obj.property === "JSON"; + } finally { + delete Object.prototype.value; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-147.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-147.js new file mode 100644 index 000000000..217da83b4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-147.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.6-3-147 +description: > + Object.defineProperty - 'Attributes' is the JSON object that uses + Object's [[Get]] method to access the 'value' property (8.10.5 + step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + JSON.value = "JSON"; + + Object.defineProperty(obj, "property", JSON); + + return obj.property === "JSON"; + } finally { + delete JSON.value; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-148-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-148-1.js new file mode 100644 index 000000000..1334a2594 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-148-1.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.6-3-148-1 +description: > + Object.defineProperty - 'Attributes' is an Error object that uses + Object's [[Get]] method to access the 'value' property of + prototype object (8.10.5 step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Error.prototype.value = "Error"; + var errObj = new Error(); + + Object.defineProperty(obj, "property", errObj); + + return obj.property === "Error"; + } finally { + delete Error.prototype.value; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-148.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-148.js new file mode 100644 index 000000000..e250bc2e5 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-148.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.6-3-148 +description: > + Object.defineProperty - 'Attributes' is an Error object that uses + Object's [[Get]] method to access the 'value' property (8.10.5 + step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var errObj = new Error(); + + errObj.value = "Error"; + + Object.defineProperty(obj, "property", errObj); + + return obj.property === "Error"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-149-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-149-1.js new file mode 100644 index 000000000..765b841e8 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-149-1.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.6-3-149-1 +description: > + Object.defineProperty - 'Attributes' is an Arguments object which + implements its own [[Get]] method to access the 'value' property + of prototype object (8.10.5 step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Object.prototype.value = "arguments"; + var argObj = (function () { return arguments; })(); + + + Object.defineProperty(obj, "property", argObj); + + return obj.property === "arguments"; + } finally { + delete Object.prototype.value; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-149.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-149.js new file mode 100644 index 000000000..bad7cef1f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-149.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.6-3-149 +description: > + Object.defineProperty - 'Attributes' is an Arguments object which + implements its own [[Get]] method to access the 'value' property + (8.10.5 step 5.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var argObj = (function () { return arguments; })(); + + argObj.value = "arguments"; + + Object.defineProperty(obj, "property", argObj); + + return obj.property === "arguments"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-15.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-15.js new file mode 100644 index 000000000..8bf41e6cf --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-15.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.6-3-15 +description: Object.defineProperty - 'Attributes' is undefined (8.10.5 step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + try { + Object.defineProperty(obj, "property", undefined); + return false; + } catch (e) { + return e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-151.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-151.js new file mode 100644 index 000000000..777b7cce4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-151.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.6-3-151 +description: > + Object.defineProperty - 'Attributes' is the global object that + uses Object's [[Get]] method to access the 'value' property + (8.10.5 step 5.a) +includes: + - runTestCase.js + - fnGlobalObject.js +---*/ + +function testcase() { + var obj = {}; + + try { + fnGlobalObject().value = "global"; + + Object.defineProperty(obj, "property", fnGlobalObject()); + + return obj.property === "global"; + } finally { + delete fnGlobalObject().value; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-152.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-152.js new file mode 100644 index 000000000..fd02b8007 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-152.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.6-3-152 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is + present (8.10.5 step 6) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var attr = { + writable: false + }; + + Object.defineProperty(obj, "property", attr); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-153.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-153.js new file mode 100644 index 000000000..9a762117c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-153.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.6-3-153 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is not + present (8.10.5 step 6) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var attr = { + value: 100 + }; + + Object.defineProperty(obj, "property", attr); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-154.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-154.js new file mode 100644 index 000000000..97cf1abb0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-154.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.6-3-154 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is own + data property (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var attr = { + writable: true + }; + + Object.defineProperty(obj, "property", attr); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-155.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-155.js new file mode 100644 index 000000000..f8afd363f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-155.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.6-3-155 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is an + inherited data property (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var proto = { + writable: true + }; + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + + Object.defineProperty(obj, "property", child); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-156.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-156.js new file mode 100644 index 000000000..6518cd9d1 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-156.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.6-3-156 +description: > + Object.defineProperty - 'writable' property in 'Attributes' 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: false + }; + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + child.writable = true; + + Object.defineProperty(obj, "property", child); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-157.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-157.js new file mode 100644 index 000000000..80e05f438 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-157.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.6-3-157 +description: > + Object.defineProperty - 'writable' property in 'Attributes' 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 = { }; + Object.defineProperty(proto, "writable", { + get : function () { + return false; + } + }); + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + Object.defineProperty(child, "writable", { + value: true + }); + + Object.defineProperty(obj, "property", child); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-158.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-158.js new file mode 100644 index 000000000..a5ff86524 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-158.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.6-3-158 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is own + accessor property (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var attr = { }; + Object.defineProperty(attr, "writable", { + get: function () { + return true; + } + }); + + Object.defineProperty(obj, "property", attr); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-159.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-159.js new file mode 100644 index 000000000..42740b6d0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-159.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.6-3-159 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is 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 ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + + Object.defineProperty(obj, "property", child); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-16.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-16.js new file mode 100644 index 000000000..f9aba0242 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-16.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.6-3-16 +description: Object.defineProperty - 'Attributes' is null (8.10.5 step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + + try { + Object.defineProperty({}, "property", null); + return false; + } catch (e) { + return e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-160.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-160.js new file mode 100644 index 000000000..02c75e523 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-160.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.6-3-160 +description: > + Object.defineProperty - 'writable' property in 'Attributes' 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: false + }; + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + Object.defineProperty(child, "writable", { + get: function () { + return true; + } + }); + + Object.defineProperty(obj, "property", child); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-161.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-161.js new file mode 100644 index 000000000..f5abcd741 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-161.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.6-3-161 +description: > + Object.defineProperty - 'writable' property in 'Attributes' 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 false; + } + }); + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + Object.defineProperty(child, "writable", { + get: function () { + return true; + } + }); + + Object.defineProperty(obj, "property", child); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-162.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-162.js new file mode 100644 index 000000000..93b038073 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-162 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is own + accessor property without a get function (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var attr = {}; + Object.defineProperty(attr, "writable", { + set: function () { } + }); + + Object.defineProperty(obj, "property", attr); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (typeof (obj.property) === "undefined"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-163.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-163.js new file mode 100644 index 000000000..eec5ba503 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-163.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.6-3-163 +description: > + Object.defineProperty - 'writable' property in 'Attributes' 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 ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + Object.defineProperty(child, "writable", { + set: function () { } + }); + + Object.defineProperty(obj, "property", child); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (typeof (obj.property) === "undefined"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-164.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-164.js new file mode 100644 index 000000000..6af11bec0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-164.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.6-3-164 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is an + 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 ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + + Object.defineProperty(obj, "property", child); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (typeof (obj.property) === "undefined"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-165-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-165-1.js new file mode 100644 index 000000000..574adf5c8 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-165-1.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.6-3-165-1 +description: > + Object.defineProperty - 'Attributes' is a Function object which + implements its own [[Get]] method to access the 'writable' + property of prototype object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + Function.prototype.writable = true; + var funObj = function (a, b) { + return a + b; + }; + + Object.defineProperty(obj, "property", funObj); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } finally { + delete Function.prototype.writable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-165.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-165.js new file mode 100644 index 000000000..39d52f48f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-165.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.6-3-165 +description: > + Object.defineProperty - 'Attributes' is a Function object which + implements its own [[Get]] method to access the 'writable' + property (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var funObj = function (a, b) { + return a + b; + }; + + funObj.writable = true; + + Object.defineProperty(obj, "property", funObj); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-166-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-166-1.js new file mode 100644 index 000000000..880f49495 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-166-1.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.6-3-166-1 +description: > + Object.defineProperty - 'Attributes' is an Array object that uses + Object's [[Get]] method to access the 'writable' property of + prototype object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Array.prototype.writable = true; + var arrObj = [1, 2, 3]; + + Object.defineProperty(obj, "property", arrObj); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } finally { + delete Array.prototype.writable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-166.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-166.js new file mode 100644 index 000000000..bbb4491df --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-166.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.6-3-166 +description: > + Object.defineProperty - 'Attributes' is an Array object that uses + Object's [[Get]] method to access the 'writable' property (8.10.5 + step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var arrObj = [1, 2, 3]; + + arrObj.writable = true; + + Object.defineProperty(obj, "property", arrObj); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-167-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-167-1.js new file mode 100644 index 000000000..fbb04eafd --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-167-1.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.6-3-167-1 +description: > + Object.defineProperty - 'Attributes' is a String object that uses + Object's [[Get]] method to access the 'writable' property of + prototype object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + String.prototype.writable = true; + var strObj = new String("abc"); + + Object.defineProperty(obj, "property", strObj); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } finally { + delete String.prototype.writable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-167.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-167.js new file mode 100644 index 000000000..59fcde077 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-167.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.6-3-167 +description: > + Object.defineProperty - 'Attributes' is a String object that uses + Object's [[Get]] method to access the 'writable' property (8.10.5 + step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var strObj = new String("abc"); + + strObj.writable = true; + + Object.defineProperty(obj, "property", strObj); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-168-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-168-1.js new file mode 100644 index 000000000..e9e7f015d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-168-1.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.6-3-168-1 +description: > + Object.defineProperty - 'Attributes' is a Boolean object that uses + Object's [[Get]] method to access the 'writable' property of + prototype object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Boolean.prototype.writable = true; + var boolObj = new Boolean(true); + + Object.defineProperty(obj, "property", boolObj); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } finally { + delete Boolean.prototype.writable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-168.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-168.js new file mode 100644 index 000000000..26b35c38b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-168.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.6-3-168 +description: > + Object.defineProperty - 'Attributes' is a Boolean object that uses + Object's [[Get]] method to access the 'writable' property (8.10.5 + step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var boolObj = new Boolean(true); + + boolObj.writable = true; + + Object.defineProperty(obj, "property", boolObj); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-169-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-169-1.js new file mode 100644 index 000000000..ff598320a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-169-1.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.6-3-169-1 +description: > + Object.defineProperty - 'Attributes' is a Number object that uses + Object's [[Get]] method to access the 'writable' property of + prototype object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Number.prototype.writable = true; + var numObj = new Number(-2); + + Object.defineProperty(obj, "property", numObj); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } finally { + delete Number.prototype.writable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-169.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-169.js new file mode 100644 index 000000000..be7edfa55 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-169.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.6-3-169 +description: > + Object.defineProperty - 'Attributes' is a Number object that uses + Object's [[Get]] method to access the 'writable' property (8.10.5 + step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var numObj = new Number(-2); + + numObj.writable = true; + + Object.defineProperty(obj, "property", numObj); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-17.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-17.js new file mode 100644 index 000000000..8db2a2edf --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-17.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.6-3-17 +description: > + Object.defineProperty - 'Attributes' is a boolean primitive + (8.10.5 step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + + try { + Object.defineProperty({}, "property", true); + return false; + } catch (e) { + return e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-170-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-170-1.js new file mode 100644 index 000000000..d12a0035a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-170-1.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.6-3-170-1 +description: > + Object.defineProperty - 'Attributes' is the Math object that uses + Object's [[Get]] method to access the 'writable' property of + prototype object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + Object.prototype.writable = true; + + Object.defineProperty(obj, "property", Math); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } finally { + delete Object.prototype.writable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-170.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-170.js new file mode 100644 index 000000000..1ccf6d913 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-170.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.6-3-170 +description: > + Object.defineProperty - 'Attributes' is the Math object that uses + Object's [[Get]] method to access the 'writable' property (8.10.5 + step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + Math.writable = true; + + Object.defineProperty(obj, "property", Math); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } finally { + delete Math.writable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-171-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-171-1.js new file mode 100644 index 000000000..5489c6786 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-171-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.6-3-171-1 +description: > + Object.defineProperty - 'Attributes' is a Date object that uses + Object's [[Get]] method to access the 'writable' property of + prototype object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Date.prototype.writable = true; + + dateObj = new Date(); + + Object.defineProperty(obj, "property", dateObj); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } finally { + delete Date.prototype.writable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-171.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-171.js new file mode 100644 index 000000000..c36513312 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-171.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.6-3-171 +description: > + Object.defineProperty - 'Attributes' is a Date object that uses + Object's [[Get]] method to access the 'writable' property (8.10.5 + step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var dateObj = new Date(); + + dateObj.writable = true; + + Object.defineProperty(obj, "property", dateObj); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-172-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-172-1.js new file mode 100644 index 000000000..5b6e15c9c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-172-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.6-3-172-1 +description: > + Object.defineProperty - 'Attributes' is a RegExp object that uses + Object's [[Get]] method to access the 'writable' property of + prototype object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + RegExp.prototype.writable = true; + + var regObj = new RegExp(); + + Object.defineProperty(obj, "property", regObj); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } finally { + delete RegExp.prototype.writable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-172.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-172.js new file mode 100644 index 000000000..3a53ac2e2 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-172.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.6-3-172 +description: > + Object.defineProperty - 'Attributes' is a RegExp object that uses + Object's [[Get]] method to access the 'writable' property (8.10.5 + step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var regObj = new RegExp(); + + regObj.writable = true; + + Object.defineProperty(obj, "property", regObj); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-173-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-173-1.js new file mode 100644 index 000000000..c3f7e388e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-173-1.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.6-3-173-1 +description: > + Object.defineProperty - 'Attributes' is the JSON object that uses + Object's [[Get]] method to access the 'writable' property of + prototype object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + Object.prototype.writable = true; + + Object.defineProperty(obj, "property", JSON); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } finally { + delete Object.prototype.writable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-173.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-173.js new file mode 100644 index 000000000..4b1183d15 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-173.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.6-3-173 +description: > + Object.defineProperty - 'Attributes' is the JSON object that uses + Object's [[Get]] method to access the 'writable' property (8.10.5 + step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + JSON.writable = true; + + Object.defineProperty(obj, "property", JSON); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } finally { + delete JSON.writable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-174-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-174-1.js new file mode 100644 index 000000000..d24d8f9e9 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-174-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.6-3-174-1 +description: > + Object.defineProperty - 'Attributes' is an Error object that uses + Object's [[Get]] method to access the 'writable' property of + prototype object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Error.prototype.writable = true; + + var errObj = new Error(); + + Object.defineProperty(obj, "property", errObj); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } finally { + delete Error.prototype.writable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-174.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-174.js new file mode 100644 index 000000000..39b9474f7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-174.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.6-3-174 +description: > + Object.defineProperty - 'Attributes' is an Error object that uses + Object's [[Get]] method to access the 'writable' property (8.10.5 + step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var errObj = new Error(); + + errObj.writable = true; + + Object.defineProperty(obj, "property", errObj); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-175-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-175-1.js new file mode 100644 index 000000000..db69c5089 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-175-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.6-3-175-1 +description: > + Object.defineProperty - 'Attributes' is an Arguments object which + implements its own [[Get]] method to access the 'writable' + property of prototype object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Object.prototype.writable = true; + + var argObj = (function () { return arguments; })(); + + Object.defineProperty(obj, "property", argObj); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } finally { + delete Object.prototype.writable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-175.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-175.js new file mode 100644 index 000000000..5c2c13e44 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-175.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.6-3-175 +description: > + Object.defineProperty - 'Attributes' is an Arguments object which + implements its own [[Get]] method to access the 'writable' + property (8.10.5 step 6.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var argObj = (function () { return arguments; })(); + + argObj.writable = true; + + Object.defineProperty(obj, "property", argObj); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-177.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-177.js new file mode 100644 index 000000000..52c950e05 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-177 +description: > + Object.defineProperty - 'Attributes' is the global object that + uses Object's [[Get]] method to access the 'writable' property + (8.10.5 step 6.a) +includes: + - runTestCase.js + - fnGlobalObject.js +---*/ + +function testcase() { + var obj = {}; + + try { + fnGlobalObject().writable = true; + + Object.defineProperty(obj, "property", fnGlobalObject()); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } finally { + delete fnGlobalObject().writable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-178.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-178.js new file mode 100644 index 000000000..74c841e6a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-178.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.6-3-178 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is + undefined (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { + writable: undefined + }); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (typeof (obj.property) === "undefined"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-179.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-179.js new file mode 100644 index 000000000..3cbdc5966 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-179 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is + null (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + Object.defineProperty(obj, "property", { writable: null }); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (typeof (obj.property) === "undefined"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-18.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-18.js new file mode 100644 index 000000000..7f729f336 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-18.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.6-3-18 +description: > + Object.defineProperty - 'Attributes' is a number primitive (8.10.5 + step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + + try { + Object.defineProperty({}, "property", 12); + return false; + } catch (e) { + return e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-180.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-180.js new file mode 100644 index 000000000..1ce28f162 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-180 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is + true (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { writable: true }); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-181.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-181.js new file mode 100644 index 000000000..7588e920a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-181 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is + false (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + Object.defineProperty(obj, "property", { writable: false }); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (typeof (obj.property) === "undefined"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-182.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-182.js new file mode 100644 index 000000000..071ace447 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-182 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is 0 + (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + Object.defineProperty(obj, "property", { writable: 0 }); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (typeof (obj.property) === "undefined"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-183.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-183.js new file mode 100644 index 000000000..ed45254df --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-183 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is +0 + (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { writable: +0 }); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (typeof (obj.property) === "undefined"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-184.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-184.js new file mode 100644 index 000000000..a568063d0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-184 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is -0 + (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + Object.defineProperty(obj, "property", { writable: -0 }); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (typeof (obj.property) === "undefined"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-185.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-185.js new file mode 100644 index 000000000..0a06885de --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-185 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is + NaN (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + Object.defineProperty(obj, "property", { writable: NaN}); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (typeof (obj.property) === "undefined"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-186.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-186.js new file mode 100644 index 000000000..d7bc611d9 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-186.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.6-3-186 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is a + positive number (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { writable: 12345 }); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-187.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-187.js new file mode 100644 index 000000000..bfa8aae75 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-187.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.6-3-187 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is a + negative number (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { writable: -12345 }); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-188.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-188.js new file mode 100644 index 000000000..28f3049f0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-188.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.6-3-188 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is an + empty string (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { writable: "" }); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (typeof (obj.property) === "undefined"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-189.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-189.js new file mode 100644 index 000000000..e635ca535 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-189.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.6-3-189 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is a + non-empty string (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { writable: " " }); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-19.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-19.js new file mode 100644 index 000000000..db262402c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-19.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.6-3-19 +description: > + Object.defineProperty - 'Attributes' is a string primitive (8.10.5 + step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + + try { + Object.defineProperty({}, "property", "abc"); + return false; + } catch (e) { + return e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-190.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-190.js new file mode 100644 index 000000000..5355e4bd4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-190.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.6-3-190 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is a + Function object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { + writable: function () { } + }); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-191.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-191.js new file mode 100644 index 000000000..38c25b824 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-191.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.6-3-191 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is an + Array object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { writable: [1, 2, 3] }); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-192.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-192.js new file mode 100644 index 000000000..51585f2bf --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-192 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is a + String object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { writable: new String("bbq") }); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-193.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-193.js new file mode 100644 index 000000000..57939425b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-193.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.6-3-193 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is a + Boolean object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { writable: new Boolean(true) }); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-194.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-194.js new file mode 100644 index 000000000..c4722b057 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-194.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.6-3-194 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is a + Number object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { writable: new Number(123) }); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-195.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-195.js new file mode 100644 index 000000000..3a7eac380 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-195.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.6-3-195 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is the + Math object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { writable: Math }); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-196.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-196.js new file mode 100644 index 000000000..8beace031 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-196.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.6-3-196 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is a + Date object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { writable: new Date() }); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-197.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-197.js new file mode 100644 index 000000000..003f77a68 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-197.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.6-3-197 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is a + RegExp object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { + writable: new RegExp() + }); + + var beforeWrite = obj.hasOwnProperty("property") && typeof obj.property === "undefined"; + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite && afterWrite; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-198.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-198.js new file mode 100644 index 000000000..5df98b363 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-198.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.6-3-198 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is the + JSON object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { writable: JSON }); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-199.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-199.js new file mode 100644 index 000000000..a6381a583 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-199.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.6-3-199 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is a + Error object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { writable: new SyntaxError() }); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-2.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-2.js new file mode 100644 index 000000000..f430e7db0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-2.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. + +/*--- +info: > + The abtract operation ToPropertyDescriptor is used to package the + into a property desc. Step 10 of ToPropertyDescriptor throws a TypeError + if the property desc ends up having a mix of accessor and data property elements. +es5id: 15.2.3.6-3-2 +description: > + Object.defineProperty throws TypeError if desc has 'get' and + 'writable' present(8.10.5 step 9.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // dummy getter + var getter = function () { return 1; } + var desc = { get: getter, writable: false }; + + try { + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError && + (o.hasOwnProperty("foo") === false)) { + return true; + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-20.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-20.js new file mode 100644 index 000000000..110bf12ae --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-20.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.6-3-20 +description: > + Object.defineProperty - 'enumerable' property in 'Attributes' is + present (8.10.5 step 3) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + var accessed = false; + Object.defineProperty(obj, "property", { + enumerable: false + }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return !accessed && obj.hasOwnProperty("property"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-200.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-200.js new file mode 100644 index 000000000..93aaaa52f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-200.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.6-3-200 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is the + Argument object (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var argObj = (function () { return arguments; })(1, true, "a"); + + Object.defineProperty(obj, "property", { writable: argObj }); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-202.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-202.js new file mode 100644 index 000000000..333281f47 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-202.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.6-3-202 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is the + global object (8.10.5 step 6.b) +includes: + - runTestCase.js + - fnGlobalObject.js +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { + writable: fnGlobalObject() + }); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-203.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-203.js new file mode 100644 index 000000000..5f7c4575f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-203.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.6-3-203 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is + treated as true when it is a string(value is 'false') (8.10.5 step + 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { writable: "false" }); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-204.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-204.js new file mode 100644 index 000000000..ae2fa7d11 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-204.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.6-3-204 +description: > + Object.defineProperty - 'writable' property in 'Attributes' is + treated as true when it is new Boolean(false) (8.10.5 step 6.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { writable: new Boolean(false) }); + + var beforeWrite = obj.hasOwnProperty("property"); + + obj.property = "isWritable"; + + var afterWrite = (obj.property === "isWritable"); + + return beforeWrite === true && afterWrite === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-205.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-205.js new file mode 100644 index 000000000..59f1d1f9b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-205.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.6-3-205 +description: > + Object.defineProperty - 'get' property in 'Attributes' is present + (8.10.5 step 7) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { + get: function () { + return "present"; + } + }); + + return obj.property === "present"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-206.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-206.js new file mode 100644 index 000000000..6a288e537 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-206.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.6-3-206 +description: > + Object.defineProperty - 'get' property in 'Attributes' is not + present (8.10.5 step 7) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { + set: function () {} + }); + + return typeof obj.property === "undefined" && obj.hasOwnProperty("property"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-207.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-207.js new file mode 100644 index 000000000..6f22d7fa7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-207.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.6-3-207 +description: > + Object.defineProperty - 'get' property in 'Attributes' is own data + property (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var attributes = { + get: function () { + return "ownDataProperty"; + } + }; + + Object.defineProperty(obj, "property", attributes); + + return obj.property === "ownDataProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-208.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-208.js new file mode 100644 index 000000000..cd3284d04 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-208.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.6-3-208 +description: > + Object.defineProperty - 'get' property in 'Attributes' is an + inherited data property (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var proto = { + get: function () { + return "inheritedDataProperty"; + } + }; + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + + Object.defineProperty(obj, "property", child); + + return obj.property === "inheritedDataProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-209.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-209.js new file mode 100644 index 000000000..fafd672b0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-209.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.6-3-209 +description: > + Object.defineProperty - 'get' property in 'Attributes' is own data + 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 ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + child.get = function () { + return "ownDataProperty"; + }; + + Object.defineProperty(obj, "property", child); + + return obj.property === "ownDataProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-21.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-21.js new file mode 100644 index 000000000..80bbdec55 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-21.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.6-3-21 +description: > + Object.defineProperty - 'enumerable' property in 'Attributes' is + not present (8.10.5 step 3) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + var attr = {}; + var accessed = false; + Object.defineProperty(obj, "property", attr); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-210.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-210.js new file mode 100644 index 000000000..830356e7b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-210.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.6-3-210 +description: > + Object.defineProperty - 'get' property in 'Attributes' 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 = {}; + var fun = function () { + return "inheritedAccessorProperty"; + }; + Object.defineProperty(proto, "get", { + get: function () { + return fun; + } + }); + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + Object.defineProperty(child, "get", { + value: function () { + return "ownDataProperty"; + } + }); + + Object.defineProperty(obj, "property", child); + + return obj.property === "ownDataProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-211.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-211.js new file mode 100644 index 000000000..f2551902d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-211 +description: > + Object.defineProperty - 'get' property in 'Attributes' is own + accessor property (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var attributes = {}; + Object.defineProperty(attributes, "get", { + get: function () { + return function () { + return "ownAccessorProperty"; + }; + } + }); + + Object.defineProperty(obj, "property", attributes); + + return obj.property === "ownAccessorProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-212.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-212.js new file mode 100644 index 000000000..8785daea7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-212.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.6-3-212 +description: > + Object.defineProperty - 'get' property in 'Attributes' is 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 ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + + Object.defineProperty(obj, "property", child); + + return obj.property === "inheritedAccessorProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-213.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-213.js new file mode 100644 index 000000000..c9af94d77 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-213.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.6-3-213 +description: > + Object.defineProperty - 'get' property in 'Attributes' 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 ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + Object.defineProperty(child, "get", { + get: function () { + return function () { + return "ownAccessorProperty"; + }; + } + }); + + Object.defineProperty(obj, "property", child); + + return obj.property === "ownAccessorProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-214.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-214.js new file mode 100644 index 000000000..cb3f24522 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-214.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.6-3-214 +description: > + Object.defineProperty - 'get' property in 'Attributes' 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 ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + Object.defineProperty(child, "get", { + get: function () { + return function () { + return "ownAccessorProperty"; + }; + } + }); + + Object.defineProperty(obj, "property", child); + + return obj.property === "ownAccessorProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-215.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-215.js new file mode 100644 index 000000000..036a6fcc5 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-215.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.6-3-215 +description: > + Object.defineProperty - 'get' property in 'Attributes' is own + accessor property without a get function (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var attributes = {}; + Object.defineProperty(attributes, "get", { + set: function () { } + }); + + Object.defineProperty(obj, "property", attributes); + + return typeof obj.property === "undefined" && obj.hasOwnProperty("property"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-216.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-216.js new file mode 100644 index 000000000..68669270f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-216.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.6-3-216 +description: > + Object.defineProperty - 'get' property in 'Attributes' 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 ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + Object.defineProperty(child, "get", { + set: function () { } + }); + + Object.defineProperty(obj, "property", child); + + return obj.hasOwnProperty("property") && typeof obj.property === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-217.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-217.js new file mode 100644 index 000000000..106e414a8 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-217.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.6-3-217 +description: > + Object.defineProperty - 'get' property in 'Attributes' is an + 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 ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + + Object.defineProperty(obj, "property", child); + + return obj.hasOwnProperty("property") && typeof obj.property === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-218-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-218-1.js new file mode 100644 index 000000000..ba50beae9 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-218-1.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.6-3-218-1 +description: > + Object.defineProperty - 'Attributes' is a Function object which + implements its own [[Get]] method to access the 'get' property of + prototype object (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Function.prototype.get = function () { + return "functionGetProperty"; + }; + var funObj = function () { }; + + Object.defineProperty(obj, "property", funObj); + + return obj.property === "functionGetProperty"; + } finally { + delete Function.prototype.get; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-218.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-218.js new file mode 100644 index 000000000..16d2e51e0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-218.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.6-3-218 +description: > + Object.defineProperty - 'Attributes' is a Function object which + implements its own [[Get]] method to access the 'get' property + (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var funObj = function () { }; + + funObj.get = function () { + return "functionGetProperty"; + }; + + Object.defineProperty(obj, "property", funObj); + + return obj.property === "functionGetProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-219-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-219-1.js new file mode 100644 index 000000000..fcb2e5fdd --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-219-1.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.6-3-219-1 +description: > + Object.defineProperty - 'Attributes' is an Array object that uses + Object's [[Get]] method to access the 'get' property of prototype + object (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Array.prototype.get = function () { + return "arrayGetProperty"; + }; + var arrObj = []; + + Object.defineProperty(obj, "property", arrObj); + + return obj.property === "arrayGetProperty"; + } finally { + delete Array.prototype.get; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-219.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-219.js new file mode 100644 index 000000000..6a2fbd6fc --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-219.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.6-3-219 +description: > + Object.defineProperty - 'Attributes' is an Array object that uses + Object's [[Get]] method to access the 'get' property (8.10.5 step + 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var arrObj = []; + + arrObj.get = function () { + return "arrayGetProperty"; + }; + + Object.defineProperty(obj, "property", arrObj); + + return obj.property === "arrayGetProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-22.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-22.js new file mode 100644 index 000000000..070894341 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-22.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.6-3-22 +description: > + Object.defineProperty - 'enumerable' property in 'Attributes' is + own data property (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "property", { + enumerable: true + }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-220-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-220-1.js new file mode 100644 index 000000000..8511d2a47 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-220-1.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.6-3-220-1 +description: > + Object.defineProperty - 'Attributes' is a String object that uses + Object's [[Get]] method to access the 'get' property of prototype + object (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + String.prototype.get = function () { + return "stringGetProperty"; + }; + var strObj = new String(); + + Object.defineProperty(obj, "property", strObj); + + return obj.property === "stringGetProperty"; + } finally { + delete String.prototype.get; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-220.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-220.js new file mode 100644 index 000000000..68f4034c3 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-220.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.6-3-220 +description: > + Object.defineProperty - 'Attributes' is a String object that uses + Object's [[Get]] method to access the 'get' property (8.10.5 step + 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var strObj = new String(); + + strObj.get = function () { + return "stringGetProperty"; + }; + + Object.defineProperty(obj, "property", strObj); + + return obj.property === "stringGetProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-221-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-221-1.js new file mode 100644 index 000000000..9d755fd7c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-221-1.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.6-3-221-1 +description: > + Object.defineProperty - 'Attributes' is a Boolean object that uses + Object's [[Get]] method to access the 'get' property of prototype + object (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Boolean.prototype.get = function () { + return "booleanGetProperty"; + }; + var boolObj = new Boolean(true); + + Object.defineProperty(obj, "property", boolObj); + + return obj.property === "booleanGetProperty"; + } finally { + delete Boolean.prototype.get; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-221.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-221.js new file mode 100644 index 000000000..45b1ad045 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-221.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.6-3-221 +description: > + Object.defineProperty - 'Attributes' is a Boolean object that uses + Object's [[Get]] method to access the 'get' property (8.10.5 step + 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var boolObj = new Boolean(true); + + boolObj.get = function () { + return "booleanGetProperty"; + }; + + Object.defineProperty(obj, "property", boolObj); + + return obj.property === "booleanGetProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-222-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-222-1.js new file mode 100644 index 000000000..f9984b44d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-222-1.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.6-3-222-1 +description: > + Object.defineProperty - 'Attributes' is a Number object that uses + Object's [[Get]] method to access the 'get' property of prototype + object (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Number.prototype.get = function () { + return "numberGetProperty"; + }; + var numObj = new Number(-2); + + Object.defineProperty(obj, "property", numObj); + + return obj.property === "numberGetProperty"; + } finally { + delete Number.prototype.get; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-222.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-222.js new file mode 100644 index 000000000..2fd30d7a7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-222.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.6-3-222 +description: > + Object.defineProperty - 'Attributes' is a Number object that uses + Object's [[Get]] method to access the 'get' property (8.10.5 step + 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var numObj = new Number(-2); + + numObj.get = function () { + return "numberGetProperty"; + }; + + Object.defineProperty(obj, "property", numObj); + + return obj.property === "numberGetProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-223-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-223-1.js new file mode 100644 index 000000000..9255a0a68 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-223-1.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.6-3-223-1 +description: > + Object.defineProperty - 'Attributes' is the Math object that uses + Object's [[Get]] method to access the 'get' property of prototype + object (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + Object.prototype.get = function () { + return "mathGetProperty"; + }; + + Object.defineProperty(obj, "property", Math); + + return obj.property === "mathGetProperty"; + } finally { + delete Object.prototype.get; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-223.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-223.js new file mode 100644 index 000000000..0ffbe1803 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-223.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.6-3-223 +description: > + Object.defineProperty - 'Attributes' is the Math object that uses + Object's [[Get]] method to access the 'get' property (8.10.5 step + 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + Math.get = function () { + return "mathGetProperty"; + }; + + Object.defineProperty(obj, "property", Math); + + return obj.property === "mathGetProperty"; + } finally { + delete Math.get; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-224-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-224-1.js new file mode 100644 index 000000000..c7a1ca80e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-224-1.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.6-3-224-1 +description: > + Object.defineProperty - 'Attributes' is a Date object that uses + Object's [[Get]] method to access the 'get' property of prototype + object (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Date.prototype.get = function () { + return "dateGetProperty"; + }; + var dateObj = new Date(); + + Object.defineProperty(obj, "property", dateObj); + + return obj.property === "dateGetProperty"; + } finally { + delete Date.prototype.get; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-224.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-224.js new file mode 100644 index 000000000..da2d0ebcb --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-224.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.6-3-224 +description: > + Object.defineProperty - 'Attributes' is a Date object that uses + Object's [[Get]] method to access the 'get' property (8.10.5 step + 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var dateObj = new Date(); + + dateObj.get = function () { + return "dateGetProperty"; + }; + + Object.defineProperty(obj, "property", dateObj); + + return obj.property === "dateGetProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-225-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-225-1.js new file mode 100644 index 000000000..bc853d317 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-225-1.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.6-3-225-1 +description: > + Object.defineProperty - 'Attributes' is a RegExp object that uses + Object's [[Get]] method to access the 'get' property of prototype + object (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + RegExp.prototype.get = function () { + return "regExpGetProperty"; + }; + var regObj = new RegExp(); + + + Object.defineProperty(obj, "property", regObj); + + return obj.property === "regExpGetProperty"; + } finally { + delete RegExp.prototype.get; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-225.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-225.js new file mode 100644 index 000000000..3ce161a41 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-225.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.6-3-225 +description: > + Object.defineProperty - 'Attributes' is a RegExp object that uses + Object's [[Get]] method to access the 'get' property (8.10.5 step + 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var regObj = new RegExp(); + + regObj.get = function () { + return "regExpGetProperty"; + }; + + Object.defineProperty(obj, "property", regObj); + + return obj.property === "regExpGetProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-226-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-226-1.js new file mode 100644 index 000000000..a2f82da72 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-226-1.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.6-3-226-1 +description: > + Object.defineProperty - 'Attributes' is the JSON object that uses + Object's [[Get]] method to access the 'get' property of prototype + object (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + Object.prototype.get = function () { + return "jsonGetProperty"; + }; + + Object.defineProperty(obj, "property", JSON); + + return obj.property === "jsonGetProperty"; + } finally { + delete Object.prototype.get; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-226.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-226.js new file mode 100644 index 000000000..0be0001c7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-226 +description: > + Object.defineProperty - 'Attributes' is the JSON object that uses + Object's [[Get]] method to access the 'get' property (8.10.5 step + 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + JSON.get = function () { + return "jsonGetProperty"; + }; + + Object.defineProperty(obj, "property", JSON); + + return obj.property === "jsonGetProperty"; + } finally { + delete JSON.get; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-227-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-227-1.js new file mode 100644 index 000000000..365226562 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-227-1.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.6-3-227-1 +description: > + Object.defineProperty - 'Attributes' is an Error object that uses + Object's [[Get]] method to access the 'get' property of prototype + object (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Error.prototype.get = function () { + return "errorGetProperty"; + }; + var errObj = new Error(); + + Object.defineProperty(obj, "property", errObj); + + return obj.property === "errorGetProperty"; + } finally { + delete Error.prototype.get; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-227.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-227.js new file mode 100644 index 000000000..d98536c16 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-227.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.6-3-227 +description: > + Object.defineProperty - 'Attributes' is an Error object that uses + Object's [[Get]] method to access the 'get' property (8.10.5 step + 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var errObj = new Error(); + + errObj.get = function () { + return "errorGetProperty"; + }; + + Object.defineProperty(obj, "property", errObj); + + return obj.property === "errorGetProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-228-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-228-1.js new file mode 100644 index 000000000..b8b1f8a97 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-228-1.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.6-3-228-1 +description: > + Object.defineProperty - 'Attributes' is an Arguments object which + implements its own [[Get]] method to access the 'get' property of + prototype object (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Object.prototype.get = function () { + return "argumentGetProperty"; + }; + var argObj = (function () { return arguments; })(); + + Object.defineProperty(obj, "property", argObj); + + return obj.property === "argumentGetProperty"; + } finally { + delete Object.prototype.get; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-228.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-228.js new file mode 100644 index 000000000..4e9cd5c5b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-228.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.6-3-228 +description: > + Object.defineProperty - 'Attributes' is an Arguments object which + implements its own [[Get]] method to access the 'get' property + (8.10.5 step 7.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var argObj = (function () { return arguments; })(); + + argObj.get = function () { + return "argumentGetProperty"; + }; + + Object.defineProperty(obj, "property", argObj); + + return obj.property === "argumentGetProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-23.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-23.js new file mode 100644 index 000000000..b744be26d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-23.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.6-3-23 +description: > + Object.defineProperty - 'enumerable' property in 'Attributes' is + an inherited data property (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + var proto = {}; + Object.defineProperty(proto, "enumerable", { + value: true + }); + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + + Object.defineProperty(obj, "property", child); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-230.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-230.js new file mode 100644 index 000000000..3c3b69917 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-230.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.6-3-230 +description: > + Object.defineProperty - 'Attributes' is the global object that + uses Object's [[Get]] method to access the 'get' property (8.10.5 + step 7.a) +includes: + - runTestCase.js + - fnGlobalObject.js +---*/ + +function testcase() { + var obj = {}; + + try { + fnGlobalObject().get = function () { + return "globalGetProperty"; + }; + + Object.defineProperty(obj, "property", fnGlobalObject()); + + return obj.property === "globalGetProperty"; + } finally { + delete fnGlobalObject().get; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-231.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-231.js new file mode 100644 index 000000000..94baa6923 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-231.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.6-3-231 +description: > + Object.defineProperty - value of 'get' property in 'Attributes' is + undefined (8.10.5 step 7.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { + get: undefined + }); + + return obj.hasOwnProperty("property") && typeof obj.property === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-232.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-232.js new file mode 100644 index 000000000..d5d0225d7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-232.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.6-3-232 +description: > + Object.defineProperty - value of 'get' property in 'Attributes' is + a function (8.10.5 step 7.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { + get: function () { + return "getFunction"; + } + }); + + return obj.hasOwnProperty("property") && obj.property === "getFunction"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-235.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-235.js new file mode 100644 index 000000000..24ab8476f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-235.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.6-3-235 +description: > + Object.defineProperty - 'set' property in 'Attributes' is present + (8.10.5 step 8) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + + Object.defineProperty(obj, "property", { + set: function (value) { + data = value; + } + }); + + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-236.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-236.js new file mode 100644 index 000000000..190c9dfb8 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-236.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.6-3-236 +description: > + Object.defineProperty - 'set' property in 'Attributes' is not + present (8.10.5 step 8) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { + get: function () { + return 11; + } + }); + + obj.property = 14; + var desc = Object.getOwnPropertyDescriptor(obj, "property"); + return obj.hasOwnProperty("property") && obj.property === 11 && typeof desc.set === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-237.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-237.js new file mode 100644 index 000000000..4d651c25e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-237.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.6-3-237 +description: > + Object.defineProperty - 'set' property in 'Attributes' is own data + property (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + + Object.defineProperty(obj, "property", { + set: function (value) { + data = value; + } + }); + + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-238.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-238.js new file mode 100644 index 000000000..5c715694a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-238.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.6-3-238 +description: > + Object.defineProperty - 'set' property in 'Attributes' is an + inherited data property (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + var proto = { + set: function (value) { + data = value; + } + }; + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + + Object.defineProperty(obj, "property", child); + + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-239.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-239.js new file mode 100644 index 000000000..e273421dc --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-239 +description: > + Object.defineProperty - 'set' property in 'Attributes' is own data + property that overrides an inherited data property (8.10.5 step + 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data1 = "data"; + var data2 = "data"; + var proto = { + set: function (value) { + data1 = value; + } + }; + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + child.set = function (value) { + data2 = value; + }; + + Object.defineProperty(obj, "property", child); + + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data1 === "data" && data2 === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-24.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-24.js new file mode 100644 index 000000000..dd718a1b6 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-24.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.6-3-24 +description: > + Object.defineProperty - 'enumerable' property in 'Attributes' 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 = {}; + Object.defineProperty(proto, "enumerable", { + value: false + }); + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + Object.defineProperty(child, "enumerable", { + value: true + }); + + Object.defineProperty(obj, "property", child); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-240.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-240.js new file mode 100644 index 000000000..5b022ac34 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-240.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.6-3-240 +description: > + Object.defineProperty - 'set' property in 'Attributes' is own data + property that overrides an inherited accessor property (8.10.5 + step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var proto = {}; + var data1 = "data"; + var data2 = "data"; + + Object.defineProperty(proto, "set", { + get: function () { + return function (value) { + data1 = value; + }; + } + }); + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + Object.defineProperty(child, "set", { + value: function (value) { + data2 = value; + } + }); + + Object.defineProperty(obj, "property", child); + + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data1 === "data" && data2 === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-241.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-241.js new file mode 100644 index 000000000..9c1aa0764 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-241 +description: > + Object.defineProperty - 'set' property in 'Attributes' is own + accessor property (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + var attributes = {}; + Object.defineProperty(attributes, "set", { + get: function () { + return function (value) { + data = value; + }; + } + }); + + Object.defineProperty(obj, "property", attributes); + obj.property = "ownAccessorProperty"; + + return obj.hasOwnProperty("property") && data === "ownAccessorProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-242.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-242.js new file mode 100644 index 000000000..3e18d219d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-242.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.6-3-242 +description: > + Object.defineProperty - 'set' property in 'Attributes' is an + inherited accessor property (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var proto = {}; + var data = "data"; + Object.defineProperty(proto, "set", { + get: function () { + return function (value) { + data = value; + }; + } + }); + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + + Object.defineProperty(obj, "property", child); + obj.property = "inheritedAccessorProperty"; + + return obj.hasOwnProperty("property") && data === "inheritedAccessorProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-243.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-243.js new file mode 100644 index 000000000..1c5d7d984 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-243.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.6-3-243 +description: > + Object.defineProperty - 'set' property in 'Attributes' is own + accessor property that overrides an inherited data property + (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data1 = "data"; + var data2 = "data"; + + var proto = { + set: function (value) { + data1 = value; + } + }; + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + Object.defineProperty(child, "set", { + get: function () { + return function (value) { + data2 = value; + }; + } + }); + + Object.defineProperty(obj, "property", child); + obj.property = "ownAccessorProperty"; + + return obj.hasOwnProperty("property") && data1 === "data" && data2 === "ownAccessorProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-244.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-244.js new file mode 100644 index 000000000..6a163d072 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-244 +description: > + Object.defineProperty - 'set' property in 'Attributes' is own + accessor property that overrides an inherited accessor property + (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var proto = {}; + var data1 = "data"; + var data2 = "data"; + Object.defineProperty(proto, "set", { + get: function () { + return function (value) { + data1 = value; + }; + } + }); + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + Object.defineProperty(child, "set", { + get: function () { + return function (value) { + data2 = value; + }; + } + }); + + Object.defineProperty(obj, "property", child); + obj.property = "ownAccessorProperty"; + + return obj.hasOwnProperty("property") && data1 === "data" && data2 === "ownAccessorProperty"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-245.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-245.js new file mode 100644 index 000000000..62697ae08 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-245.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.6-3-245 +description: > + Object.defineProperty - 'set' property in 'Attributes' is own + accessor property without a get function (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var attributes = {}; + Object.defineProperty(attributes, "set", { + set: function () { } + }); + + Object.defineProperty(obj, "property", attributes); + + obj.property = "overrideOwnData"; + + var desc = Object.getOwnPropertyDescriptor(obj, "property"); + return obj.hasOwnProperty("property") && typeof obj.property === "undefined" && + typeof desc.set === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-246.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-246.js new file mode 100644 index 000000000..c103ec3cc --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-246 +description: > + Object.defineProperty - 'set' property in 'Attributes' 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 obj = {}; + var proto = {}; + var data = "data"; + Object.defineProperty(proto, "set", { + get: function () { + return function (value) { + data = value; + }; + } + }); + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + Object.defineProperty(child, "set", { + set: function () { } + }); + + Object.defineProperty(obj, "property", child); + + obj.property = "overrideData"; + return obj.hasOwnProperty("property") && typeof obj.property === "undefined" && data === "data"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-247.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-247.js new file mode 100644 index 000000000..926b3bcab --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-247.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.6-3-247 +description: > + Object.defineProperty - 'set' property in 'Attributes' is an + inherited accessor property without a get function (8.10.5 step + 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var proto = {}; + Object.defineProperty(proto, "set", { + set: function () { } + }); + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + + Object.defineProperty(obj, "property", child); + + obj.property = "overrideData"; + return obj.hasOwnProperty("property") && typeof obj.property === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-248-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-248-1.js new file mode 100644 index 000000000..df9f87ad8 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-248-1.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.6-3-248-1 +description: > + Object.defineProperty - 'Attributes' is a Function object which + implements its own [[Get]] method to access the 'set' property of + prototype object (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + try { + Function.prototype.set = function (value) { + data = value; + }; + var funObj = function () { }; + + Object.defineProperty(obj, "property", funObj); + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } finally { + delete Function.prototype.set; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-248.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-248.js new file mode 100644 index 000000000..981a0749a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-248.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.6-3-248 +description: > + Object.defineProperty - 'Attributes' is a Function object which + implements its own [[Get]] method to access the 'set' property + (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + var funObj = function () { }; + + funObj.set = function (value) { + data = value; + }; + + Object.defineProperty(obj, "property", funObj); + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-249-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-249-1.js new file mode 100644 index 000000000..be9dba07b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-249-1.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.6-3-249-1 +description: > + Object.defineProperty - 'Attributes' is an Array object that uses + Object's [[Get]] method to access the 'set' property of prototype + object (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + try { + Array.prototype.set = function (value) { + data = value; + }; + var arrObj = []; + + Object.defineProperty(obj, "property", arrObj); + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } finally { + delete Array.prototype.set; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-249.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-249.js new file mode 100644 index 000000000..e5e7f5f13 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-249.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.6-3-249 +description: > + Object.defineProperty - 'Attributes' is an Array object that uses + Object's [[Get]] method to access the 'set' property (8.10.5 step + 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + var arrObj = []; + + arrObj.set = function (value) { + data = value; + }; + + Object.defineProperty(obj, "property", arrObj); + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-25.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-25.js new file mode 100644 index 000000000..841cf97af --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-25.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.6-3-25 +description: > + Object.defineProperty - 'enumerable' property in 'Attributes' is + own data property that overrides an inherited accessor property + (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + var proto = {}; + Object.defineProperty(proto, "enumerable", { + get: function () { + return false; + } + }); + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + Object.defineProperty(child, "enumerable", { + value: true + }); + + Object.defineProperty(obj, "property", child); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-250-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-250-1.js new file mode 100644 index 000000000..f887079ae --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-250-1.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.6-3-250-1 +description: > + Object.defineProperty - 'Attributes' is a String object that uses + Object's [[Get]] method to access the 'set' property of prototype + object (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + String.prototype.set = function (value) { + data = value; + }; + var strObj = new String(); + var data = "data"; + + Object.defineProperty(obj, "property", strObj); + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } finally { + delete String.prototype.set; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-250.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-250.js new file mode 100644 index 000000000..364959c0f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-250.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.6-3-250 +description: > + Object.defineProperty - 'Attributes' is a String object that uses + Object's [[Get]] method to access the 'set' property (8.10.5 step + 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var strObj = new String(); + var data = "data"; + + strObj.set = function (value) { + data = value; + }; + + Object.defineProperty(obj, "property", strObj); + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-251-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-251-1.js new file mode 100644 index 000000000..cbd9292b4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-251-1.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.6-3-251-1 +description: > + Object.defineProperty - 'Attributes' is a Boolean object that uses + Object's [[Get]] method to access the 'set' property of prototype + object (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + try { + Boolean.prototype.set = function (value) { + data = value; + }; + var boolObj = new Boolean(true); + + Object.defineProperty(obj, "property", boolObj); + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } finally { + delete Boolean.prototype.set; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-251.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-251.js new file mode 100644 index 000000000..1b7fd522c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-251.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.6-3-251 +description: > + Object.defineProperty - 'Attributes' is a Boolean object that uses + Object's [[Get]] method to access the 'set' property (8.10.5 step + 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + var boolObj = new Boolean(true); + + boolObj.set = function (value) { + data = value; + }; + + Object.defineProperty(obj, "property", boolObj); + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-252-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-252-1.js new file mode 100644 index 000000000..b426331d4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-252-1.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.6-3-252-1 +description: > + Object.defineProperty - 'Attributes' is a Number object that uses + Object's [[Get]] method to access the 'set' property of prototype + object (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + try { + Number.prototype.set = function (value) { + data = value; + }; + var numObj = new Number(-2); + + Object.defineProperty(obj, "property", numObj); + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } finally { + delete Number.prototype.set; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-252.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-252.js new file mode 100644 index 000000000..cc9a6111e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-252.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.6-3-252 +description: > + Object.defineProperty - 'Attributes' is a Number object that uses + Object's [[Get]] method to access the 'set' property (8.10.5 step + 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + var numObj = new Number(-2); + + numObj.set = function (value) { + data = value; + }; + + Object.defineProperty(obj, "property", numObj); + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-253-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-253-1.js new file mode 100644 index 000000000..e8ddcf3e2 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-253-1.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.6-3-253-1 +description: > + Object.defineProperty - 'Attributes' is the Math object that uses + Object's [[Get]] method to access the 'set' property of prototype + object (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + + try { + Object.prototype.set = function (value) { + data = value; + }; + + Object.defineProperty(obj, "property", Math); + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } finally { + delete Object.prototype.set; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-253.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-253.js new file mode 100644 index 000000000..bf9b2cd3d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-253.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.6-3-253 +description: > + Object.defineProperty - 'Attributes' is the Math object that uses + Object's [[Get]] method to access the 'set' property (8.10.5 step + 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + + try { + Math.set = function (value) { + data = value; + }; + + Object.defineProperty(obj, "property", Math); + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } finally { + delete Math.set; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-254-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-254-1.js new file mode 100644 index 000000000..c853f4fbe --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-254-1.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.6-3-254-1 +description: > + Object.defineProperty - 'Attributes' is a Date object that uses + Object's [[Get]] method to access the 'set' property of prototype + object (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + try { + Date.prototype.set = function (value) { + data = value; + }; + var dateObj = new Date(); + + Object.defineProperty(obj, "property", dateObj); + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } finally { + delete Date.prototype.set; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-254.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-254.js new file mode 100644 index 000000000..db72fbe59 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-254 +description: > + Object.defineProperty - 'Attributes' is a Date object that uses + Object's [[Get]] method to access the 'set' property (8.10.5 step + 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + var dateObj = new Date(); + + dateObj.set = function (value) { + data = value; + }; + + Object.defineProperty(obj, "property", dateObj); + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-255-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-255-1.js new file mode 100644 index 000000000..01e5e803a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-255-1.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.6-3-255-1 +description: > + Object.defineProperty - 'Attributes' is a RegExp object that uses + Object's [[Get]] method to access the 'set' property of prototype + object (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + try { + RegExp.prototype.set = function (value) { + data = value; + }; + var regObj = new RegExp(); + + Object.defineProperty(obj, "property", regObj); + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } finally { + delete RegExp.prototype.set; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-255.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-255.js new file mode 100644 index 000000000..1b2d7169c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-255 +description: > + Object.defineProperty - 'Attributes' is a RegExp object that uses + Object's [[Get]] method to access the 'set' property (8.10.5 step + 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + var regObj = new RegExp(); + + regObj.set = function (value) { + data = value; + }; + + Object.defineProperty(obj, "property", regObj); + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-256-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-256-1.js new file mode 100644 index 000000000..a12061e22 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-256-1.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.6-3-256-1 +description: > + Object.defineProperty - 'Attributes' is the JSON object that uses + Object's [[Get]] method to access the 'set' property of prototype + object (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + + try { + Object.prototype.set = function (value) { + data = value; + }; + + Object.defineProperty(obj, "property", JSON); + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } finally { + delete Object.prototype.set; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-256.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-256.js new file mode 100644 index 000000000..1cd8fe501 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-256.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.6-3-256 +description: > + Object.defineProperty - 'Attributes' is the JSON object that uses + Object's [[Get]] method to access the 'set' property (8.10.5 step + 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + + try { + JSON.set = function (value) { + data = value; + }; + + Object.defineProperty(obj, "property", JSON); + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } finally { + delete JSON.set; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-257-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-257-1.js new file mode 100644 index 000000000..f91bdd905 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-257-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.6-3-257-1 +description: > + Object.defineProperty - 'Attributes' is an Error object that uses + Object's [[Get]] method to access the 'set' property of prototype + object (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + + try { + Error.prototype.set = function (value) { + data = value; + }; + var errObj = new Error(); + + Object.defineProperty(obj, "property", errObj); + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } finally { + delete Error.prototype.set; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-257.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-257.js new file mode 100644 index 000000000..eae1f677b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-257 +description: > + Object.defineProperty - 'Attributes' is an Error object that uses + Object's [[Get]] method to access the 'set' property (8.10.5 step + 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + var errObj = new Error(); + + errObj.set = function (value) { + data = value; + }; + + Object.defineProperty(obj, "property", errObj); + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-258-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-258-1.js new file mode 100644 index 000000000..1afdef74c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-258-1.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.6-3-258-1 +description: > + Object.defineProperty - 'Attributes' is an Arguments object which + implements its own [[Get]] method to access the 'set' property of + prototype object (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + try { + Object.prototype.set = function (value) { + data = value; + }; + var argObj = (function () { return arguments; })(); + + Object.defineProperty(obj, "property", argObj); + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } finally { + delete Object.prototype.set; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-258.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-258.js new file mode 100644 index 000000000..9e3194043 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-258.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.6-3-258 +description: > + Object.defineProperty - 'Attributes' is an Arguments object which + implements its own [[Get]] method to access the 'set' property + (8.10.5 step 8.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + var argObj = (function () { return arguments; })(); + argObj.set = function (value) { + data = value; + }; + + Object.defineProperty(obj, "property", argObj); + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-26.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-26.js new file mode 100644 index 000000000..b7536414c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-26.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.6-3-26 +description: > + Object.defineProperty - 'enumerable' property in 'Attributes' is + own accessor property (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + var attr = {}; + Object.defineProperty(attr, "enumerable", { + get: function () { + return true; + } + }); + + Object.defineProperty(obj, "property", attr); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-260.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-260.js new file mode 100644 index 000000000..4e4815d08 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-260.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.6-3-260 +description: > + Object.defineProperty - 'Attributes' is the global object that + uses Object's [[Get]] method to access the 'set' property (8.10.5 + step 8.a) +includes: + - runTestCase.js + - fnGlobalObject.js +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + + try { + fnGlobalObject().set = function (value) { + data = value; + }; + + Object.defineProperty(obj, "property", fnGlobalObject()); + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } finally { + delete fnGlobalObject().set; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-261.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-261.js new file mode 100644 index 000000000..bfe3d3c77 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-261.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.6-3-261 +description: > + Object.defineProperty - value of 'set' property in 'Attributes' is + undefined (8.10.5 step 8.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { + set: undefined + }); + + obj.property = "overrideData"; + var desc = Object.getOwnPropertyDescriptor(obj, "property"); + return obj.hasOwnProperty("property") && typeof obj.property === "undefined" && + typeof desc.set === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-262.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-262.js new file mode 100644 index 000000000..3d5e8f557 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-262.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.6-3-262 +description: > + Object.defineProperty - value of 'set' property in 'Attributes' is + a function (8.10.5 step 8.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var data = "data"; + + Object.defineProperty(obj, "property", { + set: function (value) { + data = value; + } + }); + obj.property = "overrideData"; + + return obj.hasOwnProperty("property") && data === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-27.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-27.js new file mode 100644 index 000000000..e9aee6bbd --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-27.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.6-3-27 +description: > + Object.defineProperty - 'enumerable' property in 'Attributes' is + an inherited accessor property (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + var proto = {}; + Object.defineProperty(proto, "enumerable", { + get: function () { + return true; + } + }); + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + + Object.defineProperty(obj, "property", child); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-28.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-28.js new file mode 100644 index 000000000..66b133b09 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-28.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.6-3-28 +description: > + Object.defineProperty - 'enumerable' property in 'Attributes' 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: false }; + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + + Object.defineProperty(child, "enumerable", { + get: function () { + return true; + } + }); + + Object.defineProperty(obj, "property", child); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-29.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-29.js new file mode 100644 index 000000000..e03b4fd16 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-29.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.6-3-29 +description: > + Object.defineProperty - 'enumerable' property in 'Attributes' is + own accessor property that overrides an inherited accessor + property (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + var proto = {}; + + Object.defineProperty(proto, "enumerable", { + get: function () { + return false; + } + }); + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + + Object.defineProperty(child, "enumerable", { + get: function () { + return true; + } + }); + + Object.defineProperty(obj, "property", child); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-3.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-3.js new file mode 100644 index 000000000..c009a0980 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-3.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. + +/*--- +info: > + The abtract operation ToPropertyDescriptor is used to package the + into a property desc. Step 10 of ToPropertyDescriptor throws a TypeError + if the property desc ends up having a mix of accessor and data property elements. +es5id: 15.2.3.6-3-3 +description: > + Object.defineProperty throws TypeError if desc has 'set' and + 'value' present(8.10.5 step 9.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // dummy setter + var setter = function () { } + var desc = { set: setter, value: 101}; + + try { + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError && + (o.hasOwnProperty("foo") === false)) { + return true; + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-30.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-30.js new file mode 100644 index 000000000..8b9254a53 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-30.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.6-3-30 +description: > + Object.defineProperty - 'enumerable' property in 'Attributes' 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 attr = {}; + Object.defineProperty(attr, "enumerable", { + set: function () { } + }); + + Object.defineProperty(obj, "property", attr); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-31.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-31.js new file mode 100644 index 000000000..2d30f945d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-31.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.6-3-31 +description: > + Object.defineProperty - 'enumerable' property in 'Attributes' 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 accessed = false; + var proto = {}; + + Object.defineProperty(proto, "enumerable", { + get: function () { + return true; + } + }); + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + + Object.defineProperty(child, "enumerable", { + set: function () { } + }); + + Object.defineProperty(obj, "property", child); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-32.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-32.js new file mode 100644 index 000000000..7ab0760ac --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-32.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.6-3-32 +description: > + Object.defineProperty - 'enumerable' property in 'Attributes' is + an inherited accessor property without a get function (8.10.5 step + 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + var proto = {}; + + Object.defineProperty(proto, "enumerable", { + set: function () { } + }); + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + + Object.defineProperty(obj, "property", child); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-33-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-33-1.js new file mode 100644 index 000000000..4c4553c31 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-33-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.6-3-33-1 +description: > + Object.defineProperty - 'Attributes' is a Function object which + implements its own [[Get]] method to access the 'enumerable' + property of prototype object (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + try { + Function.prototype.enumerable = true; + var fun = function () { }; + + Object.defineProperty(obj, "property", fun); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + + return accessed; + } finally { + delete Function.prototype.enumerable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-33.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-33.js new file mode 100644 index 000000000..195848a60 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-33.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.6-3-33 +description: > + Object.defineProperty - 'Attributes' is a Function object which + implements its own [[Get]] method to access the 'enumerable' + property (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + var fun = function () { }; + fun.enumerable = true; + + Object.defineProperty(obj, "property", fun); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-34-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-34-1.js new file mode 100644 index 000000000..917f3f3e1 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-34-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.6-3-34-1 +description: > + Object.defineProperty - 'Attributes' is an Array object that uses + Object's [[Get]] method to access the 'enumerable' property of + prototype object (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + try { + Array.prototype.enumerable = true; + var arrObj = []; + + Object.defineProperty(obj, "property", arrObj); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + + return accessed; + } finally { + delete Array.prototype.enumerable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-34.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-34.js new file mode 100644 index 000000000..57042812c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-34.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.6-3-34 +description: > + Object.defineProperty - 'Attributes' is an Array object that uses + Object's [[Get]] method to access the 'enumerable' property + (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + var arrObj = []; + arrObj.enumerable = true; + + Object.defineProperty(obj, "property", arrObj); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-35-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-35-1.js new file mode 100644 index 000000000..5e2af073d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-35-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.6-3-35-1 +description: > + Object.defineProperty - 'Attributes' is a String object that uses + Object's [[Get]] method to access the 'enumerable' property of + prototype object (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + try { + String.prototype.enumerable = true; + var strObj = new String(); + + Object.defineProperty(obj, "property", strObj); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + + return accessed; + } finally { + delete String.prototype.enumerable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-35.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-35.js new file mode 100644 index 000000000..43a21e380 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-35.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.6-3-35 +description: > + Object.defineProperty - 'Attributes' is a String object that uses + Object's [[Get]] method to access the 'enumerable' property + (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + var strObj = new String(); + strObj.enumerable = true; + + Object.defineProperty(obj, "property", strObj); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-36-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-36-1.js new file mode 100644 index 000000000..c2698558d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-36-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.6-3-36-1 +description: > + Object.defineProperty - 'Attributes' is a Boolean object that uses + Object's [[Get]] method to access the 'enumerable' property of + prototype object (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + try { + Boolean.prototype.enumerable = true; + var boolObj = new Boolean(true); + + Object.defineProperty(obj, "property", boolObj); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + + return accessed; + } finally { + delete Boolean.prototype.enumerable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-36.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-36.js new file mode 100644 index 000000000..d97cd1001 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-36.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.6-3-36 +description: > + Object.defineProperty - 'Attributes' is a Boolean object that uses + Object's [[Get]] method to access the 'enumerable' property + (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + var boolObj = new Boolean(true); + boolObj.enumerable = true; + + Object.defineProperty(obj, "property", boolObj); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-37-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-37-1.js new file mode 100644 index 000000000..8ccd27c65 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-37-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.6-3-37-1 +description: > + Object.defineProperty - 'Attributes' is a Number object that uses + Object's [[Get]] method to access the 'enumerable' property of + prototype object (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + try { + Number.prototype.enumerable = true; + var numObj = new Number(-2); + + Object.defineProperty(obj, "property", numObj); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + + return accessed; + } finally { + delete Number.prototype.enumerable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-37.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-37.js new file mode 100644 index 000000000..583195b9b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-37.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.6-3-37 +description: > + Object.defineProperty - 'Attributes' is a Number object that uses + Object's [[Get]] method to access the 'enumerable' property + (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + var numObj = new Number(-2); + numObj.enumerable = true; + + Object.defineProperty(obj, "property", numObj); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-38-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-38-1.js new file mode 100644 index 000000000..8faa8c4b5 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-38-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.6-3-38-1 +description: > + Object.defineProperty - 'Attributes' is the Math object that uses + Object's [[Get]] method to access the 'enumerable' property of + prototype object (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + try { + Object.prototype.enumerable = true; + + Object.defineProperty(obj, "property", Math); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } finally { + delete Object.prototype.enumerable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-38.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-38.js new file mode 100644 index 000000000..0c9201f3e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-38.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.6-3-38 +description: > + Object.defineProperty - 'Attributes' is the Math object that uses + Object's [[Get]] method to access the 'enumerable' property + (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + try { + Math.enumerable = true; + + Object.defineProperty(obj, "property", Math); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } finally { + delete Math.enumerable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-39-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-39-1.js new file mode 100644 index 000000000..691155c7f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-39-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.6-3-39-1 +description: > + Object.defineProperty - 'Attributes' is a Date object that uses + Object's [[Get]] method to access the 'enumerable' property of + prototype object (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + try { + Date.prototype.enumerable = true; + var dateObj = new Date(); + + Object.defineProperty(obj, "property", dateObj); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } finally { + delete Date.prototype.enumerable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-39.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-39.js new file mode 100644 index 000000000..ad288ba8b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-39 +description: > + Object.defineProperty - 'Attributes' is a Date object that uses + Object's [[Get]] method to access the 'enumerable' property + (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + var dateObj = new Date(); + dateObj.enumerable = true; + + Object.defineProperty(obj, "property", dateObj); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-4.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-4.js new file mode 100644 index 000000000..cce3292f2 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-4.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. + +/*--- +info: > + The abtract operation ToPropertyDescriptor is used to package the + into a property desc. Step 10 of ToPropertyDescriptor throws a TypeError + if the property desc ends up having a mix of accessor and data property elements. +es5id: 15.2.3.6-3-4 +description: > + Object.defineProperty throws TypeError if desc has 'set' and + 'writable' present(8.10.5 step 9.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // dummy getter + var setter = function () { } + var desc = { set: setter, writable: false }; + + try { + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError && + (o.hasOwnProperty("foo") === false)) { + return true; + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-40-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-40-1.js new file mode 100644 index 000000000..c65d5c8da --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-40-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.6-3-40-1 +description: > + Object.defineProperty - 'Attributes' is an RegExp object that uses + Object's [[Get]] method to access the 'enumerable' property of + prototype object (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + try { + RegExp.prototype.enumerable = true; + var regObj = new RegExp(); + + Object.defineProperty(obj, "property", regObj); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + + return accessed; + } finally { + delete RegExp.prototype.enumerable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-40.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-40.js new file mode 100644 index 000000000..3d5ac51d8 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-40.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.6-3-40 +description: > + Object.defineProperty - 'Attributes' is an RegExp object that uses + Object's [[Get]] method to access the 'enumerable' property + (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + var regObj = new RegExp(); + regObj.enumerable = true; + + Object.defineProperty(obj, "property", regObj); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-41-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-41-1.js new file mode 100644 index 000000000..9ccc75716 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-41-1.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.6-3-41-1 +description: > + Object.defineProperty - 'Attributes' is the JSON object that uses + Object's [[Get]] method to access the 'enumerable' property of + prototype object (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + try { + Object.prototype.enumerable = true; + + Object.defineProperty(obj, "property", JSON); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + + return accessed; + } finally { + delete Object.prototype.enumerable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-41.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-41.js new file mode 100644 index 000000000..05781766a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-41.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.6-3-41 +description: > + Object.defineProperty - 'Attributes' is the JSON object that uses + Object's [[Get]] method to access the 'enumerable' property + (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + try { + JSON.enumerable = true; + + Object.defineProperty(obj, "property", JSON); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + + return accessed; + } finally { + delete JSON.enumerable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-42-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-42-1.js new file mode 100644 index 000000000..54b9a60ca --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-42-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.6-3-42-1 +description: > + Object.defineProperty - 'Attributes' is an Error object that uses + Object's [[Get]] method to access the 'enumerable' property of + prototype object (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + try { + Error.prototype.enumerable = true; + var errObj = new Error(); + + Object.defineProperty(obj, "property", errObj); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + + return accessed; + } finally { + delete Error.prototype.enumerable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-42.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-42.js new file mode 100644 index 000000000..34c0c0d0e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-42.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.6-3-42 +description: > + Object.defineProperty - 'Attributes' is an Error object that uses + Object's [[Get]] method to access the 'enumerable' property + (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + var errObj = new Error(); + errObj.enumerable = true; + + Object.defineProperty(obj, "property", errObj); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-43-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-43-1.js new file mode 100644 index 000000000..b8417a633 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-43-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.6-3-43-1 +description: > + Object.defineProperty - 'Attributes' is an Arguments object which + implements its own [[Get]] method to access the 'enumerable' + property of prototype object (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + try { + Object.prototype.enumerable = true; + var argObj = (function () { return arguments; })(); + + Object.defineProperty(obj, "property", argObj); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + + return accessed; + } finally { + delete Object.prototype.enumerable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-43.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-43.js new file mode 100644 index 000000000..624ce9c69 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-43.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.6-3-43 +description: > + Object.defineProperty - 'Attributes' is an Arguments object which + implements its own [[Get]] method to access the 'enumerable' + property (8.10.5 step 3.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + var argObj = (function () { return arguments; })(); + argObj.enumerable = true; + + Object.defineProperty(obj, "property", argObj); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-45.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-45.js new file mode 100644 index 000000000..4ec9cc73e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-45.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.6-3-45 +description: > + Object.defineProperty - 'Attributes' is the global object that + uses Object's [[Get]] method to access the '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.defineProperty(obj, "property", fnGlobalObject()); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + + return accessed; + } finally { + delete fnGlobalObject().enumerable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-46.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-46.js new file mode 100644 index 000000000..cf17818da --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-46.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.6-3-46 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' is undefined (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "property", { + enumerable: undefined + }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-47.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-47.js new file mode 100644 index 000000000..dbfd70d32 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-47.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.6-3-47 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' is null (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "property", { enumerable: null }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-48.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-48.js new file mode 100644 index 000000000..d5d360a70 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-48.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.6-3-48 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' is true (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "property", { enumerable: true }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-49.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-49.js new file mode 100644 index 000000000..e6cfa951a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-49.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.6-3-49 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' is false (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "property", { enumerable: false }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-5.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-5.js new file mode 100644 index 000000000..31e4cb352 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-5.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. + +/*--- +info: > + The abtract operation ToPropertyDescriptor is used to package the + into a property desc. Step 10 of ToPropertyDescriptor throws a TypeError + if the property desc ends up having a mix of accessor and data property elements. +es5id: 15.2.3.6-3-5 +description: > + Object.defineProperty throws TypeError if getter is not callable + but not undefined (Number)(8.10.5 step 7.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // dummy getter + var getter = 42; + var desc = { get: getter }; + + try { + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError && + (o.hasOwnProperty("foo") === false)) { + return true; + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-50.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-50.js new file mode 100644 index 000000000..d30205574 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-50.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.6-3-50 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' is 0 (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "property", { enumerable: 0 }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-51.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-51.js new file mode 100644 index 000000000..0bbb24a48 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-51.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.6-3-51 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' is +0 (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "property", { enumerable: +0 }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-52.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-52.js new file mode 100644 index 000000000..96d80e13f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-52.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.6-3-52 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' is -0 (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "property", { enumerable: -0 }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-53.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-53.js new file mode 100644 index 000000000..39bd6bf3f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-53.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.6-3-53 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' is NaN (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "property", { enumerable: NaN }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-54.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-54.js new file mode 100644 index 000000000..86bcaf283 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-54.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.6-3-54 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' is a positive number (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "property", { enumerable: 12 }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-55.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-55.js new file mode 100644 index 000000000..2f3169909 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-55.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.6-3-55 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' is a negative number (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "property", { enumerable: -2 }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-56.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-56.js new file mode 100644 index 000000000..88bf5497a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-56.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.6-3-56 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' is an empty string (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "property", { enumerable: "" }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return !accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-57.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-57.js new file mode 100644 index 000000000..7543d9890 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-57.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.6-3-57 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' is a non-empty string (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "property", { enumerable: "AB\n\\cd" }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-58.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-58.js new file mode 100644 index 000000000..f1cf83c97 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-58.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.6-3-58 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' is a Function object (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "property", { + enumerable: function () { } + }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-59.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-59.js new file mode 100644 index 000000000..843361f33 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-59.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.6-3-59 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' is an Array object (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "property", { enumerable: [] }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-6.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-6.js new file mode 100644 index 000000000..a3f8321e0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-6.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. + +/*--- +info: > + The abtract operation ToPropertyDescriptor is used to package the + into a property desc. Step 10 of ToPropertyDescriptor throws a TypeError + if the property desc ends up having a mix of accessor and data property elements. +es5id: 15.2.3.6-3-6 +description: > + Object.defineProperty throws TypeError if getter is not callable + but not undefined (Boolean)(8.10.5 step 7.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // dummy getter + var getter = true; + var desc = { get: getter }; + + try { + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError && + (o.hasOwnProperty("foo") === false)) { + return true; + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-60.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-60.js new file mode 100644 index 000000000..0adbdc0e9 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-60.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.6-3-60 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' is a String Object (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "property", { enumerable: new String() }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-61.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-61.js new file mode 100644 index 000000000..40fde5cf2 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-61.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.6-3-61 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' is a Boolean Object (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "property", { enumerable: new Boolean() }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-62.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-62.js new file mode 100644 index 000000000..0ce1aea12 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-62.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.6-3-62 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' is a Number Object (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "property", { enumerable: new Number() }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-63.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-63.js new file mode 100644 index 000000000..ae08144ef --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-63.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.6-3-63 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' is the Math Object (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "property", { enumerable: Math }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-64.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-64.js new file mode 100644 index 000000000..59630e613 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-64.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.6-3-64 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' is a Date Object (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "property", { enumerable: new Date() }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-65.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-65.js new file mode 100644 index 000000000..a32c4067a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-65.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.6-3-65 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' is a RegExp Object (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "property", { enumerable: new RegExp() }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-66.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-66.js new file mode 100644 index 000000000..9605d4a69 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-66.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.6-3-66 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' is the JSON Object (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "property", { enumerable: JSON }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-67.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-67.js new file mode 100644 index 000000000..d33f30b22 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-67.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.6-3-67 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' is an Error Object (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "property", { enumerable: new Error() }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-68.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-68.js new file mode 100644 index 000000000..50db61d66 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-68.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.6-3-68 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' is an Arguments Object (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + var argObj = (function () { return arguments; })(0, 1, 2); + + Object.defineProperty(obj, "property", { enumerable: argObj }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-7.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-7.js new file mode 100644 index 000000000..ffa6ac7e8 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-7.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. + +/*--- +info: > + The abtract operation ToPropertyDescriptor is used to package the + into a property desc. Step 10 of ToPropertyDescriptor throws a TypeError + if the property desc ends up having a mix of accessor and data property elements. +es5id: 15.2.3.6-3-7 +description: > + Object.defineProperty throws TypeError if getter is not callable + but not undefined (String)(8.10.5 step 7.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // dummy getter + var getter = "abc"; + var desc = { get: getter }; + + try { + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError && + (o.hasOwnProperty("foo") === false)) { + return true; + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-70.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-70.js new file mode 100644 index 000000000..740b2aebb --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-70.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.6-3-70 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' is the global object (8.10.5 step 3.b) +includes: + - runTestCase.js + - fnGlobalObject.js +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "property", { enumerable: fnGlobalObject() }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-71.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-71.js new file mode 100644 index 000000000..ae97884ad --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-71.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.6-3-71 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' is treated as true when it is a string (value is + 'false') (8.10.5 step 3.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var accessed = false; + + Object.defineProperty(obj, "property", { enumerable: "false" }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-72.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-72.js new file mode 100644 index 000000000..241cc177b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-72.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.6-3-72 +description: > + Object.defineProperty - value of 'enumerable' property in + 'Attributes' 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.defineProperty(obj, "property", { enumerable: new Boolean(false) }); + + for (var prop in obj) { + if (prop === "property") { + accessed = true; + } + } + return accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-73.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-73.js new file mode 100644 index 000000000..18397ac58 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-73.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.6-3-73 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + present (8.10.5 step 4) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { + configurable: false + }); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-74.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-74.js new file mode 100644 index 000000000..89ff175bb --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-74.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.6-3-74 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + not present (8.10.5 step 4) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + Object.defineProperty(obj, "property", { value: 100 }); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = (obj.property === 100); + + return beforeDeleted === true && afterDeleted === true; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-75.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-75.js new file mode 100644 index 000000000..968151cac --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-75.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.6-3-75 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + own data property (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + Object.defineProperty(obj, "property", { + configurable: true + }); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-76.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-76.js new file mode 100644 index 000000000..5d6e235bf --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-76.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.6-3-76 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + an inherited data property (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var proto = { + configurable: false + }; + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + + Object.defineProperty(obj, "property", child); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + return beforeDeleted && afterDeleted && typeof (obj.property) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-77.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-77.js new file mode 100644 index 000000000..202b96fb9 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-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.6-3-77 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' 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: false + }; + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + child.configurable = true; + + Object.defineProperty(obj, "property", child); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-78.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-78.js new file mode 100644 index 000000000..3d03d1df9 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-78.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.6-3-78 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' 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 false; + } + }); + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + Object.defineProperty(child, "configurable", { + value: true + }); + + Object.defineProperty(obj, "property", child); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-79.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-79.js new file mode 100644 index 000000000..4d192ace8 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-79.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.6-3-79 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + own accessor property (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var attr = {}; + Object.defineProperty(attr, "configurable", { + get: function () { + return true; + } + }); + + Object.defineProperty(obj, "property", attr); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-8.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-8.js new file mode 100644 index 000000000..cd3fc63e9 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-8.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. + +/*--- +info: > + The abtract operation ToPropertyDescriptor is used to package the + into a property desc. Step 10 of ToPropertyDescriptor throws a TypeError + if the property desc ends up having a mix of accessor and data property elements. +es5id: 15.2.3.6-3-8 +description: > + Object.defineProperty throws TypeError if getter is not callable + but not undefined (Null)(8.10.5 step 7.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // dummy getter + var getter = null; + var desc = { get: getter }; + + try { + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError && + (o.hasOwnProperty("foo") === false)) { + return true; + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-80.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-80.js new file mode 100644 index 000000000..5f6e1aa21 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-80.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.6-3-80 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + 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 ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + + Object.defineProperty(obj, "property", child); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-81.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-81.js new file mode 100644 index 000000000..416f8eb5a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-81.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.6-3-81 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' 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: false + }; + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + Object.defineProperty(child, "configurable", { + get: function () { + return true; + } + }); + + Object.defineProperty(obj, "property", child); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-82.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-82.js new file mode 100644 index 000000000..197b24852 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-82.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.6-3-82 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' 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 false; + } + }); + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + Object.defineProperty(child, "configurable", { + get: function () { + return true; + } + }); + + Object.defineProperty(obj, "property", child); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-83.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-83.js new file mode 100644 index 000000000..cfb52b80a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-83.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.6-3-83 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + own accessor property without a get function (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var attr = {}; + Object.defineProperty(attr, "configurable", { + set : function () { } + }); + + Object.defineProperty(obj, "property", attr); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + + return beforeDeleted === true && afterDeleted === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-84.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-84.js new file mode 100644 index 000000000..233fecf25 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-84.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.6-3-84 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' 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 ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + Object.defineProperty(child, "configurable", { + set: function () { } + }); + + Object.defineProperty(obj, "property", child); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + + return beforeDeleted === true && afterDeleted === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-85.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-85.js new file mode 100644 index 000000000..e5d79605b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-85.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.6-3-85 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + an 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 ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + + Object.defineProperty(obj, "property", child); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + + return beforeDeleted === true && afterDeleted === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-86-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-86-1.js new file mode 100644 index 000000000..ac8f8379c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-86-1.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.6-3-86-1 +description: > + Object.defineProperty - 'Attributes' is a Function object which + implements its own [[Get]] method to access the 'configurable' + property of prototype object (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Function.prototype.configurable = true; + var funObj = function (a, b) { + return a + b; + }; + + Object.defineProperty(obj, "property", funObj); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } finally { + delete Function.prototype.configurable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-86.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-86.js new file mode 100644 index 000000000..3d27461ca --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-86.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.6-3-86 +description: > + Object.defineProperty - 'Attributes' is a Function object which + implements its own [[Get]] method to access the 'configurable' + property (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var funObj = function (a, b) { + return a + b; + }; + + funObj.configurable = true; + + Object.defineProperty(obj, "property", funObj); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-87-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-87-1.js new file mode 100644 index 000000000..33ca3b94a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-87-1.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.6-3-87-1 +description: > + Object.defineProperty - 'Attributes' is an Array object that uses + Object's [[Get]] method to access the 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Array.prototype.configurable = true; + var arrObj = [1, 2, 3]; + + Object.defineProperty(obj, "property", arrObj); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } finally { + delete Array.prototype.configurable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-87.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-87.js new file mode 100644 index 000000000..7ac351e7d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-87.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.6-3-87 +description: > + Object.defineProperty - 'Attributes' is an Array object that uses + Object's [[Get]] method to access the 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var arrObj = [1, 2, 3]; + + arrObj.configurable = true; + + Object.defineProperty(obj, "property", arrObj); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-88-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-88-1.js new file mode 100644 index 000000000..665887839 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-88-1.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.6-3-88-1 +description: > + Object.defineProperty - 'Attributes' is a String object that uses + Object's [[Get]] method to access the 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + String.prototype.configurable = true; + var strObj = new String("abc"); + + Object.defineProperty(obj, "property", strObj); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } finally { + delete String.prototype.configurable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-88.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-88.js new file mode 100644 index 000000000..aeb35afeb --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-88.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.6-3-88 +description: > + Object.defineProperty - 'Attributes' is a String object that uses + Object's [[Get]] method to access the 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var strObj = new String("abc"); + + strObj.configurable = true; + + Object.defineProperty(obj, "property", strObj); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-89-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-89-1.js new file mode 100644 index 000000000..f873aea01 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-89-1.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.6-3-89-1 +description: > + Object.defineProperty - 'Attributes' is a Boolean object that uses + Object's [[Get]] method to access the 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Boolean.prototype.configurable = true; + var boolObj = new Boolean(true); + + Object.defineProperty(obj, "property", boolObj); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } finally { + delete Boolean.prototype.configurable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-89.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-89.js new file mode 100644 index 000000000..791f85732 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-89.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.6-3-89 +description: > + Object.defineProperty - 'Attributes' is a Boolean object that uses + Object's [[Get]] method to access the 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var boolObj = new Boolean(true); + + boolObj.configurable = true; + + Object.defineProperty(obj, "property", boolObj); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-9.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-9.js new file mode 100644 index 000000000..e448503ec --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-9.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. + +/*--- +info: > + The abtract operation ToPropertyDescriptor is used to package the + into a property desc. Step 10 of ToPropertyDescriptor throws a TypeError + if the property desc ends up having a mix of accessor and data property elements. +es5id: 15.2.3.6-3-9 +description: > + Object.defineProperty throws TypeError if getter is not callable + but not undefined (Object)(8.10.5 step 7.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // dummy getter + var getter = { a: 1 }; + var desc = { get: getter }; + + try { + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError && + (o.hasOwnProperty("foo") === false)) { + return true; + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-90-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-90-1.js new file mode 100644 index 000000000..6c401934b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-90-1.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.6-3-90-1 +description: > + Object.defineProperty - 'Attributes' is a Number object that uses + Object's [[Get]] method to access the 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Number.prototype.configurable = true; + var numObj = new Number(-2); + + Object.defineProperty(obj, "property", numObj); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } finally { + delete Number.prototype.configurable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-90.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-90.js new file mode 100644 index 000000000..36119b534 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-90.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.6-3-90 +description: > + Object.defineProperty - 'Attributes' is a Number object that uses + Object's [[Get]] method to access the 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var numObj = new Number(-2); + + numObj.configurable = true; + + Object.defineProperty(obj, "property", numObj); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-91-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-91-1.js new file mode 100644 index 000000000..0256ad79c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-91-1.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.6-3-91-1 +description: > + Object.defineProperty - 'Attributes' is the Math object that uses + Object's [[Get]] method to access the 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + Object.prototype.configurable = true; + + Object.defineProperty(obj, "property", Math); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } finally { + delete Object.prototype.configurable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-91.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-91.js new file mode 100644 index 000000000..9aec71335 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-91.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.6-3-91 +description: > + Object.defineProperty - 'Attributes' is the Math object that uses + Object's [[Get]] method to access the 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + Math.configurable = true; + + Object.defineProperty(obj, "property", Math); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } finally { + delete Math.configurable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-92-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-92-1.js new file mode 100644 index 000000000..25c435b0f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-92-1.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.6-3-92-1 +description: > + Object.defineProperty - 'Attributes' is a Date object that uses + Object's [[Get]] method to access the 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Date.prototype.configurable = true; + var dateObj = new Date(); + + Object.defineProperty(obj, "property", dateObj); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } finally { + delete Date.prototype.configurable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-92.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-92.js new file mode 100644 index 000000000..71221188e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-92.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.6-3-92 +description: > + Object.defineProperty - 'Attributes' is a Date object that uses + Object's [[Get]] method to access the 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var dateObj = new Date(); + + dateObj.configurable = true; + + Object.defineProperty(obj, "property", dateObj); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-93-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-93-1.js new file mode 100644 index 000000000..e145d94cd --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-93-1.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.6-3-93-1 +description: > + Object.defineProperty - 'Attributes' is an RegExp object that uses + Object's [[Get]] method to access the 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + RegExp.prototype.configurable = true; + var regObj = new RegExp(); + + Object.defineProperty(obj, "property", regObj); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } finally { + delete RegExp.prototype.configurable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-93.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-93.js new file mode 100644 index 000000000..a81542c4c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-93.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.6-3-93 +description: > + Object.defineProperty - 'Attributes' is an RegExp object that uses + Object's [[Get]] method to access the 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var regObj = new RegExp(); + + regObj.configurable = true; + + Object.defineProperty(obj, "property", regObj); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-94-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-94-1.js new file mode 100644 index 000000000..a83d013c0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-94-1.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.6-3-94-1 +description: > + Object.defineProperty - 'Attributes' is the JSON object that uses + Object's [[Get]] method to access the 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + Object.prototype.configurable = true; + + Object.defineProperty(obj, "property", JSON); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } finally { + delete Object.prototype.configurable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-94.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-94.js new file mode 100644 index 000000000..fad929404 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-94.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.6-3-94 +description: > + Object.defineProperty - 'Attributes' is the JSON object that uses + Object's [[Get]] method to access the 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + JSON.configurable = true; + + Object.defineProperty(obj, "property", JSON); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } finally { + delete JSON.configurable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-95-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-95-1.js new file mode 100644 index 000000000..e07c4543d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-95-1.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.6-3-95-1 +description: > + Object.defineProperty - 'Attributes' is an Error object that uses + Object's [[Get]] method to access the 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + try { + Error.prototype.configurable = true; + var errObj = new Error(); + + Object.defineProperty(obj, "property", errObj); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } finally { + delete Error.prototype.configurable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-95.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-95.js new file mode 100644 index 000000000..77c9b6e53 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-95.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.6-3-95 +description: > + Object.defineProperty - 'Attributes' is an Error object that uses + Object's [[Get]] method to access the 'configurable' property + (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + var errObj = new Error(); + + errObj.configurable = true; + + Object.defineProperty(obj, "property", errObj); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-96-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-96-1.js new file mode 100644 index 000000000..1d0dd4d83 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-96-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.6-3-96-1 +description: > + Object.defineProperty - 'Attributes' is an Arguments object which + implements its own [[Get]] method to access the 'configurable' + property (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + try { + Object.prototype.configurable = true; + var argObj = (function () { return arguments; })(); + + Object.defineProperty(obj, "property", argObj); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } finally { + delete Object.prototype.configurable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-96.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-96.js new file mode 100644 index 000000000..757eaaa9d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-96.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.6-3-96 +description: > + Object.defineProperty - 'Attributes' is an Arguments object which + implements its own [[Get]] method to access the 'configurable' + property (8.10.5 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var argObj = (function () { return arguments; })(); + argObj.configurable = true; + + Object.defineProperty(obj, "property", argObj); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-98.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-98.js new file mode 100644 index 000000000..7c43fed5b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-98.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.6-3-98 +description: > + Object.defineProperty - 'Attributes' is the global object that + uses Object's [[Get]] method to access the 'configurable' property + (8.10.5 step 4.a) +includes: + - runTestCase.js + - fnGlobalObject.js +---*/ + +function testcase() { + var obj = {}; + + try { + fnGlobalObject().configurable = true; + + Object.defineProperty(obj, "property", fnGlobalObject()); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property"); + + return beforeDeleted === true && afterDeleted === false; + } finally { + delete fnGlobalObject().configurable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-3-99.js b/test/built-ins/Object/defineProperty/15.2.3.6-3-99.js new file mode 100644 index 000000000..3a724aaf7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-3-99.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.6-3-99 +description: > + Object.defineProperty - 'configurable' property in 'Attributes' is + undefined (8.10.5 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { }; + + Object.defineProperty(obj, "property", { configurable: undefined }); + + var beforeDeleted = obj.hasOwnProperty("property"); + + delete obj.property; + + var afterDeleted = obj.hasOwnProperty("property") && typeof (obj.property) === "undefined"; + + return beforeDeleted === true && afterDeleted === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-1.js new file mode 100644 index 000000000..dcb704797 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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. + +/*--- +info: > + Step 4 of defineProperty calls the [[DefineOwnProperty]] internal method + of O passing 'true' for the Throw flag. In this case, step 3 of + [[DefineOwnProperty]] requires that it throw a TypeError exception when + current is undefined and extensible is false. The value of desc does not + matter. +es5id: 15.2.3.6-4-1 +description: > + Object.defineProperty throws TypeError when adding properties to + non-extensible objects(8.12.9 step 3) +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + Object.preventExtensions(o); + + try { + var desc = { value: 1 }; + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError && + (o.hasOwnProperty("foo") === false)) { + return true; + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-10.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-10.js new file mode 100644 index 000000000..d37177182 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-10.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. + +/*--- +info: > + Step 4 of defineProperty calls the [[DefineOwnProperty]] internal method + of O to define the property. Step 7b of [[DefineOwnProperty]] rejects if + current.[[Enumerable]] and desc.[[Enumerable]] are the boolean negations + of each other. +es5id: 15.2.3.6-4-10 +description: > + Object.defineProperty throws TypeError when changing + [[Enumerable]] from false to true on non-configurable accessor + properties +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // create an accessor property; all other attributes default to false. + // dummy getter + var getter = function () { return 1; } + var d1 = { get: getter, enumerable: false, configurable: false }; + Object.defineProperty(o, "foo", d1); + + // now, setting enumerable to true should fail, since [[Configurable]] + // on the original property will be false. + var desc = { get: getter, enumerable: true }; + + try { + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError) { + // the property should remain unchanged. + var d2 = Object.getOwnPropertyDescriptor(o, "foo"); + if (d2.get === getter && + d2.enumerable === false && + d2.configurable === false) { + return true; + } + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-100.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-100.js new file mode 100644 index 000000000..316211f30 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-100.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.6-4-100 +description: > + Object.defineProperty - 'name' and 'desc' are data properties, + desc.value and name.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.defineProperty(obj, "foo", { + value: 200 + }); + return dataPropertyAttributesAreCorrect(obj, "foo", 200, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-101.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-101.js new file mode 100644 index 000000000..6c477c904 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-101.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.6-4-101 +description: > + Object.defineProperty - 'name' and 'desc' are data properties, + name.value is present and desc.value is undefined (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.defineProperty(obj, "foo", { value: undefined }); + return dataPropertyAttributesAreCorrect(obj, "foo", undefined, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-102.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-102.js new file mode 100644 index 000000000..f9d96c6bc --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-102.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.6-4-102 +description: > + Object.defineProperty - 'name' and 'desc' are data properties, + desc.value is present and name.value is undefined (8.12.9 step 12) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + obj.foo = undefined; // default value of attributes: writable: true, configurable: true, enumerable: true + + Object.defineProperty(obj, "foo", { value: 100 }); + return dataPropertyAttributesAreCorrect(obj, "foo", 100, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-103.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-103.js new file mode 100644 index 000000000..89ab24562 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-103.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.6-4-103 +description: > + Object.defineProperty - 'name' and 'desc' are data properties, + name.writable and desc.writable are different values (8.12.9 step + 12) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + writable: false, configurable: true + }); + + Object.defineProperty(obj, "foo", { + writable: true + }); + return dataPropertyAttributesAreCorrect(obj, "foo", undefined, true, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-104.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-104.js new file mode 100644 index 000000000..4c7c0fd4f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-104.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.6-4-104 +description: > + Object.defineProperty - 'name' and 'desc' are data properties, + name.enumerable and desc.enumerable are different values (8.12.9 + step 12) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + enumerable: false, + configurable: true + }); + + Object.defineProperty(obj, "foo", { + enumerable: true + }); + return dataPropertyAttributesAreCorrect(obj, "foo", undefined, false, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-105.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-105.js new file mode 100644 index 000000000..5e6304857 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-105.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.6-4-105 +description: > + Object.defineProperty - 'name' and 'desc' are data properties, + name.configurable = true and desc.configurable = false (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.defineProperty(obj, "foo", { + configurable: false + }); + + return dataPropertyAttributesAreCorrect(obj, "foo", 200, true, true, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-106.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-106.js new file mode 100644 index 000000000..a5e4fa4a4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-106.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.6-4-106 +description: > + Object.defineProperty - 'name' and 'desc' are data properties, + several attributes values of name and desc are different (8.12.9 + step 12) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: 100, + writable: true, + enumerable: true, + configurable: true + }); + + Object.defineProperty(obj, "foo", { + value: 200, + writable: false, + enumerable: false + }); + return dataPropertyAttributesAreCorrect(obj, "foo", 200, false, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-107.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-107.js new file mode 100644 index 000000000..c6cc0d47e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-107.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.6-4-107 +description: > + Object.defineProperty - 'name' and 'desc' are accessor properties, + both desc.[[Get]] and name.[[Get]] are two different values + (8.12.9 step 12) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function getFunc() { + return 10; + } + + function setFunc(value) { + obj.setVerifyHelpProp = value; + } + + Object.defineProperty(obj, "foo", { + get: getFunc, + set: setFunc, + configurable: true + }); + + function getFunc2() { + return 20; + } + + Object.defineProperty(obj, "foo", { + get: getFunc2 + }); + return accessorPropertyAttributesAreCorrect(obj, "foo", getFunc2, setFunc, "setVerifyHelpProp", false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-108.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-108.js new file mode 100644 index 000000000..3d28dcb76 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-108.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.6-4-108 +description: > + Object.defineProperty - 'name' and 'desc' are accessor + properties, name.[[Get]] is present and desc.[[Get]] is undefined + (8.12.9 step 12) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function getFunc() { + return 10; + } + + function setFunc(value) { + obj.setVerifyHelpProp = value; + } + + Object.defineProperty(obj, "foo", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + + Object.defineProperty(obj, "foo", { + set: setFunc, + get: undefined + }); + return accessorPropertyAttributesAreCorrect(obj, "foo", undefined, setFunc, "setVerifyHelpProp", true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-109.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-109.js new file mode 100644 index 000000000..7b5c9b39a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-109.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.6-4-109 +description: > + Object.defineProperty - 'name' and 'desc' are accessor properties, + name.[[Get]] is undefined and desc.[[Get]] is function (8.12.9 + step 12) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = {}; + + function setFunc(value) { + obj.setVerifyHelpProp = value; + } + + Object.defineProperty(obj, "foo", { + set: setFunc, + get: undefined, + enumerable: true, + configurable: true + }); + + function getFunc() { + return 10; + } + + Object.defineProperty(obj, "foo", { + get: getFunc + }); + return accessorPropertyAttributesAreCorrect(obj, "foo", getFunc, setFunc, "setVerifyHelpProp", true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-11.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-11.js new file mode 100644 index 000000000..1a294a84d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-11.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. + +/*--- +info: > + Step 4 of defineProperty calls the [[DefineOwnProperty]] internal method + of O to define the property. Step 7b of [[DefineOwnProperty]] rejects if + current.[[Enumerable]] and desc.[[Enumerable]] are the boolean negations + of each other. +es5id: 15.2.3.6-4-11 +description: > + Object.defineProperty throws TypeError when changing + [[Enumerable]] from true to false on non-configurable accessor + properties +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // create an accessor property; all other attributes default to false. + // dummy getter + var getter = function () { return 1; } + var d1 = { get: getter, enumerable: true, configurable: false }; + Object.defineProperty(o, "foo", d1); + + // now, setting enumerable to true should fail, since [[Configurable]] + // on the original property will be false. + var desc = { get: getter, enumerable: false }; + + try { + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError) { + // the property should remain unchanged. + var d2 = Object.getOwnPropertyDescriptor(o, "foo"); + if (d2.get === getter && + d2.enumerable === true && + d2.configurable === false) { + return true; + } + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-110.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-110.js new file mode 100644 index 000000000..52eb4a67a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-110.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.6-4-110 +description: > + Object.defineProperty - 'name' and 'desc' are accessor properties, + both desc.[[Set]] and name.[[Set]] are two different values + (8.12.9 step 12) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function setFunc1() { + return 10; + } + + Object.defineProperty(obj, "foo", { + set: setFunc1, + enumerable: true, + configurable: true + }); + + function setFunc2(value) { + obj.setVerifyHelpProp = value; + } + + Object.defineProperty(obj, "foo", { + set: setFunc2 + }); + return accessorPropertyAttributesAreCorrect(obj, "foo", undefined, setFunc2, "setVerifyHelpProp", true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-111.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-111.js new file mode 100644 index 000000000..2e940544b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-111.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.6-4-111 +description: > + Object.defineProperty - 'name' and 'desc' are accessor + properties, name.[[Set]] is present and desc.[[Set]] is undefined + (8.12.9 step 12) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + function getFunc() { + return 10; + } + + function setFunc(value) { + obj.setVerifyHelpProp = value; + } + + Object.defineProperty(obj, "foo", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + + Object.defineProperty(obj, "foo", { + set: undefined, + get: getFunc + }); + + + var desc = Object.getOwnPropertyDescriptor(obj, "foo"); + return obj.hasOwnProperty("foo") && typeof (desc.set) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-112.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-112.js new file mode 100644 index 000000000..9fecb9176 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-112.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.6-4-112 +description: > + Object.defineProperty - 'name' and 'desc' are accessor properties, + name.[[Set]] is undefined and desc.[[Set]] is function (8.12.9 + step 12) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function getFunc() { + return 10; + } + + Object.defineProperty(obj, "foo", { + set: undefined, + get: getFunc, + enumerable: true, + configurable: true + }); + + function setFunc(value) { + obj.setVerifyHelpProp = value; + } + + Object.defineProperty(obj, "foo", { + set: setFunc + }); + return accessorPropertyAttributesAreCorrect(obj, "foo", getFunc, setFunc, "setVerifyHelpProp", true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-113.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-113.js new file mode 100644 index 000000000..3da8fe015 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-113.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.6-4-113 +description: > + Object.defineProperty - 'name' and 'desc' are accessor properties, + name.enumerable and desc.enumerable are different values (8.12.9 + step 12) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function getFunc() { + return 10; + } + + Object.defineProperty(obj, "foo", { + get: getFunc, + enumerable: true, + configurable: true + }); + + Object.defineProperty(obj, "foo", { + get: getFunc, + enumerable: false + }); + + return accessorPropertyAttributesAreCorrect(obj, "foo", getFunc, undefined, undefined, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-114.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-114.js new file mode 100644 index 000000000..3b40963bb --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-114.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.6-4-114 +description: > + Object.defineProperty - 'name' and 'desc' are accessor properties, + name.configurable = true and desc.configurable = false (8.12.9 + step 12) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function setFunc(value) { + obj.setVerifyHelpProp = value; + } + + function getFunc() { + return 10; + } + + Object.defineProperty(obj, "foo", { + get: getFunc, + set: setFunc, + configurable: true + }); + + Object.defineProperty(obj, "foo", { + get: getFunc, + configurable: false + }); + return accessorPropertyAttributesAreCorrect(obj, "foo", getFunc, setFunc, "setVerifyHelpProp", false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-115.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-115.js new file mode 100644 index 000000000..639e979f4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-115.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.6-4-115 +description: > + Object.defineProperty - 'name' and 'desc' are accessor properties, + several attributes values of 'name' and 'desc' are different + (8.12.9 step 12) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function getFunc1() { + return 10; + } + function setFunc1() {} + + Object.defineProperty(obj, "foo", { + get: getFunc1, + set: setFunc1, + enumerable: true, + configurable: true + }); + + function getFunc2() { + return 20; + } + function setFunc2(value) { + obj.setVerifyHelpProp = value; + } + Object.defineProperty(obj, "foo", { + get: getFunc2, + set: setFunc2, + enumerable: false + }); + return accessorPropertyAttributesAreCorrect(obj, "foo", getFunc2, setFunc2, "setVerifyHelpProp", false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-116.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-116.js new file mode 100644 index 000000000..944cd50fc --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-116.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.6-4-116 +description: > + Object.defineProperty - '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 arrObj = [0, 1]; + Object.defineProperty(arrObj, "1", { + value: 1, + configurable: false + }); + try { + Object.defineProperty(arrObj, "length", { value: 1 }); + return false; + } catch (e) { + var desc = Object.getOwnPropertyDescriptor(arrObj, "length"); + + return Object.hasOwnProperty.call(arrObj, "length") && desc.value === 2 && + desc.writable === true && desc.configurable === false && desc.enumerable === false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-117.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-117.js new file mode 100644 index 000000000..86bca3d95 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-117.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.6-4-117 +description: > + Object.defineProperty - '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 arrObj = [0, 1, 2]; + var arrProtoLen; + + try { + arrProtoLen = Array.prototype.length; + Array.prototype.length = 0; + + + Object.defineProperty(arrObj, "2", { + configurable: false + }); + + Object.defineProperty(arrObj, "length", { + value: 1 + }); + return false; + } catch (e) { + return e instanceof TypeError && arrObj.length === 3 && Array.prototype.length === 0; + } finally { + Array.prototype.length = arrProtoLen; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-118.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-118.js new file mode 100644 index 000000000..b9322775d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-118.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.6-4-118 +description: > + Object.defineProperty - 'O' is an Array, 'name' 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 arrObj = []; + + Object.defineProperty(arrObj, "length", {}); + + var verifyValue = false; + if (arrObj.length === 0) { + verifyValue = true; + } + + arrObj.length = 2; + var verifyWritable = arrObj.length === 2; + + var verifyEnumerable = false; + for (var p in arrObj) { + if (p === "length" && arrObj.hasOwnProperty(p)) { + verifyEnumerable = true; + } + } + + delete arrObj.length; + var verifyConfigurable = arrObj.hasOwnProperty("length"); + + return verifyValue && verifyWritable && !verifyEnumerable && verifyConfigurable; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-119.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-119.js new file mode 100644 index 000000000..1fc02fddb --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-119.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.6-4-119 +description: > + Object.defineProperty - 'O' is an Array, 'name' 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 arrObj = []; + Object.defineProperty(arrObj, "length", { + writable: true, + enumerable: false, + configurable: false + }); + + var verifyValue = false; + if (arrObj.length === 0) { + verifyValue = true; + } + + arrObj.length = 2; + var verifyWritable = arrObj.length === 2 ? true : false; + + var verifyEnumerable = false; + for (var p in arrObj) { + if (p === "length" && arrObj.hasOwnProperty(p)) { + verifyEnumerable = true; + } + } + + delete arrObj.length; + var verifyConfigurable = arrObj.hasOwnProperty("length"); + + return verifyValue && verifyWritable && !verifyEnumerable && verifyConfigurable; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-12.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-12.js new file mode 100644 index 000000000..572e31736 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-12.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. + +/*--- +info: > + Step 4 of defineProperty calls the [[DefineOwnProperty]] internal method + of O to define the property. For non-configurable properties, step 9a of + [[DefineOwnProperty]] rejects changing the kind of a property. +es5id: 15.2.3.6-4-12 +description: > + Object.defineProperty throws TypeError when changing + non-configurable data properties to accessor properties +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // create a data valued property; all other attributes default to false. + var d1 = { value: 101, configurable: false }; + Object.defineProperty(o, "foo", d1); + + // changing "foo" to be an accessor should fail, since [[Configurable]] + // on the original property will be false. + + // dummy getter + var getter = function () { return 1; } + + var desc = { get: getter }; + try { + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError) { + // the property should remain a data valued property. + var d2 = Object.getOwnPropertyDescriptor(o, "foo"); + if (d2.value === 101 && + d2.writable === false && + d2.enumerable === false && + d2.configurable === false) { + return true; + } + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-120.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-120.js new file mode 100644 index 000000000..8df298fb3 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-120.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.6-4-120 +description: > + Object.defineProperty - 'O' is an Array, 'name' 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 arrObj = []; + try { + Object.defineProperty(arrObj, "length", { + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-121.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-121.js new file mode 100644 index 000000000..bdbeabc1c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-121.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.6-4-121 +description: > + Object.defineProperty - 'O' is an Array, 'name' 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 arrObj = []; + try { + Object.defineProperty(arrObj, "length", { + enumerable: true + }); + return false; + } catch (e) { + return e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-122.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-122.js new file mode 100644 index 000000000..686f3a091 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-122 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', test TypeError is thrown when 'desc' is accessor + descriptor (15.4.5.1 step 3.a.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = []; + try { + Object.defineProperty(arrObj, "length", { + get: function () { + return 2; + } + }); + return false; + } catch (e) { + return e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-123.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-123.js new file mode 100644 index 000000000..11d08fa64 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-123.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.6-4-123 +description: > + Object.defineProperty - 'O' is an Array, 'name' 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 arrObj = []; + try { + Object.defineProperty(arrObj, "length", { + writable: false + }); + Object.defineProperty(arrObj, "length", { + writable: true + }); + + return false; + } catch (e) { + return e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-124.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-124.js new file mode 100644 index 000000000..71160001b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-124.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.6-4-124 +description: > + Object.defineProperty - 'O' is an Array, 'name' 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 arrObj = []; + + Object.defineProperty(arrObj, "length", { + writable: false + }); + return dataPropertyAttributesAreCorrect(arrObj, "length", 0, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-125.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-125.js new file mode 100644 index 000000000..e87b2f67c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-125.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.6-4-125 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', test that RangeError exception is thrown when + [[Value]] field of 'desc' is undefined (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = []; + + try { + Object.defineProperty(arrObj, "length", { + value: undefined + }); + return false; + } catch (e) { + return e instanceof RangeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-126.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-126.js new file mode 100644 index 000000000..6902ce11f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-126 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is null + (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = [0, 1]; + + Object.defineProperty(arrObj, "length", { + value: null + }); + return arrObj.length === 0; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-127.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-127.js new file mode 100644 index 000000000..f0311c2e7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-127 +description: > + Object.defineProperty - '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 arrObj = [0, 1]; + + Object.defineProperty(arrObj, "length", { + value: false + }); + return arrObj.length === 0 && !arrObj.hasOwnProperty("0") && !arrObj.hasOwnProperty("1"); + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-128.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-128.js new file mode 100644 index 000000000..3496f96eb --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-128 +description: > + Object.defineProperty - '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 arrObj = []; + + Object.defineProperty(arrObj, "length", { + value: true + }); + return arrObj.length === 1; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-129.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-129.js new file mode 100644 index 000000000..d9213a967 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-129.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.6-4-129 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', test RangeError exception is not thrown when the + [[Value]] field of 'desc' is 0 (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = [0, 1]; + + Object.defineProperty(arrObj, "length", { + value: 0 + }); + return arrObj.length === 0; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-13.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-13.js new file mode 100644 index 000000000..0d8f509c1 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-13.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. + +/*--- +info: > + Step 4 of defineProperty calls the [[DefineOwnProperty]] internal method + of O to define the property. For non-configurable properties, step 9a of + [[DefineOwnProperty]] rejects changing the kind of a property. +es5id: 15.2.3.6-4-13 +description: > + Object.defineProperty throws TypeError when changing + non-configurable accessor properties to data properties +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // create an accessor property; all other attributes default to false. + + // dummy getter + var getter = function () { return 1; } + var d1 = { get: getter, configurable: false }; + Object.defineProperty(o, "foo", d1); + + // changing "foo" to be a data property should fail, since [[Configurable]] + // on the original property will be false. + var desc = { value: 101 }; + + try { + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError) { + // the property should remain an accessor property. + var d2 = Object.getOwnPropertyDescriptor(o, "foo"); + if (d2.get === getter && + d2.configurable === false) { + return true; + } + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-130.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-130.js new file mode 100644 index 000000000..e497128c7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-130.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.6-4-130 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', test RangeError exception is not thrown when the + [[Value]] field of 'desc' is +0 (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = [0, 1]; + + Object.defineProperty(arrObj, "length", { + value: +0 + }); + return arrObj.length === 0; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-131.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-131.js new file mode 100644 index 000000000..4b2ae5955 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-131.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.6-4-131 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', test RangeError exception is not thrown when the + [[Value]] field of 'desc' is -0 (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = [0, 1]; + + Object.defineProperty(arrObj, "length", { + value: -0 + }); + return arrObj.length === 0; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-132.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-132.js new file mode 100644 index 000000000..7c144ffd6 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-132.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.6-4-132 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', test RangeError exception is not thrown when the + [[Value]] field of 'desc' is a positive number (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = []; + + Object.defineProperty(arrObj, "length", { + value: 12 + }); + return arrObj.length === 12; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-133.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-133.js new file mode 100644 index 000000000..4211658bd --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-133.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.6-4-133 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', test RangeError exception is thrown when the + [[Value]] field of 'desc' is a negative number (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = []; + + try { + Object.defineProperty(arrObj, "length", { + value: -9 + }); + return false; + } catch (e) { + return e instanceof RangeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-134.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-134.js new file mode 100644 index 000000000..6676aaa53 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-134 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', test RangeError exception is thrown when the + [[Value]] field of 'desc' is +Infinity (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = []; + + try { + Object.defineProperty(arrObj, "length", { + value: +Infinity + }); + return false; + } catch (e) { + return e instanceof RangeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-135.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-135.js new file mode 100644 index 000000000..ecaf993d1 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-135.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.6-4-135 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', test RangeError exception is thrown when the + [[Value]] field of 'desc' is -Infinity (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = []; + + try { + Object.defineProperty(arrObj, "length", { + value: -Infinity + }); + return false; + } catch (e) { + return e instanceof RangeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-136.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-136.js new file mode 100644 index 000000000..37bc70617 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-136.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.6-4-136 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', test RangeError exception is thrown when the + [[Value]] field of 'desc' is NaN (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = []; + + try { + Object.defineProperty(arrObj, "length", { + value: NaN + }); + return false; + } catch (e) { + return e instanceof RangeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-137.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-137.js new file mode 100644 index 000000000..26f64669b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-137.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.6-4-137 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', test RangeError exception is not thrown when 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 arrObj = []; + + Object.defineProperty(arrObj, "length", { + value: "2" + }); + return arrObj.length === 2; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-138.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-138.js new file mode 100644 index 000000000..2b298db2b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-138.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.6-4-138 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', test RangeError exception is thrown when 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 arrObj = []; + + try { + Object.defineProperty(arrObj, "length", { + value: "-42" + }); + return false; + } catch (e) { + return e instanceof RangeError; + } + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-139.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-139.js new file mode 100644 index 000000000..3578c060e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-139.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.6-4-139 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', test RangeError exception is thrown when 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 arrObj = []; + + try { + Object.defineProperty(arrObj, "length", { + value: "200.59" + }); + return false; + } catch (e) { + return e instanceof RangeError; + } + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-14.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-14.js new file mode 100644 index 000000000..a0a11efaf --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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. + +/*--- +info: > + Step 4 of defineProperty calls the [[DefineOwnProperty]] internal method + of O to define the property. For configurable properties, step 9b of + [[DefineOwnProperty]] permits changing the kind of a property. +es5id: 15.2.3.6-4-14 +description: > + Object.defineProperty permits changing data property to accessor + property for configurable properties +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // create a data property. In this case, + // [[Enumerable]] and [[Configurable]] are true + o["foo"] = 101; + + // changing "foo" to be an accessor should succeed, since [[Configurable]] + // on the original property will be true. Existing values of [[Configurable]] + // and [[Enumerable]] need to be preserved and the rest need to be set to + // their default values + + // dummy getter + var getter = function () { return 1; } + var d1 = { get: getter }; + Object.defineProperty(o, "foo", d1); + + var d2 = Object.getOwnPropertyDescriptor(o, "foo"); + + if (d2.get === getter && + d2.enumerable === true && + d2.configurable === true) { + return true; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-140.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-140.js new file mode 100644 index 000000000..85c3fe975 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-140.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.6-4-140 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', test RangeError exception is thrown when the + [[Value]] field of 'desc' is a string containing +Infinity + (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = []; + + try { + Object.defineProperty(arrObj, "length", { + value: "+Infinity" + }); + return false; + } catch (e) { + return e instanceof RangeError; + } + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-141.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-141.js new file mode 100644 index 000000000..0767e650c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-141.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.6-4-141 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', test RangeError exception is thrown when the + [[Value]] field of 'desc' is a string containing -Infinity + (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = []; + + try { + Object.defineProperty(arrObj, "length", { + value: "-Infinity" + }); + return false; + } catch (e) { + return e instanceof RangeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-142.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-142.js new file mode 100644 index 000000000..b0dbc0110 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-142.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.6-4-142 +description: > + Object.defineProperty - '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 arrObj = []; + + Object.defineProperty(arrObj, "length", { + value: "2E3" + }); + return arrObj.length === 2E3; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-143.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-143.js new file mode 100644 index 000000000..7256ee28d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-143.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.6-4-143 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is a string + containing a hex number (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = []; + + Object.defineProperty(arrObj, "length", { + value: "0x00B" + }); + return arrObj.length === 0x00B; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-144.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-144.js new file mode 100644 index 000000000..0488e3110 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-144.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.6-4-144 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is a string + containing a number with leading zeros (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = []; + + Object.defineProperty(arrObj, "length", { + value: "0002.0" + }); + return arrObj.length === 2; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-145.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-145.js new file mode 100644 index 000000000..c5259757e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-145.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.6-4-145 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', test RangeError exception is thrown when 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 arrObj = []; + + try { + Object.defineProperty(arrObj, "length", { + value: "two" + }); + return false; + } catch (e) { + return e instanceof RangeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-146.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-146.js new file mode 100644 index 000000000..a3f198507 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-146.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.6-4-146 +description: > + Object.defineProperty - '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 method (15.4.5.1 step 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = []; + + Object.defineProperty(arrObj, "length", { + value: { + toString: function () { + return '2'; + } + } + }); + return arrObj.length === 2; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-147.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-147.js new file mode 100644 index 000000000..ccd655932 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-147.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.6-4-147 +description: > + Object.defineProperty - '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 arrObj = []; + + Object.defineProperty(arrObj, "length", { + value: { + valueOf: function () { + return 2; + } + } + }); + return arrObj.length === 2; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-148.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-148.js new file mode 100644 index 000000000..2ff090b27 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-148.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.6-4-148 +description: > + Object.defineProperty - '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 arrObj = []; + var toStringAccessed = false; + var valueOfAccessed = false; + + Object.defineProperty(arrObj, "length", { + value: { + toString: function () { + toStringAccessed = true; + return '2'; + }, + + valueOf: function () { + valueOfAccessed = true; + return {}; + } + } + }); + return arrObj.length === 2 && toStringAccessed && valueOfAccessed; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-149.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-149.js new file mode 100644 index 000000000..b87adea7f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-149.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.6-4-149 +description: > + Object.defineProperty - '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 arrObj = []; + var toStringAccessed = false; + var valueOfAccessed = false; + + Object.defineProperty(arrObj, "length", { + value: { + toString: function () { + toStringAccessed = true; + return '2'; + }, + + valueOf: function () { + valueOfAccessed = true; + return 3; + } + } + }); + return arrObj.length === 3 && !toStringAccessed && valueOfAccessed; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-15.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-15.js new file mode 100644 index 000000000..fb693d89a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-15.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. + +/*--- +info: > + Step 4 of defineProperty calls the [[DefineOwnProperty]] internal method + of O to define the property. For configurable properties, step 9c of + [[DefineOwnProperty]] permits changing the kind of a property. +es5id: 15.2.3.6-4-15 +description: > + Object.defineProperty permits changing accessor property to data + property for configurable properties +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // define an accessor property + // dummy getter + var getter = function () { return 1; } + var d1 = { get: getter, configurable: true }; + Object.defineProperty(o, "foo", d1); + + // changing "foo" to be a data valued property should succeed, since + // [[Configurable]] on the original property will be true. Existing + // values of [[Configurable]] and [[Enumerable]] need to be preserved + // and the rest need to be set to their default values. + var desc = { value: 101 }; + Object.defineProperty(o, "foo", desc); + var d2 = Object.getOwnPropertyDescriptor(o, "foo"); + + if (d2.value === 101 && + d2.writable === false && + d2.enumerable === false && + d2.configurable === true) { + return true; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-150.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-150.js new file mode 100644 index 000000000..2ba3bf13b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-150.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.6-4-150 +description: > + Object.defineProperty - '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 arrObj = []; + var toStringAccessed = false; + var valueOfAccessed = false; + + try { + Object.defineProperty(arrObj, "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/defineProperty/15.2.3.6-4-151.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-151.js new file mode 100644 index 000000000..5c6fbc0ec --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-151.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.6-4-151 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', and the [[Value]] field of 'desc' is an Object + with an own toString method and an inherited valueOf method + (15.4.5.1 step 3.c), test that the inherited valueOf method is used +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = []; + var toStringAccessed = false; + var valueOfAccessed = false; + + var proto = { + valueOf: function () { + valueOfAccessed = true; + return 2; + } + }; + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + + var child = new ConstructFun(); + child.toString = function () { + toStringAccessed = true; + return 3; + }; + + Object.defineProperty(arrObj, "length", { + value: child + }); + return arrObj.length === 2 && !toStringAccessed && valueOfAccessed; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-152.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-152.js new file mode 100644 index 000000000..8bdfcf32b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-152 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', test RangeError is thrown when the [[Value]] + field of 'desc' is a positive non-integer values (15.4.5.1 step + 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = []; + + try { + Object.defineProperty(arrObj, "length", { + value: 123.5 + }); + + return false; + } catch (e) { + return e instanceof RangeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-153.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-153.js new file mode 100644 index 000000000..cecf00720 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-153.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.6-4-153 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', test RangeError is thrown when the [[Value]] + field of 'desc' is a negative non-integer values (15.4.5.1 step + 3.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = []; + + try { + Object.defineProperty(arrObj, "length", { + value: -4294967294.5 + }); + + return false; + } catch (e) { + return e instanceof RangeError; + } + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-154.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-154.js new file mode 100644 index 000000000..4f812ea41 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-154.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.6-4-154 +description: > + Object.defineProperty - '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 arrObj = []; + + Object.defineProperty(arrObj, "length", { + value: 4294967294 + }); + + return arrObj.length === 4294967294; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-155.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-155.js new file mode 100644 index 000000000..9cc721722 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-155.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.6-4-155 +description: > + Object.defineProperty - '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 arrObj = []; + + Object.defineProperty(arrObj, "length", { + value: 4294967295 + }); + + return arrObj.length === 4294967295; + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-156.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-156.js new file mode 100644 index 000000000..d03503c13 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-156.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.6-4-156 +description: > + Object.defineProperty - '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 arrObj = []; + + try { + Object.defineProperty(arrObj, "length", { + value: 4294967296 + }); + return false; + } catch (e) { + return e instanceof RangeError; + } + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-157.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-157.js new file mode 100644 index 000000000..4f1c95151 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-157.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.6-4-157 +description: > + Object.defineProperty - '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 arrObj = []; + + try { + Object.defineProperty(arrObj, "length", { + value: 4294967297 + }); + return false; + } catch (e) { + return e instanceof RangeError; + } + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-159.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-159.js new file mode 100644 index 000000000..303bb463e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-159.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.6-4-159 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', set the [[Value]] field of 'desc' to a value + greater than the existing value of length (15.4.5.1 step 3.f) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = [0, , 2]; + + Object.defineProperty(arrObj, "length", { + value: 5 + }); + + return arrObj.length === 5 && arrObj[0] === 0 && + !arrObj.hasOwnProperty("1") && arrObj[2] === 2 && + !arrObj.hasOwnProperty("4"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-16.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-16.js new file mode 100644 index 000000000..cc0df59ac --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-16.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. + +/*--- +info: > + Step 4 of defineProperty calls the [[DefineOwnProperty]] internal method + of O to define the property. For non-configurable properties, step 10.a.i + of [[DefineOwnProperty]] rejects if relaxing the [[Writable]] attribute. +es5id: 15.2.3.6-4-16 +description: > + Object.defineProperty throws TypeError when relaxing [[Writable]] + on non-configurable data properties +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // create a data valued property; all other attributes default to false. + var d1 = { value: 101 }; + Object.defineProperty(o, "foo", d1); + + // now, relaxing [[Writable]] on "foo" should fail, since both + // [[Configurable]] and [[Writable]] on the original property will be false. + var desc = { value: 101, writable: true }; + + try { + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError) { + // the property should remain unchanged. + var d2 = Object.getOwnPropertyDescriptor(o, "foo"); + if (d2.value === 101 && + d2.writable === false && + d2.enumerable === false && + d2.configurable === false) { + return true; + } + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-160.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-160.js new file mode 100644 index 000000000..45306ab8b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-160.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.6-4-160 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', set the [[Value]] field of 'desc' to a value + equal to the existing value of length (15.4.5.1 step 3.f) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = [0, , 2]; + + Object.defineProperty(arrObj, "length", { + value: 3 + }); + + return arrObj.length === 3 && arrObj[0] === 0 && !arrObj.hasOwnProperty("1") && arrObj[2] === 2; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-161.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-161.js new file mode 100644 index 000000000..066943f2c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-161.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.6-4-161 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', set the [[Value]] field of 'desc' to a value + lesser than the existing value of length and test that indexes + beyond the new length are deleted(15.4.5.1 step 3.f) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = [0, 1]; + + Object.defineProperty(arrObj, "length", { + value: 1 + }); + return arrObj.length === 1 && !arrObj.hasOwnProperty("1"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-162.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-162.js new file mode 100644 index 000000000..e0c74d727 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-162.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.6-4-162 +description: > + Object.defineProperty - 'O' is an Array, 'name' 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 arrObj = []; + + Object.defineProperty(arrObj, "length", { + writable: false + }); + + try { + Object.defineProperty(arrObj, "length", { + value: 12 + }); + return false; + } catch (e) { + return e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-163.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-163.js new file mode 100644 index 000000000..ec8d59ce4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-163.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.6-4-163 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', the [[Value]] field of 'desc' equals to value of + the length property, test no TypeError is thrown when the length + property is not writable (15.4.5.1 step 3.f.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = []; + + Object.defineProperty(arrObj, "length", { + writable: false + }); + + try { + Object.defineProperty(arrObj, "length", { + value: 0 + }); + return true; + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-164.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-164.js new file mode 100644 index 000000000..24d6829a0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-164.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.6-4-164 +description: > + Object.defineProperty - 'O' is an Array, 'name' 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 arrObj = [0, 1]; + + Object.defineProperty(arrObj, "length", { + writable: false + }); + + try { + Object.defineProperty(arrObj, "length", { + value: 0 + }); + return false; + } catch (e) { + return e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-165.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-165.js new file mode 100644 index 000000000..6689b10a7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-165.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.6-4-165 +description: > + Object.defineProperty - 'O' is an Array, 'name' 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 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 arrObj = [0, 1]; + + Object.defineProperty(arrObj, "length", { + value: 1 + }); + + var indexDeleted = !arrObj.hasOwnProperty("1"); + + arrObj.length = 10; + + return indexDeleted && arrObj.length === 10; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-166.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-166.js new file mode 100644 index 000000000..e0158fed1 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-166.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.6-4-166 +description: > + Object.defineProperty - 'O' is an Array, 'name' 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 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 arrObj = [0, 1]; + + Object.defineProperty(arrObj, "length", { + value: 1, + writable: true + }); + + var indexDeleted = !arrObj.hasOwnProperty("1"); + + arrObj.length = 10; + + return indexDeleted && arrObj.length === 10; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-167.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-167.js new file mode 100644 index 000000000..03dd2fbab --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-167.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.6-4-167 +description: > + Object.defineProperty - 'O' is an Array, 'name' 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 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 arrObj = [0, 1]; + + Object.defineProperty(arrObj, "length", { + value: 1, + writable: false + }); + + var indexDeleted = !arrObj.hasOwnProperty("1"); + + arrObj.length = 10; + + return indexDeleted && arrObj.length === 1; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-168.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-168.js new file mode 100644 index 000000000..c4e0fe9b9 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-168.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.6-4-168 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', whose writable attribute is being changed to + false and the [[Value]] field of 'desc' is less than value of the + length property and also lesser than an index of the array which + is set to configurable:false, test that new length is set to a + value greater than the non-deletable index by 1, writable + attribute of length is set to false and TypeError exception is + thrown (15.4.5.1 step 3.i.iii) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = [0, 1, 2]; + + try { + Object.defineProperty(arrObj, "1", { + configurable: false + }); + + Object.defineProperty(arrObj, "length", { + value: 0, + writable: false + }); + return false; + } catch (e) { + return e instanceof TypeError && arrObj.length === 2; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-169.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-169.js new file mode 100644 index 000000000..883f5e441 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-169.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.6-4-169 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property and also lesser than an index of the array + which is set to configurable: false, test that new length is set + to a value greater than the non-deletable index by 1, and + TypeError is thrown (15.4.5.1 step 3.l.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = [0, 1, 2]; + + Object.defineProperty(arrObj, "1", { + configurable: false + }); + + Object.defineProperty(arrObj, "2", { + configurable: true + }); + + try { + Object.defineProperty(arrObj, "length", { + value: 1 + }); + return false; + } catch (e) { + return e instanceof TypeError && arrObj.length === 2 && !arrObj.hasOwnProperty("2"); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-17.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-17.js new file mode 100644 index 000000000..f08f108df --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-17.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. + +/*--- +info: > + Step 4 of defineProperty calls the [[DefineOwnProperty]] internal method + of O to define the property. For non-configurable properties, step 10.a.ii.1 + of [[DefineOwnProperty]] rejects changing the value of non-writable properties. +es5id: 15.2.3.6-4-17 +description: > + Object.defineProperty throws TypeError when changing value of + non-writable non-configurable data properties +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // create a data valued property; all other attributes default to false. + var d1 = { value: 101 }; + Object.defineProperty(o, "foo", d1); + + // now, trying to change the value of "foo" should fail, since both + // [[Configurable]] and [[Writable]] on the original property will be false. + var desc = { value: 102 }; + + try { + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError) { + // the property should remain unchanged. + var d2 = Object.getOwnPropertyDescriptor(o, "foo"); + + if (d2.value === 101 && + d2.writable === false && + d2.enumerable === false && + d2.configurable === false) { + return true; + } + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-170.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-170.js new file mode 100644 index 000000000..43cbc6be3 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-170.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.6-4-170 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property and also lesser than an index of the array + which is set to configurable: false, test that new length is set + to a value greater than the non-deletable index by 1, writable + attribute of length is set to false and TypeError exception is + thrown (15.4.5.1 step 3.l.ii) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = [0, 1]; + + try { + Object.defineProperty(arrObj, "1", { + configurable: false + }); + + Object.defineProperty(arrObj, "length", { + value: 1 + }); + + return false; + } catch (e) { + return e instanceof TypeError && arrObj.length === 2 && arrObj.hasOwnProperty("1"); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-171.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-171.js new file mode 100644 index 000000000..c379fbca6 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-171.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.6-4-171 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Configurable]] attribute of an + 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 arrObj = [0, 1]; + try { + Array.prototype[1] = 2; // Not setting 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.defineProperty(arrObj, "length", { + value: 1 + }); + return arrObj.length === 1 && !arrObj.hasOwnProperty("1"); + } finally { + delete Array.prototype[1]; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-172.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-172.js new file mode 100644 index 000000000..8718db87e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-172.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.6-4-172 +description: > + Object.defineProperty - 'O' is an Array, 'name' 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 an + inherited data property can stop deleting index named properties + (15.4.5.1 step 3.l.ii) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = [0, 1]; + try { + Object.defineProperty(arrObj, "1", { + configurable: false + }); + + Array.prototype[1] = 2; + Object.defineProperty(arrObj, "length", { + value: 1 + }); + return false; + } catch (e) { + return e instanceof TypeError && arrObj.length === 2 && arrObj.hasOwnProperty("1"); + } finally { + delete Array.prototype[1]; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-173.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-173.js new file mode 100644 index 000000000..313e530f1 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-173.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.6-4-173 +description: > + Object.defineProperty - 'O' is an Array, 'name' 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 an + inherited accessor property can stop deleting index named + properties (15.4.5.1 step 3.l.ii) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = [0, 1]; + try { + Object.defineProperty(arrObj, "1", { + configurable: false + }); + + Object.defineProperty(Array.prototype, "1", { + get: function () { + return 2; + }, + configurable: true + }); + + Object.defineProperty(arrObj, "length", { + value: 1 + }); + + return false; + } catch (e) { + return e instanceof TypeError && arrObj.length === 2 && arrObj.hasOwnProperty("1"); + } finally { + delete Array.prototype[1]; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-174.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-174.js new file mode 100644 index 000000000..f0a9e3734 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-174.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.6-4-174 +description: > + Object.defineProperty - 'O' is an Array, 'name' 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 arrObj = [0, 1]; + + try { + Object.defineProperty(arrObj, "1", { + get: function () { + return 1; + }, + configurable: false + }); + + Object.defineProperty(arrObj, "length", { + value: 1 + }); + + return false; + } catch (e) { + return e instanceof TypeError && arrObj.length === 2 && arrObj.hasOwnProperty("1"); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-175.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-175.js new file mode 100644 index 000000000..0e96b4241 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-175.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.6-4-175 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Configurable]] attribute of an + 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 arrObj = [0, 1]; + try { + Object.defineProperty(Array.prototype, "1", { + get: function () { + return 1; + }, + configurable: true // Not setting 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.defineProperty(arrObj, "length", { + value: 1 + }); + + return arrObj.length === 1 && !arrObj.hasOwnProperty("1"); + } finally { + delete Array.prototype[1]; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-176.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-176.js new file mode 100644 index 000000000..d6d6a7415 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-176 +description: > + Object.defineProperty - 'O' is an Array, 'name' 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 + an inherited data property can stop deleting index named + properties (15.4.5.1 step 3.l.ii) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = [0, 1]; + try { + Object.defineProperty(arrObj, "1", { + get: function () { + return 2; + }, + configurable: false + }); + + Array.prototype[1] = 2; + Object.defineProperty(arrObj, "length", { + value: 1 + }); + return false; + } catch (e) { + return e instanceof TypeError && arrObj.length === 2 && arrObj.hasOwnProperty("1"); + } finally { + delete Array.prototype[1]; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-177.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-177.js new file mode 100644 index 000000000..8e9fdd731 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-177.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.6-4-177 +description: > + Object.defineProperty - 'O' is an Array, 'name' 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 + an inherited accessor property can stop deleting index named + properties (15.4.5.1 step 3.l.ii) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = [0, 1]; + try { + Object.defineProperty(arrObj, "1", { + get: function () { + return 1; + }, + configurable: false + }); + + Object.defineProperty(Array.prototype, "1", { + get: function () { + return 2; + }, + configurable: true + }); + + Object.defineProperty(arrObj, "length", { + value: 1 + }); + return false; + } catch (e) { + return e instanceof TypeError && arrObj.length === 2 && arrObj.hasOwnProperty("1"); + } finally { + delete Array.prototype[1]; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-178.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-178.js new file mode 100644 index 000000000..b1e06fc34 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-178 +description: > + Object.defineProperty - 'O' is an Array, 'name' 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' is deleted (15.4.5.1 step 3.l.ii) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = [0, 1]; + + Object.defineProperty(arrObj, "length", { + value: 1 + }); + + return !arrObj.hasOwnProperty("1"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-179-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-179-1.js new file mode 100644 index 000000000..5d07d17b2 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-179-1.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.6-4-179-1 +description: > + Object.defineProperty - 'O' is an Array, 'name' is the length + property of 'O', the [[Value]] field of 'desc' is greater than + value of the length property, test value of the length property + is same as [[Value]] (15.4.5.1 step 3.l.iii.1) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arrObj = [0, 1, 2, 3]; + + Object.defineProperty(arrObj, "1", { + configurable: false + }); + + Object.defineProperty(arrObj, "length", { + value: 3 + }); + + return arrObj.length === 3; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-18.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-18.js new file mode 100644 index 000000000..b25e7785f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-18.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. + +/*--- +info: > + Step 4 of defineProperty calls the [[DefineOwnProperty]] internal method + of O to define the property. For non-configurable properties, step 11.a.i + of [[DefineOwnProperty]] rejects changing the setter if present. +es5id: 15.2.3.6-4-18 +description: > + Object.defineProperty throws TypeError when changing setter of + non-configurable accessor properties(8.12.9 step 11.a.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // create an accessor property; all other attributes default to false. + // dummy getter + var getter = function () { return 1;} + var d1 = { get: getter }; + Object.defineProperty(o, "foo", d1); + + // now, trying to change the setter should fail, since [[Configurable]] + // on the original property will be false. + var setter = function (x) {}; + var desc = { set: setter }; + + try { + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError) { + // the property should remain unchanged. + var d2 = Object.getOwnPropertyDescriptor(o, "foo"); + if (d2.get === getter && + d2.configurable === false && + d2.enumerable === false) { + return true; + } + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-181.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-181.js new file mode 100644 index 000000000..b25f7a081 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-181.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.6-4-181 +description: > + Object.defineProperty - 'O' is an Array, 'name' 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 arrObj = [0, 1]; + + Object.defineProperty(arrObj, "length", { + value: 0, + writable: false + }); + + arrObj.length = 10; //try to overwrite length value of arr + return !arrObj.hasOwnProperty("1") && arrObj.length === 0; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-182.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-182.js new file mode 100644 index 000000000..73e8c5cf2 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-182 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is available String values that convert to + numbers (15.4.5.1 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = []; + + Object.defineProperty(arrObj, "0", { + value: 12 + }); + + return arrObj[0] === 12; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-183.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-183.js new file mode 100644 index 000000000..e5d1c0197 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-183.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.6-4-183 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is boundary value 2^32 - 2 (15.4.5.1 step + 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arrObj = []; + + Object.defineProperty(arrObj, 4294967294, { + value: 100 + }); + + return arrObj.hasOwnProperty("4294967294") && arrObj.length === 4294967295 && arrObj[4294967294] === 100; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-184.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-184.js new file mode 100644 index 000000000..709e4d744 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-184.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.6-4-184 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is boundary value 2^32 - 1 (15.4.5.1 step + 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arrObj = []; + + Object.defineProperty(arrObj, 4294967295, { + value: 100 + }); + + return arrObj.hasOwnProperty("4294967295") && arrObj.length === 0 && arrObj[4294967295] === 100; ; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-185.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-185.js new file mode 100644 index 000000000..6181ff399 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-185.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.6-4-185 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is boundary value 2^32 (15.4.5.1 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arrObj = []; + + Object.defineProperty(arrObj, 4294967296, { + value: 100 + }); + + return arrObj.hasOwnProperty("4294967296") && arrObj.length === 0 && arrObj[4294967296] === 100; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-186.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-186.js new file mode 100644 index 000000000..6cf69fb5f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-186.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.6-4-186 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is boundary value 2^32 + 1 (15.4.5.1 step + 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arrObj = []; + + Object.defineProperty(arrObj, 4294967297, { + value: 100 + }); + + return arrObj.hasOwnProperty("4294967297") && arrObj.length === 0 && arrObj[4294967297] === 100; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-187.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-187.js new file mode 100644 index 000000000..981ebd29b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-187.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.6-4-187 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, test TypeError is not thrown if the [[Writable]] + attribute of the length property in 'O' is false and value of + 'name' is less than value of the length property (15.4.5.1 step + 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arrObj = [1, 2, 3]; + + Object.defineProperty(arrObj, "length", { + writable: false + }); + + try { + Object.defineProperty(arrObj, 1, { + value: "abc" + }); + + return true; + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-188.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-188.js new file mode 100644 index 000000000..a9b92e7e4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-188.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.6-4-188 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, test TypeError is thrown if the [[Writable]] + attribute of the length property in 'O' is false and value of + 'name' equals to value of the length property (15.4.5.1 step 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arrObj = [1, 2, 3]; + + Object.defineProperty(arrObj, "length", { + writable: false + }); + + try { + Object.defineProperty(arrObj, 3, { + value: "abc" + }); + + return false; + } catch (e) { + return e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-189.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-189.js new file mode 100644 index 000000000..2011c1411 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-189.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.6-4-189 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, test TypeError is thrown if the [[Writable]] + attribute of the length property in 'O' is false and value of + 'name' is greater than value of the length property (15.4.5.1 step + 4.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arrObj = [1, 2, 3]; + + Object.defineProperty(arrObj, "length", { + writable: false + }); + + try { + Object.defineProperty(arrObj, 4, { + value: "abc" + }); + + return false; + } catch (e) { + return e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-19.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-19.js new file mode 100644 index 000000000..c08e31581 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-19.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. + +/*--- +info: > + Step 4 of defineProperty calls the [[DefineOwnProperty]] internal method + of O to define the property. For non-configurable properties, step 11.a.i + of [[DefineOwnProperty]] permits setting a setter (if absent). +es5id: 15.2.3.6-4-19 +description: > + Object.defineProperty permits setting a setter (if absent) of + non-configurable accessor properties(8.12.9 step 10.a.ii.1) +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // create an accessor property; all other attributes default to false. + // dummy getter + var getter = function () { return 1;} + var d1 = { get: getter }; + Object.defineProperty(o, "foo", d1); + + // now, trying to set the setter should succeed even though [[Configurable]] + // on the original property will be false. + var desc = { set: undefined }; + Object.defineProperty(o, "foo", desc); + + var d2 = Object.getOwnPropertyDescriptor(o, "foo"); + + if (d2.get === getter && + d2.set === undefined && + d2.configurable === false && + d2.enumerable === false) { + return true; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-190.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-190.js new file mode 100644 index 000000000..95365ed27 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-190.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.6-4-190 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is own data property, test TypeError is + thrown on updating the configurable attribute from false to true + (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + Object.defineProperty(arrObj, 0, { + value: "ownDataProperty", + configurable: false + }); + + try { + Object.defineProperty(arrObj, 0, { + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError && + dataPropertyAttributesAreCorrect(arrObj, "0", "ownDataProperty", false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-191.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-191.js new file mode 100644 index 000000000..2681ef4ac --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-191.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.6-4-191 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is an inherited data property, test that + defining own index named property is successful (15.4.5.1 step 4.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + try { + Object.defineProperty(Array.prototype, "0", { + value: 11, + configurable: true + }); + + var arrObj = []; + + Object.defineProperty(arrObj, "0", { + configurable: false + }); + return arrObj.hasOwnProperty("0") && Array.prototype[0] === 11 && typeof arrObj[0] === "undefined"; + } finally { + delete Array.prototype[0]; + } + + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-192.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-192.js new file mode 100644 index 000000000..b5e1f7221 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-192.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.6-4-192 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is own data property that overrides an + inherited data property, test TypeError is thrown on updating the + [[Configurable]] attribute from false to true (15.4.5.1 step 4.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + try { + Object.defineProperty(Array.prototype, "0", { + value: 11, + configurable: true + }); + + var arrObj = []; + Object.defineProperty(arrObj, "0", { + value: 12, + configurable: false + }); + + Object.defineProperty(arrObj, "0", { + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError && Array.prototype[0] === 11 && arrObj[0] === 12; + } finally { + delete Array.prototype[0]; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-193.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-193.js new file mode 100644 index 000000000..2691fc7d5 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-193.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.6-4-193 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is own data property that overrides an + inherited accessor property, test TypeError is thrown when update + the [[Configurable]] attribute to true and value of + [[Configurable]] attribute of original is false (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 arrObj = []; + Object.defineProperty(arrObj, "0", { + value: 12, + configurable: false + }); + + Object.defineProperty(arrObj, "0", { + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError && Array.prototype[0] === 11 && arrObj[0] === 12; + } finally { + delete Array.prototype[0]; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-194.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-194.js new file mode 100644 index 000000000..e5861d80a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-194.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.6-4-194 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is own accessor property, test TypeError is + thrown on updating the configurable attribute from false to true + (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + var getFunc = function () { + return 11; + }; + + Object.defineProperty(arrObj, "0", { + get: getFunc, + configurable: false + }); + + try { + Object.defineProperty(arrObj, "0", { + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError && + accessorPropertyAttributesAreCorrect(arrObj, "0", getFunc, undefined, undefined, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-195.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-195.js new file mode 100644 index 000000000..cd4c93e99 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-195.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.6-4-195 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is an inherited accessor property (15.4.5.1 + step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + try { + Object.defineProperty(Array.prototype, "0", { + get: function () { + return 11; + }, + configurable: true + }); + + var arrObj = []; + + function getFunc() { + return arrObj.helpVerifySet; + } + function setFunc(value) { + arrObj.helpVerifySet = value; + } + + Object.defineProperty(arrObj, "0", { + get: getFunc, + set: setFunc, + configurable: false + }); + + arrObj[0] = 13; + + return accessorPropertyAttributesAreCorrect(arrObj, "0", getFunc, setFunc, "helpVerifySet", false, false); + } finally { + delete Array.prototype[0]; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-196.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-196.js new file mode 100644 index 000000000..cc33a638f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-196.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.6-4-196 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' 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 arrObj = []; + Object.defineProperty(arrObj, "0", { + get: function () { }, + configurable: false + }); + + Object.defineProperty(arrObj, "0", { + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError; + } finally { + delete Array.prototype[0]; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-197.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-197.js new file mode 100644 index 000000000..b1153b1d8 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-197 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' 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 () { }, + configurable: true + }); + + var arrObj = []; + Object.defineProperty(arrObj, "0", { + get: function () { }, + configurable: false + }); + + Object.defineProperty(arrObj, "0", { + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError; + } finally { + delete Array.prototype[0]; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-198.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-198.js new file mode 100644 index 000000000..2574bcf51 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-198.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.6-4-198 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' 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 arrObj = []; + Object.preventExtensions(arrObj); + + try { + var desc = { value: 1 }; + Object.defineProperty(arrObj, "0", desc); + return false; + } catch (e) { + return e instanceof TypeError && (arrObj.hasOwnProperty("0") === false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-199.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-199.js new file mode 100644 index 000000000..76ee9cce3 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-199.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.6-4-199 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' property doesn't exist in 'O', test 'name' + 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 arrObj = []; + + Object.defineProperty(arrObj, "0", { + enumerable: true + }); + + return dataPropertyAttributesAreCorrect(arrObj, "0", undefined, false, true, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-2.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-2.js new file mode 100644 index 000000000..78a3362e2 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-2.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. + +/*--- +info: > + Step 4 of defineProperty calls the [[DefineOwnProperty]] internal method + of O to define the property. For newly defined data properties, attributes + missing from desc should have values set to the defaults from 8.6.1. +es5id: 15.2.3.6-4-2 +description: > + Object.defineProperty sets missing attributes to their default + values (data properties)(8.12.9 step 4.a.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + var desc = { value: 1 }; + Object.defineProperty(o, "foo", desc); + + var propDesc = Object.getOwnPropertyDescriptor(o, "foo"); + + if (propDesc.value === 1 && // this is the value that was set + propDesc.writable === false && // false by default + propDesc.enumerable === false && // false by default + propDesc.configurable === false) { // false by default + return true; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-20.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-20.js new file mode 100644 index 000000000..0e351a1fb --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-20.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. + +/*--- +info: > + Step 4 of defineProperty calls the [[DefineOwnProperty]] internal method + of O to define the property. For non-configurable properties, step 11.a.ii + of [[DefineOwnProperty]] rejects changing the getter if present. +es5id: 15.2.3.6-4-20 +description: > + Object.defineProperty throws TypeError when changing getter (if + present) of non-configurable accessor properties(8.12.9 step + 11.a.ii) +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // create an accessor property; all other attributes default to false. + // dummy getter/setter + var getter = function () { return 1;} + var d1 = { get: getter, configurable: false }; + Object.defineProperty(o, "foo", d1); + + // now, trying to change the setter should fail, since [[Configurable]] + // on the original property will be false. + var desc = { get: undefined }; + + try { + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError) { + var d2 = Object.getOwnPropertyDescriptor(o, "foo"); + + if (d2.get === getter && + d2.configurable === false && + d2.enumerable === false) { + return true; + } + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-200.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-200.js new file mode 100644 index 000000000..56028a480 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-200.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.6-4-200 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' property doesn't exist in 'O', test + [[Value]] of 'name' property of 'Attributes' is set as undefined + if [[Value]] is absent in data descriptor 'desc' (15.4.5.1 step + 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + + Object.defineProperty(arrObj, "0", { + writable: true, + enumerable: true, + configurable: false + }); + + return dataPropertyAttributesAreCorrect(arrObj, "0", undefined, true, true, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-201.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-201.js new file mode 100644 index 000000000..f51aba2e5 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-201 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' property doesn't exist in 'O' and + [[Writable]] is absent in data descriptor 'desc', test + [[Writable]] attribute of property 'name' is set to false + (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + + Object.defineProperty(arrObj, "0", { + value: 1001, + enumerable: true, + configurable: false + }); + return dataPropertyAttributesAreCorrect(arrObj, "0", 1001, false, true, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-202.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-202.js new file mode 100644 index 000000000..0d8195705 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-202.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.6-4-202 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' property doesn't exist in 'O' and + [[Enumerable]] is absent in data descriptor 'desc', test + [[Enumerable]] of property 'name' is set to false (15.4.5.1 step + 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + + Object.defineProperty(arrObj, "0", { + value: 1001, + writable: true, + configurable: true + }); + return dataPropertyAttributesAreCorrect(arrObj, "0", 1001, true, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-203.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-203.js new file mode 100644 index 000000000..e482f04c1 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-203.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.6-4-203 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' property doesn't exist in 'O' and + [[Configurable]] is absent in data descriptor 'desc', test + [[Configurable]] of property 'name' is set to false (15.4.5.1 step + 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + + Object.defineProperty(arrObj, "0", { + value: 1001, + writable: true, + enumerable: true + }); + return dataPropertyAttributesAreCorrect(arrObj, "0", 1001, true, true, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-204.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-204.js new file mode 100644 index 000000000..43732577a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-204.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.6-4-204 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'desc' is data descriptor, test updating all + attribute values of 'name' (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = [1]; // default value of attributes: writable: true, configurable: true, enumerable: true + + Object.defineProperty(arrObj, "0", { + value: 1001, + writable: false, + enumerable: false, + configurable: false + }); + + return dataPropertyAttributesAreCorrect(arrObj, "0", 1001, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-205.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-205.js new file mode 100644 index 000000000..63c540b5f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-205.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.6-4-205 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' property doesn't exist in 'O' and [[Get]] + is absent in accessor descriptor 'desc', test [[Get]] attribute of + property 'name' is set to undefined (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + var setFunc = function (value) { + arrObj.setVerifyHelpProp = value; + }; + + Object.defineProperty(arrObj, "0", { + set: setFunc, + enumerable: true, + configurable: true + }); + + return accessorPropertyAttributesAreCorrect(arrObj, "0", undefined, setFunc, "setVerifyHelpProp", true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-206.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-206.js new file mode 100644 index 000000000..52104a020 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-206 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' property doesn't exist in 'O', test [[Set]] + of 'name' property in 'Attributes' is set as undefined if [[Set]] + is absent in accessor descriptor 'desc' (15.4.5.1 step 4.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arrObj = []; + var getFunc = function () { }; + + Object.defineProperty(arrObj, "0", { + get: getFunc, + enumerable: true, + configurable: true + }); + + var desc = Object.getOwnPropertyDescriptor(arrObj, "0"); + + return arrObj.hasOwnProperty("0") && desc.hasOwnProperty("set") && typeof desc.set === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-207.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-207.js new file mode 100644 index 000000000..6f71b052f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-207.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.6-4-207 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' property doesn't exist in 'O' and + [[Enumerable]] is absent in accessor descriptor 'desc', test + [[Enumerable]] attribute of property 'name' is set to false + (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + + var setFunc = function (value) { + arrObj.setVerifyHelpProp = value; + }; + var getFunc = function () { }; + + Object.defineProperty(arrObj, "0", { + set: setFunc, + get: getFunc, + configurable: true + }); + return accessorPropertyAttributesAreCorrect(arrObj, "0", getFunc, setFunc, "setVerifyHelpProp", false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-208.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-208.js new file mode 100644 index 000000000..cef424e07 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-208.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.6-4-208 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' property doesn't exist in 'O' and + [[Configurable]] is absent in accessor descriptor 'desc', test + [[Configurable]] attribute of property 'name' is set to false + (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + var setFunc = function (value) { + arrObj.setVerifyHelpProp = value; + }; + var getFunc = function () { }; + + Object.defineProperty(arrObj, "0", { + set: setFunc, + get: getFunc, + enumerable: true + }); + return accessorPropertyAttributesAreCorrect(arrObj, "0", getFunc, setFunc, "setVerifyHelpProp", true, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-209.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-209.js new file mode 100644 index 000000000..b031f70d0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-209 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'desc' is accessor descriptor, test updating all + attribute values of 'name' (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + var setFunc = function (value) { + arrObj.setVerifyHelpProp = value; + }; + var getFunc = function () { + return 14; + }; + + Object.defineProperty(arrObj, "0", { + get: function () { + return 11; + }, + set: function () { }, + configurable: true, + enumerable: true + }); + + Object.defineProperty(arrObj, "0", { + get: getFunc, + set: setFunc, + configurable: false, + enumerable: false + }); + + return accessorPropertyAttributesAreCorrect(arrObj, "0", getFunc, setFunc, "setVerifyHelpProp", false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-21.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-21.js new file mode 100644 index 000000000..327329611 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-21.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. + +/*--- +info: > + Step 4 of defineProperty calls the [[DefineOwnProperty]] internal method + of O to define the property. For non-configurable properties, step 11.a.ii + of [[DefineOwnProperty]] permits setting a getter if absent. +es5id: 15.2.3.6-4-21 +description: > + Object.defineProperty permits setting a getter (if absent) of + non-configurable accessor properties(8.12.9 step 11.a.ii) +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // create an accessor property; all other attributes default to false. + // dummy setter + var setter = function (x) {} + var d1 = { set: setter }; + Object.defineProperty(o, "foo", d1); + + // now, trying to set the getter should succeed even though [[Configurable]] + // on the original property will be false. Existing values of need to be preserved. + var getter = undefined; + var desc = { get: getter }; + + Object.defineProperty(o, "foo", desc); + var d2 = Object.getOwnPropertyDescriptor(o, "foo"); + + if (d2.get === getter && + d2.set === setter && + d2.configurable === false && + d2.enumerable === false) { + return true; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-210.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-210.js new file mode 100644 index 000000000..e9cdbe2e0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-210.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.6-4-210 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' 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 arrObj = []; + + arrObj[0] = 101; // default value of attributes: writable: true, configurable: true, enumerable: true + + Object.defineProperty(arrObj, "0", {}); + return dataPropertyAttributesAreCorrect(arrObj, "0", 101, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-211.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-211.js new file mode 100644 index 000000000..892bfff66 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-211.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.6-4-211 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' 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 arrObj = []; + + function getFunc() { + return 11; + } + function setFunc(value) { + arrObj.setVerifyHelpProp = value; + } + + Object.defineProperty(arrObj, "0", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + + Object.defineProperty(arrObj, "0", {}); + return accessorPropertyAttributesAreCorrect(arrObj, "0", getFunc, setFunc, "setVerifyHelpProp", true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-212.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-212.js new file mode 100644 index 000000000..356e4fa1a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-212 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' makes no change if the value of every field + in 'desc' is the same value as the corresponding field in + 'name'(desc is data property) (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + + arrObj[0] = 100; // default value of attributes: writable: true, configurable: true, enumerable: true + + Object.defineProperty(arrObj, "0", { + value: 100, + writable: true, + enumerable: true, + configurable: true + }); + + return dataPropertyAttributesAreCorrect(arrObj, "0", 100, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-213.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-213.js new file mode 100644 index 000000000..10f5117cf --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-213.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.6-4-213 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' makes no change if the value of every field + in 'desc' is the same value as the corresponding field in + 'name'(desc is accessor property) (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + var getFunc = function () { + return "100"; + }; + var setFunc = function (value) { + arrObj.setVerifyHelpProp = value; + }; + + var desc = { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }; + + Object.defineProperty(arrObj, "0", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + + Object.defineProperty(arrObj, "0", desc); + + return accessorPropertyAttributesAreCorrect(arrObj, "0", getFunc, setFunc, "setVerifyHelpProp", true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-214.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-214.js new file mode 100644 index 000000000..3cdb626d5 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-214 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + property and its configurable and writable attributes are set to + false, test TypeError is thrown when the type of the [[Value]] + field of 'desc' is different from the type of the [[Value]] + attribute value of 'name' (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + + Object.defineProperty(arrObj, 0, { + value: 101, + writable: false, + configurable: false + }); + + try { + Object.defineProperty(arrObj, "0", { value: "abc" }); + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arrObj, "0", 101, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-215.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-215.js new file mode 100644 index 000000000..9df867e40 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-215.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.6-4-215 +description: > + Object.defineProperty - '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 arrObj = []; + + Object.defineProperty(arrObj, "0", { value: undefined }); + + Object.defineProperty(arrObj, "0", { value: undefined }); + return dataPropertyAttributesAreCorrect(arrObj, "0", undefined, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-216.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-216.js new file mode 100644 index 000000000..91c911003 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-216.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.6-4-216 +description: > + Object.defineProperty - '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 arrObj = []; + + Object.defineProperty(arrObj, "0", { value: null }); + + Object.defineProperty(arrObj, "0", { value: null }); + return dataPropertyAttributesAreCorrect(arrObj, "0", null, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-217.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-217.js new file mode 100644 index 000000000..b61efc91c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-217.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.6-4-217 +description: > + Object.defineProperty - '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] +---*/ + +function testcase() { + var arrObj = []; + + Object.defineProperty(arrObj, "0", { value: NaN }); + + Object.defineProperty(arrObj, "0", { value: NaN }); + + var hasProperty = arrObj.hasOwnProperty("0"); + var verifyValue = (arrObj[0] !== arrObj[0]); + + var verifyWritable = false; + arrObj[0] = 1001; + verifyWritable = arrObj[0] !== 1001 && arrObj[0] !== arrObj[0]; + + var verifyEnumerable = false; + for (var p in arrObj) { + if (p === "0") { + verifyEnumerable = true; + } + } + + var verifyConfigurable = false; + delete arrObj[0]; + verifyConfigurable = arrObj.hasOwnProperty("0"); + + return hasProperty && verifyValue && verifyWritable && !verifyEnumerable && verifyConfigurable; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-218.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-218.js new file mode 100644 index 000000000..606a6bc92 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-218.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.6-4-218 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + property, test TypeError is thrown when 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 arrObj = []; + + Object.defineProperty(arrObj, "0", { value: -0 }); + + try { + Object.defineProperty(arrObj, "0", { value: +0 }); + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arrObj, "0", -0, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-219.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-219.js new file mode 100644 index 000000000..8f1336f6b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-219.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.6-4-219 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + property, test TypeError is thrown when 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 arrObj = []; + + Object.defineProperty(arrObj, "0", { value: +0 }); + + try { + Object.defineProperty(arrObj, "0", { value: -0 }); + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arrObj, "0", +0, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-22.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-22.js new file mode 100644 index 000000000..5e9f476b5 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-22.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.6-4-22 +description: > + Object.defineProperty - 'name' is existing own data property + (8.12.9 step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, "foo", { + value: 11, + configurable: false + }); + + try { + Object.defineProperty(obj, "foo", { + value: 12, + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError && obj.foo === 11; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-220.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-220.js new file mode 100644 index 000000000..e40c6e41c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-220.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.6-4-220 +description: > + Object.defineProperty - '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 arrObj = []; + + Object.defineProperty(arrObj, "0", { value: 101 }); + + Object.defineProperty(arrObj, "0", { value: 101 }); + return dataPropertyAttributesAreCorrect(arrObj, "0", 101, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-221.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-221.js new file mode 100644 index 000000000..fbc3ae6e3 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-221.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.6-4-221 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + property, test TypeError is thrown when the [[Value]] field of + 'desc' and the [[Value]] attribute value of 'name' are two numbers + with different values (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + + Object.defineProperty(arrObj, 0, { + value: 101, + writable: false, + configurable: false + }); + + try { + Object.defineProperty(arrObj, "0", { value: 123 }); + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arrObj, "0", 101, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-222.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-222.js new file mode 100644 index 000000000..1b0e5ba7e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-222.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.6-4-222 +description: > + Object.defineProperty - '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 arrObj = []; + + Object.defineProperty(arrObj, "0", { value: "abcd" }); + + Object.defineProperty(arrObj, "0", { value: "abcd" }); + return dataPropertyAttributesAreCorrect(arrObj, "0", "abcd", false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-223.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-223.js new file mode 100644 index 000000000..42bd5ac78 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-223.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.6-4-223 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + property, test TypeError is thrown when the [[Value]] field of + 'desc' and the [[Value]] attribute value of 'name' are two strings + with different values (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + + Object.defineProperty(arrObj, 0, { + value: "abcd", + writable: false, + configurable: false + }); + + try { + Object.defineProperty(arrObj, "0", { value: "fghj" }); + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arrObj, "0", "abcd", false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-224.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-224.js new file mode 100644 index 000000000..78d4ef9c6 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-224.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.6-4-224 +description: > + Object.defineProperty - '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 arrObj = []; + + Object.defineProperty(arrObj, "0", { value: true }); + + Object.defineProperty(arrObj, "0", { value: true }); + return dataPropertyAttributesAreCorrect(arrObj, "0", true, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-225.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-225.js new file mode 100644 index 000000000..40d655eca --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-225.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.6-4-225 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + property, test TypeError is thrown when the [[Value]] field of + 'desc' and the [[Value]] attribute value of 'name' are two + booleans with different values (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + + Object.defineProperty(arrObj, 0, { + value: true, + writable: false, + configurable: false + }); + + try { + Object.defineProperty(arrObj, "0", { value: false }); + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arrObj, "0", true, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-226.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-226.js new file mode 100644 index 000000000..78d60fe0e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-226.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.6-4-226 +description: > + Object.defineProperty - '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 arrObj = []; + + var obj1 = { length: 10 }; + + Object.defineProperty(arrObj, "0", { value: obj1 }); + + Object.defineProperty(arrObj, "0", { value: obj1 }); + return dataPropertyAttributesAreCorrect(arrObj, "0", obj1, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-227.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-227.js new file mode 100644 index 000000000..2d68820d7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-227 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + property, test TypeError is thrown when the [[Value]] field of + 'desc' and the [[Value]] attribute value of 'name' are two objects + which refer to two different objects (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + + var obj1 = { length: 10 }; + Object.defineProperty(arrObj, 0, { + value: obj1, + writable: false, + configurable: false + }); + + var obj2 = { length: 20 }; + + try { + Object.defineProperty(arrObj, "0", { value: obj2 }); + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arrObj, "0", obj1, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-228.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-228.js new file mode 100644 index 000000000..e3e8b71df --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-228.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.6-4-228 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + property, the [[Writable]] field of 'desc' and the [[Writable]] + 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 arrObj = []; + + Object.defineProperty(arrObj, "0", { writable: false }); + + Object.defineProperty(arrObj, "0", { writable: false }); + return dataPropertyAttributesAreCorrect(arrObj, "0", undefined, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-229.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-229.js new file mode 100644 index 000000000..8b6c5f7aa --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-229.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.6-4-229 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + property, the [[Writable]] field of 'desc' and the [[Writable]] + attribute value of 'name' are two booleans with different values + (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + + Object.defineProperty(arrObj, "0", { writable: false, configurable: true }); + + Object.defineProperty(arrObj, "0", { writable: true }); + return dataPropertyAttributesAreCorrect(arrObj, "0", undefined, true, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-23.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-23.js new file mode 100644 index 000000000..189d8df87 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-23.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.6-4-23 +description: > + Object.defineProperty - 'name' is existing an inherited data + property (8.12.9 step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + var proto = {}; + Object.defineProperty(proto, "foo", { + value: 11, + configurable: false + }); + + var ConstructFun = function () {}; + ConstructFun.prototype = proto; + var obj = new ConstructFun(); + + Object.defineProperty(obj, "foo", { + configurable: true + }); + return obj.hasOwnProperty("foo") && (typeof obj.foo) === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-230.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-230.js new file mode 100644 index 000000000..d2e7d2b4a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-230.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.6-4-230 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + property, the [[Get]] field of 'desc' and the [[Get]] attribute + value of 'name' are two objects which refer to the same object + (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + arrObj.helpVerifySet = 10; + + function getFunc() { + return arrObj.helpVerifySet; + } + function setFunc(value) { + arrObj.helpVerifySet = value; + } + + Object.defineProperty(arrObj, "0", { + get: getFunc, + set: setFunc + }); + + Object.defineProperty(arrObj, "0", { + get: getFunc + }); + return accessorPropertyAttributesAreCorrect(arrObj, "0", getFunc, setFunc, "helpVerifySet", false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-231.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-231.js new file mode 100644 index 000000000..2e682ba13 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-231.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.6-4-231 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + property, the [[Get]] field of 'desc' and the [[Get]] attribute + value of 'name' are two objects which refer to the different + objects (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + arrObj.helpVerifySet = 10; + + function getFunc1() { + return 20; + } + function getFunc2() { + return arrObj.helpVerifySet; + } + function setFunc(value) { + arrObj.helpVerifySet = value; + } + + Object.defineProperty(arrObj, "0", { + get: getFunc1, + set: setFunc, + configurable: true + }); + + Object.defineProperty(arrObj, "0", { + get: getFunc2 + }); + + return accessorPropertyAttributesAreCorrect(arrObj, "0", getFunc2, setFunc, "helpVerifySet", false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-232.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-232.js new file mode 100644 index 000000000..9c3a9425a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-232.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.6-4-232 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + property, the [[Set]] field of 'desc' and the [[Set]] attribute + value of 'name' are two objects which refer to the same object + (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + + function setFunc(value) { + arrObj.setVerifyHelpProp = value; + } + + Object.defineProperty(arrObj, "0", { set: setFunc }); + + Object.defineProperty(arrObj, "0", { set: setFunc }); + return accessorPropertyAttributesAreCorrect(arrObj, "0", undefined, setFunc, "setVerifyHelpProp", false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-233.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-233.js new file mode 100644 index 000000000..eb670a95f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-233.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.6-4-233 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + property, the [[Set]] field of 'desc' and the [[Set]] attribute + value of 'name' are two objects which refer to the different + objects (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + + function setFunc1() { } + + Object.defineProperty(arrObj, "0", { + set: setFunc1, + configurable: true + }); + + function setFunc2(value) { + arrObj.setVerifyHelpProp = value; + } + + Object.defineProperty(arrObj, "0", { set: setFunc2 }); + return accessorPropertyAttributesAreCorrect(arrObj, "0", undefined, setFunc2, "setVerifyHelpProp", false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-234.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-234.js new file mode 100644 index 000000000..cab45f748 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-234.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.6-4-234 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + property, the [[Enumerable]] field of 'desc' and the + [[Enumerable]] 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 arrObj = []; + + Object.defineProperty(arrObj, "0", { enumerable: false }); + + Object.defineProperty(arrObj, "0", { enumerable: false }); + return dataPropertyAttributesAreCorrect(arrObj, "0", undefined, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-235.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-235.js new file mode 100644 index 000000000..ff75a490f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-235.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.6-4-235 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + property, the [[Enumerable]] field of 'desc' and the + [[Enumerable]] attribute value of 'name' are two booleans with + different values (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + + Object.defineProperty(arrObj, "0", { enumerable: false, configurable: true }); + + Object.defineProperty(arrObj, "0", { enumerable: true }); + return dataPropertyAttributesAreCorrect(arrObj, "0", undefined, false, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-236.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-236.js new file mode 100644 index 000000000..f4af3d3a1 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-236.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.6-4-236 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + property, the [[Configurable]] field of 'desc' and the + [[Configurable]] 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 arrObj = []; + + Object.defineProperty(arrObj, "0", { configurable: false }); + + Object.defineProperty(arrObj, "0", { configurable: false }); + return dataPropertyAttributesAreCorrect(arrObj, "0", undefined, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-237.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-237.js new file mode 100644 index 000000000..1322e386a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-237.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.6-4-237 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + property, the [[Configurable]] field of 'desc' and the + [[Configurable]] attribute value of 'name' are two booleans with + different values (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + + Object.defineProperty(arrObj, "0", { configurable: true }); + + Object.defineProperty(arrObj, "0", { configurable: false }); + return dataPropertyAttributesAreCorrect(arrObj, "0", undefined, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-238.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-238.js new file mode 100644 index 000000000..7fb3c4f0f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-238 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, TypeError is thrown if the [[Configurable]] + attribute value of 'name' 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 arrObj = []; + + Object.defineProperty(arrObj, "1", { + value: 3, + writable: true, + configurable: false + }); + + try { + Object.defineProperty(arrObj, "1", { + value: 13, + writable: true, + configurable: true + }); + return false; + + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arrObj, "1", 3, true, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-239.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-239.js new file mode 100644 index 000000000..5a965d5b3 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-239.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.6-4-239 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, TypeError is thrown if the [[Configurable]] + attribute value of 'name' is false, and [[Enumerable]] of 'desc' + is present and its value is different from the [[Enumerable]] + attribute value of 'name' (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + + Object.defineProperty(arrObj, "1", { + value: 3, + writable: true, + configurable: false, + enumerable: false + }); + + try { + Object.defineProperty(arrObj, "1", { + value: 13, + writable: true, + enumerable: true + }); + return false; + + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arrObj, "1", 3, true, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-24.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-24.js new file mode 100644 index 000000000..778109a0e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-24 +description: > + Object.defineProperty - 'name' 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, "foo", { + value: 12, + configurable: true + }); + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + var obj = new ConstructFun(); + Object.defineProperty(obj, "foo", { + value: 11, + configurable: false + }); + + try { + Object.defineProperty(obj, "foo", { + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError && obj.foo === 11; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-240.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-240.js new file mode 100644 index 000000000..e25653ab1 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-240 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, TypeError is thrown if 'name' is accessor + property, and 'desc' is data descriptor, and the [[Configurable]] + attribute value of 'name' is false (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + + function setFunc(value) { + arrObj.setVerifyHelpProp = value; + } + + Object.defineProperty(arrObj, "1", { + set: setFunc, + configurable: false + }); + + try { + Object.defineProperty(arrObj, "1", { + value: 13 + }); + return false; + + } catch (e) { + return e instanceof TypeError && accessorPropertyAttributesAreCorrect(arrObj, "1", undefined, setFunc, "setVerifyHelpProp", false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-241.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-241.js new file mode 100644 index 000000000..b09ad9e87 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-241.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.6-4-241 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, TypeError is thrown if 'name' is data property, + and'desc' is accessor descriptor, and the [[Configurable]] + attribute value of 'name' is false (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + + Object.defineProperty(arrObj, "1", { + value: 3, + configurable: false + }); + + try { + Object.defineProperty(arrObj, "1", { + set: function () { } + }); + return false; + + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arrObj, "1", 3, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-242-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-242-1.js new file mode 100644 index 000000000..b41c3a75e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-242-1.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.6-4-242-1 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is data property and 'desc' is data + descriptor, and the [[Configurable]] attribute value of 'name' is + true, test 'name' is updated successfully (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = [3]; + + Object.defineProperty(arrObj, "0", { + value: 1001, + writable: false, + enumerable: false + }); + + return dataPropertyAttributesAreCorrect(arrObj, "0", 1001, false, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-242.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-242.js new file mode 100644 index 000000000..1a93be344 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-242.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.6-4-242 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is data property and 'desc' is accessor + descriptor, and the [[Configurable]] attribute value of 'name' is + true, test 'name' is converted from data property to accessor + property (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = [3]; + + function setFunc(value) { + arrObj.setVerifyHelpProp = value; + } + Object.defineProperty(arrObj, "0", { + set: setFunc + }); + + return accessorPropertyAttributesAreCorrect(arrObj, "0", undefined, setFunc, "setVerifyHelpProp", true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-243-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-243-1.js new file mode 100644 index 000000000..ee3e8ff4a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-243-1.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.6-4-243-1 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is accessor property and assignment to + the accessor property, fails to convert accessor property from + accessor property to data property (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + + function getFunc() { + return 3; + } + Object.defineProperty(arrObj, "1", { + get: getFunc, + configurable: true + }); + + arrObj[1] = 4; + + return accessorPropertyAttributesAreCorrect(arrObj, "1", getFunc, undefined, undefined, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-243.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-243.js new file mode 100644 index 000000000..1f2db50eb --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-243.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.6-4-243 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is accessor property and 'desc' is data + descriptor, and the [[Configurable]] attribute value of 'name' is + true, test 'name' is converted from accessor property to data + property (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + + function getFunc() { + return 3; + } + Object.defineProperty(arrObj, "1", { + get: getFunc, + configurable: true + }); + + Object.defineProperty(arrObj, "1", { + value: 12 + }); + + return dataPropertyAttributesAreCorrect(arrObj, "1", 12, false, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-244.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-244.js new file mode 100644 index 000000000..df4ace8a4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-244.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.6-4-244 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is data property and 'desc' is data + descriptor, and the [[Configurable]] attribute value of 'name' is + false, test TypeError is thrown if the [[Writable]] attribute + value of 'name' 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 arrObj = []; + + Object.defineProperty(arrObj, "1", { + writable: false, + configurable: false + }); + + try { + + Object.defineProperty(arrObj, "1", { + writable: true + }); + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arrObj, "1", undefined, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-245.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-245.js new file mode 100644 index 000000000..4db654f76 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-245 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is data property and 'desc' is data + descriptor, and the [[Configurable]] attribute value of 'name' is + false, test TypeError is thrown if the [[Writable]] attribute + value of 'name' is false, and the type of the [[Value]] field of + 'desc' is different from the type of the [[Value]] attribute value + of 'name' (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + + Object.defineProperty(arrObj, "1", { + value: 3, + writable: false, + configurable: false + }); + + try { + + Object.defineProperty(arrObj, "1", { + value: "abc" + }); + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arrObj, "1", 3, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-246.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-246.js new file mode 100644 index 000000000..a822a5e88 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-246.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.6-4-246 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is data property and 'desc' is data + descriptor, and the [[Configurable]] attribute value of 'name' is + false, test TypeError is thrown if the [[Writable]] attribute + value of 'name' is false, and 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 arrObj = []; + + Object.defineProperty(arrObj, "1", { + value: -0 + + }); + + try { + Object.defineProperty(arrObj, "1", { + value: +0 + }); + + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arrObj, "1", -0, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-247.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-247.js new file mode 100644 index 000000000..51e1acb3f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-247.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.6-4-247 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is data property and 'desc' is data + descriptor, and the [[Configurable]] attribute value of 'name' is + false, test TypeError is thrown if the [[Writable]] attribute + value of 'name' is false, and 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 arrObj = []; + + Object.defineProperty(arrObj, "1", { + value: +0 + }); + + try { + + Object.defineProperty(arrObj, "1", { + value: -0 + }); + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arrObj, "1", +0, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-248.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-248.js new file mode 100644 index 000000000..39f410325 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-248.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.6-4-248 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is data property and 'desc' is data + descriptor, and the [[Configurable]] attribute value of 'name' is + false, test TypeError is thrown if the [[Writable]] attribute + value of 'name' is false, and the [[Value]] field of 'desc' and + the [[Value]] attribute value of 'name' are two numbers with + different vaules (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + + Object.defineProperty(arrObj, "1", { + value: 12 + }); + + try { + Object.defineProperty(arrObj, "1", { + value: 15 + }); + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arrObj, "1", 12, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-249.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-249.js new file mode 100644 index 000000000..84aaa2ed0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-249.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.6-4-249 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is data property and 'desc' is data + descriptor, and the [[Configurable]] attribute value of 'name' is + false, test TypeError is thrown if the [[Writable]] attribute + value of 'name' is false, and the [[Value]] field of 'desc' and + the [[Value]] attribute value of 'name' are two strings with + different values (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + + Object.defineProperty(arrObj, "1", { + value: "abc" + }); + + try { + Object.defineProperty(arrObj, "1", { + value: "fgh" + }); + + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arrObj, "1", "abc", false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-25.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-25.js new file mode 100644 index 000000000..bf3baced5 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-25.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.6-4-25 +description: > + Object.defineProperty - 'data' 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, "foo", { + get: function () { }, + configurable: true + }); + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + var obj = new ConstructFun(); + Object.defineProperty(obj, "foo", { + value: 11, + configurable: false + }); + + try { + Object.defineProperty(obj, "foo", { + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError && obj.foo === 11; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-250.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-250.js new file mode 100644 index 000000000..0c9a705ad --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-250.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.6-4-250 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is data property and 'desc' is data + descriptor, and the [[Configurable]] attribute value of 'name' is + false, test TypeError is thrown if the [[Writable]] attribute + value of 'name' is false, and the [[Value]] field of 'desc' and + the [[Value]] attribute value of 'name' are two booleans with + different values (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + + Object.defineProperty(arrObj, "1", { + value: false + }); + + try { + Object.defineProperty(arrObj, "1", { + value: true + }); + + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arrObj, "1", false, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-251.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-251.js new file mode 100644 index 000000000..ce1c459b3 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-251.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.6-4-251 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is data property and 'desc' is data + descriptor, and the [[Configurable]] attribute value of 'name' is + false, test TypeError is thrown if the [[Writable]] attribute + value of 'name' is false, and the [[Value]] field of 'desc' and + the [[Value]] attribute value of 'name' are two objects which + refer to the different objects (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + var obj = { length: 10 }; + + Object.defineProperty(arrObj, "1", { + value: obj + }); + + try { + Object.defineProperty(arrObj, "1", { value: {} }); + + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arrObj, "1", obj, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-252.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-252.js new file mode 100644 index 000000000..a098e29db --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-252.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.6-4-252 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is accessor property and 'desc' is accessor + descriptor, and the [[Configurable]] attribute value of 'name' is + false, test TypeError is thrown if the [[Set]] field of 'desc' is + present, and the [[Set]] field of 'desc' and the [[Set]] attribute + value of 'name' are two objects which refer to the different + objects (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + + function setFunc(value) { + arrObj.setVerifyHelpProp = value; + } + Object.defineProperty(arrObj, "1", { + set: setFunc + }); + + try { + Object.defineProperty(arrObj, "1", { + set: function () { } + }); + + return false; + } catch (e) { + return e instanceof TypeError && accessorPropertyAttributesAreCorrect(arrObj, "1", undefined, setFunc, "setVerifyHelpProp", false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-253.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-253.js new file mode 100644 index 000000000..6abe4e9bc --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-253.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.6-4-253 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is accessor property and 'desc' is accessor + descriptor, and the [[Configurable]] attribute value of 'name' is + false, test TypeError is thrown if the [[Set]] field of 'desc' is + present, and the [[Set]] field of 'desc' is an object and the + [[Set]] attribute value of 'name' is undefined (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + function getFunc() { + return 12; + } + + Object.defineProperty(arrObj, "1", { + get: getFunc, + set: undefined + }); + + try { + Object.defineProperty(arrObj, "1", { + set: function () { } + }); + return false; + } catch (e) { + return e instanceof TypeError && accessorPropertyAttributesAreCorrect(arrObj, "1", getFunc, undefined, undefined, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-254.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-254.js new file mode 100644 index 000000000..ea8a6097e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-254.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.6-4-254 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is accessor property and 'desc' is accessor + descriptor, and the [[Configurable]] attribute value of 'name' is + false, test TypeError is not thrown if the [[Set]] field of 'desc' + is present, and the [[Set]] field of 'desc' and the [[Set]] + attribute value of 'name' are undefined (15.4.5.1 step 4.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arrObj = []; + + Object.defineProperty(arrObj, "1", { + set: undefined + }); + var hasProperty = arrObj.hasOwnProperty("1"); + + Object.defineProperty(arrObj, "1", { + set: undefined + }); + + var desc = Object.getOwnPropertyDescriptor(arrObj, "1"); + + var verifyGet = desc.hasOwnProperty("get") && typeof desc.get === "undefined"; + + var verifySet = desc.hasOwnProperty("set") && typeof desc.set === "undefined"; + + var verifyEnumerable = false; + for (var p in arrObj) { + if (p === "1") { + verifyEnumerable = true + } + } + + var verifyConfigurable = false; + delete arrObj[1]; + verifyConfigurable = arrObj.hasOwnProperty("1"); + + return hasProperty && verifyGet && verifySet && !verifyEnumerable && verifyConfigurable; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-255.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-255.js new file mode 100644 index 000000000..590d8aeb9 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-255.js @@ -0,0 +1,61 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.6-4-255 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is accessor property and 'desc' is accessor + descriptor, and the [[Configurable]] attribute value of 'name' is + false, test TypeError is thrown if the [[Get]] field of 'desc' is + present, and the [[Get]] field of 'desc' and the [[Get]] attribute + value of 'name' are two objects which refer to the different + objects (15.4.5.1 step 4.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arrObj = []; + + function getFunc() { + return 12; + } + Object.defineProperty(arrObj, "1", { + get: getFunc + }); + + try { + Object.defineProperty(arrObj, "1", { + get: function () { + return 14; + } + }); + + return false; + } catch (e) { + var hasProperty = arrObj.hasOwnProperty("1"); + var desc = Object.getOwnPropertyDescriptor(arrObj, "1"); + + var verifyGet = arrObj[1] === getFunc(); + + var verifySet = desc.hasOwnProperty("set") && typeof desc.set === "undefined"; + + var verifyEnumerable = false; + for (var p in arrObj) { + if (p === "1") { + verifyEnumerable = true + } + } + + var verifyConfigurable = false; + delete arrObj[1]; + verifyConfigurable = arrObj.hasOwnProperty("1"); + + return e instanceof TypeError && hasProperty && verifyGet && + verifySet && !verifyEnumerable && verifyConfigurable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-256.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-256.js new file mode 100644 index 000000000..e0d480001 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-256.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.6-4-256 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is accessor property and 'desc' is accessor + descriptor, and the [[Configurable]] attribute value of 'name' is + false, test TypeError is thrown if the [[Get]] field of 'desc' is + present, and the [[Get]] field of 'desc' is an object and the + [[Get]] attribute value of 'name' is undefined (15.4.5.1 step 4.c) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arrObj = []; + function getFunc() { + return 12; + } + + Object.defineProperty(arrObj, "1", { + get: getFunc + }); + + try { + Object.defineProperty(arrObj, "1", { + get: undefined + }); + return false; + } catch (e) { + var hasProperty = arrObj.hasOwnProperty("1"); + var desc = Object.getOwnPropertyDescriptor(arrObj, "1"); + + var verifyGet = arrObj[1] === getFunc(); + + var verifySet = desc.hasOwnProperty("set") && typeof desc.set === "undefined"; + + var verifyEnumerable = false; + for (var p in arrObj) { + if (p === "1") { + verifyEnumerable = true + } + } + + var verifyConfigurable = false; + delete arrObj[1]; + verifyConfigurable = arrObj.hasOwnProperty("1"); + + return e instanceof TypeError && hasProperty && verifyGet && + verifySet && !verifyEnumerable && verifyConfigurable; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-257.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-257.js new file mode 100644 index 000000000..9da91a48e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-257 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, 'name' is accessor property and 'desc' is accessor + descriptor, and the [[Configurable]] attribute value of 'name' is + false, 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 'name' are undefined (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + function setFunc(value) { + arrObj.setVerifyHelpProp = value; + } + + Object.defineProperty(arrObj, "1", { + get: undefined, + set: setFunc, + configurable: false + }); + + try { + Object.defineProperty(arrObj, "1", { + get: undefined + }); + + return accessorPropertyAttributesAreCorrect(arrObj, "1", undefined, setFunc, "setVerifyHelpProp", false, false); + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-258.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-258.js new file mode 100644 index 000000000..d7b90d21f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-258.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.6-4-258 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, name is data property and 'desc' is data + descriptor, test updating the [[Value]] attribute value of 'name' + (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = [100]; + + Object.defineProperty(arrObj, "0", { + value: 200 + }); + return dataPropertyAttributesAreCorrect(arrObj, "0", 200, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-259.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-259.js new file mode 100644 index 000000000..9db099508 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-259.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.6-4-259 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, name is data property and 'desc' is data + descriptor, test setting the [[Value]] attribute value of 'name' + as undefined (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = [100]; + + Object.defineProperty(arrObj, "0", { + value: undefined + }); + return dataPropertyAttributesAreCorrect(arrObj, "0", undefined, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-26.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-26.js new file mode 100644 index 000000000..69c34cbec --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-26.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.6-4-26 +description: > + Object.defineProperty - 'name' is own accessor property (8.12.9 + step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { + get: function () { + return 11; + }, + configurable: false + }); + + try { + Object.defineProperty(obj, "property", { + get: function () { + return 12; + }, + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError && obj.property === 11; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-260.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-260.js new file mode 100644 index 000000000..7feaa01ce --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-260.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.6-4-260 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, name is data property and 'desc' is data + descriptor, test setting the [[Value]] attribute value of 'name' + from undefined to number (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = [undefined]; + Object.defineProperty(arrObj, "0", { + value: 100 + }); + return dataPropertyAttributesAreCorrect(arrObj, "0", 100, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-261.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-261.js new file mode 100644 index 000000000..6fad4c8b2 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-261.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.6-4-261 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, name is data property and 'desc' is data + descriptor, test updating the [[Writable]] attribute value of + 'name' (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = [100]; + Object.defineProperty(arrObj, "0", { + writable: false + }); + return dataPropertyAttributesAreCorrect(arrObj, "0", 100, false, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-262.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-262.js new file mode 100644 index 000000000..5eef4c6b0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-262.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.6-4-262 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, name is data property and 'desc' is data + descriptor, test updating the [[Enumerable]] attribute value of + 'name' (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = [100]; + + Object.defineProperty(arrObj, "0", { + enumerable: false + }); + return dataPropertyAttributesAreCorrect(arrObj, "0", 100, true, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-263.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-263.js new file mode 100644 index 000000000..fd5644efe --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-263.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.6-4-263 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, name is data property and 'desc' is data + descriptor, test updating the [[Configurable]] attribute value of + 'name' (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = [100]; + + Object.defineProperty(arrObj, "0", { + configurable: false + }); + return dataPropertyAttributesAreCorrect(arrObj, "0", 100, true, true, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-264.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-264.js new file mode 100644 index 000000000..fab104a50 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-264.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.6-4-264 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, name is data property and 'desc' is data + descriptor, test updating multiple attribute values of 'name' + (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = [100]; + Object.defineProperty(arrObj, "0", { + writable: false, + enumerable: false, + configurable: false + }); + return dataPropertyAttributesAreCorrect(arrObj, "0", 100, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-265.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-265.js new file mode 100644 index 000000000..bcdcef965 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-265.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.6-4-265 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, name is accessor property and 'desc' is accessor + descriptor, test updating the [[Get]] attribute value of 'name' + (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + + function getFunc() { + return 100; + } + Object.defineProperty(arrObj, "0", { + get: function () { + return 12; + }, + configurable: true + }); + Object.defineProperty(arrObj, "0", { + get: getFunc + }); + return accessorPropertyAttributesAreCorrect(arrObj, "0", getFunc, undefined, undefined, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-266.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-266.js new file mode 100644 index 000000000..4102d77f3 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-266.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.6-4-266 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, name is accessor property and 'desc' is accessor + descriptor, test setting the [[Get]] attribute value of 'name' as + undefined (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + function getFunc() { + return 12; + } + + Object.defineProperty(arrObj, "0", { + get: getFunc, + configurable: true + }); + + Object.defineProperty(arrObj, "0", { + get: undefined + }); + return accessorPropertyAttributesAreCorrect(arrObj, "0", undefined, undefined, undefined, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-267.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-267.js new file mode 100644 index 000000000..2c8a50323 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-267.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.6-4-267 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, name is accessor property and 'desc' is accessor + descriptor, test updating the [[Get]] attribute value of 'name' + from undefined to function object (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + + function getFunc() { + return 12; + } + Object.defineProperty(arrObj, "0", { + get: undefined, + configurable: true + }); + + Object.defineProperty(arrObj, "0", { + get: getFunc + }); + return accessorPropertyAttributesAreCorrect(arrObj, "0", getFunc, undefined, undefined, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-268.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-268.js new file mode 100644 index 000000000..251838b55 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-268.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.6-4-268 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, name is accessor property and 'desc' is accessor + descriptor, test updating the [[Set]] attribute value of 'name' + (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + + function setFunc(value) { + arrObj.setVerifyHelpProp = value; + } + Object.defineProperty(arrObj, "0", { + set: function () { }, + configurable: true + }); + + Object.defineProperty(arrObj, "0", { + set: setFunc + }); + return accessorPropertyAttributesAreCorrect(arrObj, "0", undefined, setFunc, "setVerifyHelpProp", false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-269.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-269.js new file mode 100644 index 000000000..988ddeb48 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-269.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.6-4-269 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, name is accessor property and 'desc' is accessor + descriptor, test setting the [[Set]] attribute value of 'name' as + undefined (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + + Object.defineProperty(arrObj, "0", { + set: function () { }, + configurable: true + }); + + Object.defineProperty(arrObj, "0", { + set: undefined + }); + return accessorPropertyAttributesAreCorrect(arrObj, "0", undefined, undefined, undefined, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-27.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-27.js new file mode 100644 index 000000000..6628efd59 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-27.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.6-4-27 +description: > + Object.defineProperty - 'name' is an inherited accessor property + (8.12.9 step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + var proto = {}; + Object.defineProperty(proto, "property", { + get: function () { + return 11; + }, + configurable: false + }); + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + var obj = new ConstructFun(); + + Object.defineProperty(obj, "property", { + get: function () { + return 12; + }, + configurable: true + }); + return obj.hasOwnProperty("property") && obj.property === 12; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-270.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-270.js new file mode 100644 index 000000000..7d1d3a42b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-270.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.6-4-270 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, name is accessor property and 'desc' is accessor + descriptor, test updating the [[Set]] attribute value of 'name' + from undefined to function object (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + + function setFunc(value) { + arrObj.setVerifyHelpProp = value; + } + + Object.defineProperty(arrObj, "0", { + set: undefined, + configurable: true + }); + + Object.defineProperty(arrObj, "0", { + set: setFunc + }); + return accessorPropertyAttributesAreCorrect(arrObj, "0", undefined, setFunc, "setVerifyHelpProp", false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-271.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-271.js new file mode 100644 index 000000000..82fab3164 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-271 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, name is accessor property and 'desc' is accessor + descriptor, test updating the [[Enumerable]] attribute value of + 'name' (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + + function setFunc(value) { + arrObj.setVerifyHelpProp = value; + } + + Object.defineProperty(arrObj, "0", { + set: setFunc, + enumerable: true, + configurable: true + }); + + Object.defineProperty(arrObj, "0", { + enumerable: false + }); + return accessorPropertyAttributesAreCorrect(arrObj, "0", undefined, setFunc, "setVerifyHelpProp", false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-272.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-272.js new file mode 100644 index 000000000..e0a35ebd0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-272.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.6-4-272 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, name is accessor property and 'desc' is accessor + descriptor, test updating the [[Configurable]] attribute value of + 'name' (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + function setFunc(value) { + arrObj.setVerifyHelpProp = value; + } + + Object.defineProperty(arrObj, "0", { + set: setFunc, + configurable: true + }); + + Object.defineProperty(arrObj, "0", { + configurable: false + }); + return accessorPropertyAttributesAreCorrect(arrObj, "0", undefined, setFunc, "setVerifyHelpProp", false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-273.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-273.js new file mode 100644 index 000000000..b79561e2c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-273.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.6-4-273 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, name is accessor property and 'desc' is accessor + descriptor, test updating multiple attribute values of 'name' + (15.4.5.1 step 4.c) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + + function setFunc(value) { + arrObj.setVerifyHelpProp = value; + } + function getFunc() { + return 12; + } + Object.defineProperty(arrObj, "1", { + get: function () { + return 6; + }, + set: setFunc, + enumerable: true, + configurable: true + }); + + Object.defineProperty(arrObj, "1", { + get: getFunc, + enumerable: false, + configurable: false + }); + return accessorPropertyAttributesAreCorrect(arrObj, "1", getFunc, setFunc, "setVerifyHelpProp", false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-274.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-274.js new file mode 100644 index 000000000..7399114f9 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-274.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.6-4-274 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, test the length property of 'O' is not changed if + ToUint32('name') is less than value of the length property in 'O' + (15.4.5.1 step 4.e) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = []; + arrObj.length = 3; // default value of length: writable: true, configurable: false, enumerable: false + + Object.defineProperty(arrObj, "1", { + value: 14 + }); + + return arrObj.length === 3 && arrObj[1] === 14; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-275.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-275.js new file mode 100644 index 000000000..31106b782 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-275.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.6-4-275 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, test the length property of 'O' is set as + ToUint32('name') + 1 if ToUint32('name') equals to value of the + length property in 'O' (15.4.5.1 step 4.e.ii) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = []; + arrObj.length = 3; // default value of length: writable: true, configurable: false, enumerable: false + + Object.defineProperty(arrObj, "3", { + value: 3 + }); + + return arrObj.length === 4 && arrObj[3] === 3; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-276.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-276.js new file mode 100644 index 000000000..319d7244e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-276.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.6-4-276 +description: > + Object.defineProperty - 'O' is an Array, 'name' is an array index + named property, test the length property of 'O' is set as + ToUint32('name') + 1 if ToUint32('name') is greater than value of + the length property in 'O' (15.4.5.1 step 4.e.ii) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var arrObj = []; + + Object.defineProperty(arrObj, "5", { + value: 3 + }); + + return arrObj.length === 6 && arrObj[5] === 3; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-277.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-277.js new file mode 100644 index 000000000..cde4ef379 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-277.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.6-4-277 +description: > + Object.defineProperty - 'O' is an Array, 'name' is generic + property that won't exist on 'O', and 'desc' is data descriptor, + test 'name' is defined in 'O' with all correct attribute values + (15.4.5.1 step 5) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + + Object.defineProperty(arrObj, "property", { + value: 12, + writable: true, + enumerable: true, + configurable: true + }); + + return dataPropertyAttributesAreCorrect(arrObj, "property", 12, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-278.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-278.js new file mode 100644 index 000000000..832fbcb05 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-278.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.6-4-278 +description: > + Object.defineProperty - 'name' is generic property that won't + exist on 'O', and 'desc' is accessor descriptor, test 'name' is + defined in 'O' with all correct attribute values (15.4.5.1 step 5) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + + function getFunc() { + return 12; + } + function setFunc(value) { + arrObj.setVerifyHelpProp = value; + } + + Object.defineProperty(arrObj, "property", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + + return accessorPropertyAttributesAreCorrect(arrObj, "property", getFunc, setFunc, "setVerifyHelpProp", true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-279.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-279.js new file mode 100644 index 000000000..dc0f32a82 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-279.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.6-4-279 +description: > + Object.defineProperty - 'O' is an Array, 'name' is generic own + accessor property of 'O', and 'desc' is accessor descriptor, test + updating multiple attribute values of 'name' (15.4.5.1 step 5) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + + function getFunc() { + return 12; + } + function setFunc(value) { + arrObj.setVerifyHelpProp = value; + } + Object.defineProperty(arrObj, "property", { + get: function () { + return 24; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(arrObj, "property", { + get: getFunc, + set: setFunc, + enumerable: false, + configurable: false + }); + + return accessorPropertyAttributesAreCorrect(arrObj, "property", getFunc, setFunc, "setVerifyHelpProp", false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-28.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-28.js new file mode 100644 index 000000000..aa439eda4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-28.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.6-4-28 +description: > + Object.defineProperty - 'name' 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, "foo", { + value: 11, + configurable: true + }); + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + var obj = new ConstructFun(); + Object.defineProperty(obj, "foo", { + get: function () { }, + configurable: false + }); + + try { + Object.defineProperty(obj, "foo", { + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-280.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-280.js new file mode 100644 index 000000000..b27fcf84a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-280.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.6-4-280 +description: > + Object.defineProperty - 'O' is an Array, 'name' is generic own + data property of 'O', and 'desc' is data descriptor, test updating + multiple attribute values of 'name' (15.4.5.1 step 5) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + + arrObj.property = 12; // default value of attributes: writable: true, configurable: true, enumerable: true + + Object.defineProperty(arrObj, "property", { + writable: false, + enumerable: false, + configurable: false + }); + + return dataPropertyAttributesAreCorrect(arrObj, "property", 12, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-281.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-281.js new file mode 100644 index 000000000..665ee2b40 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-281.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.6-4-281 +description: > + Object.defineProperty - 'O' is an Array, 'name' is generic own + data property of 'O', test TypeError is thrown when updating the + [[Value]] attribute value of 'name' which is defined as + non-writable and non-configurable (15.4.5.1 step 5) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + + Object.defineProperty(arrObj, "property", { + value: 12 + }); + try { + Object.defineProperty(arrObj, "property", { + value: 36 + }); + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arrObj, "property", 12, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-282.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-282.js new file mode 100644 index 000000000..1e965821a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-282.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.6-4-282 +description: > + Object.defineProperty - 'O' is an Array, 'name' is generic own + data property of 'O', test TypeError is thrown when updating the + [[Writable]] attribute value of 'name' which is defined as + non-configurable (15.4.5.1 step 5) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + + Object.defineProperty(arrObj, "property", { + writable: false + }); + try { + Object.defineProperty(arrObj, "property", { + writable: true + }); + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arrObj, "property", undefined, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-283.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-283.js new file mode 100644 index 000000000..bc6ae0069 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-283.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.6-4-283 +description: > + Object.defineProperty - 'O' is an Array, 'name' is generic own + data property of 'O', test TypeError is thrown when updating the + [[Enumerable]] attribute value of 'name' which is defined as + non-configurable (15.4.5.1 step 5) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var arrObj = []; + + Object.defineProperty(arrObj, "property", { + value: 12, + enumerable: false + }); + try { + Object.defineProperty(arrObj, "property", { + enumerable: true + }); + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arrObj, "property", 12, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-284.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-284.js new file mode 100644 index 000000000..a59e05361 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-284.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.6-4-284 +description: > + Object.defineProperty - 'O' is an Array, 'name' is generic own + data property of 'O', test TypeError is thrown when updating the + [[Configurable]] attribute value of 'name' which is defined as + non-configurable (15.4.5.1 step 5) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + + Object.defineProperty(arrObj, "property", { + value: 12 + }); + try { + Object.defineProperty(arrObj, "property", { + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arrObj, "property", 12, false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-285.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-285.js new file mode 100644 index 000000000..35bb914e3 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-285.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.6-4-285 +description: > + Object.defineProperty - 'O' is an Array, 'name' is generic own + accessor property of 'O', test TypeError is thrown when updating + the [[Get]] attribute value of 'name' which is defined as + non-configurable (15.4.5.1 step 5) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + + function getFunc() { + return 12; + } + function setFunc(value) { + arrObj.setVerifyHelpProp = value; + } + Object.defineProperty(arrObj, "property", { + get: getFunc, + set: setFunc + }); + try { + Object.defineProperty(arrObj, "property", { + get: function () { + return 36; + } + }); + return false; + } catch (e) { + return e instanceof TypeError && accessorPropertyAttributesAreCorrect(arrObj, "property", getFunc, setFunc, "setVerifyHelpProp", false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-286.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-286.js new file mode 100644 index 000000000..05930b970 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-286.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.6-4-286 +description: > + Object.defineProperty - 'O' is an Array, 'name' is generic own + accessor property of 'O', and 'desc' is accessor descriptor, test + TypeError is thrown when updating the [[Set]] attribute value of + 'name' (15.4.5.1 step 5) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + + function setFunc(value) { + arrObj.setVerifyHelpProp = value; + } + Object.defineProperty(arrObj, "property", { + set: setFunc + }); + try { + Object.defineProperty(arrObj, "property", { + set: function () {} + }); + return false; + } catch (e) { + return e instanceof TypeError && accessorPropertyAttributesAreCorrect(arrObj, "property", undefined, setFunc, "setVerifyHelpProp", false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-287.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-287.js new file mode 100644 index 000000000..a2e2cb8a7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-287.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.6-4-287 +description: > + Object.defineProperty - 'O' is an Array, 'name' is generic own + accessor property of 'O', test TypeError is thrown when updating + the [[Enumerable]] attribute value of 'name' which is defined as + non-configurable (15.4.5.1 step 5) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + + function setFunc(value) { + arrObj.setVerifyHelpProp = value; + } + Object.defineProperty(arrObj, "property", { + set: setFunc, + enumerable: false + }); + try { + Object.defineProperty(arrObj, "property", { + enumerable: true + }); + return false; + } catch (e) { + return e instanceof TypeError && accessorPropertyAttributesAreCorrect(arrObj, "property", undefined, setFunc, "setVerifyHelpProp", false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-288.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-288.js new file mode 100644 index 000000000..77a5fc240 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-288.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.6-4-288 +description: > + Object.defineProperty - 'O' is an Array, 'name' is generic own + accessor property of 'O', test TypeError is thrown when updating + the [[Configurable]] attribute value of 'name' which is defined as + non-configurable (15.4.5.1 step 5) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var arrObj = []; + + function setFunc(value) { + arrObj.setVerifyHelpProp = value; + } + Object.defineProperty(arrObj, "property", { + set: setFunc, + configurable: false + }); + try { + Object.defineProperty(arrObj, "property", { + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError && accessorPropertyAttributesAreCorrect(arrObj, "property", undefined, setFunc, "setVerifyHelpProp", false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-289-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-289-1.js new file mode 100644 index 000000000..07b2729e3 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-289-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.6-4-289-1 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'name' is own property which is + defined in both [[ParameterMap]] of 'O' and 'O', and is deleted + afterwards, and 'desc' is data descriptor, test 'name' is + redefined in 'O' with all correct attribute values (10.6 + [[DefineOwnProperty]] step 3) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function (a, b, c) { + delete arguments[0]; + Object.defineProperty(arguments, "0", { + value: 10, + writable: true, + enumerable: true, + configurable: true + }); + var verifyFormal = a === 0; + return dataPropertyAttributesAreCorrect(arguments, "0", 10, true, true, true) && verifyFormal; + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-289.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-289.js new file mode 100644 index 000000000..997f3ef56 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-289.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.6-4-289 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is own + property of 'O', and is deleted afterwards, and 'desc' is data + descriptor, test 'name' is redefined in 'O' with all correct + attribute values (10.6 [[DefineOwnProperty]] step 3) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + delete arguments[0]; + Object.defineProperty(arguments, "0", { + value: 10, + writable: true, + enumerable: true, + configurable: true + }); + return dataPropertyAttributesAreCorrect(arguments, "0", 10, true, true, true); + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-29.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-29.js new file mode 100644 index 000000000..ce4fdb0e1 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-29.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.6-4-29 +description: > + Object.defineProperty - 'name' 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, "foo", { + get: function () { }, + configurable: true + }); + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + var obj = new ConstructFun(); + Object.defineProperty(obj, "foo", { + get: function () { }, + configurable: false + }); + + try { + Object.defineProperty(obj, "foo", { + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-290-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-290-1.js new file mode 100644 index 000000000..e76e4ae23 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-290-1.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.6-4-290-1 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'name' is own property which is + defined in both [[ParameterMap]] of 'O' and 'O', is deleted + afterwards, and 'desc' is accessor descriptor, test 'name' is + redefined in 'O' with all correct attribute values (10.6 + [[DefineOwnProperty]] step 3) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function (a, b, c) { + delete arguments[0]; + function getFunc() { + return 10; + } + function setFunc(value) { + this.setVerifyHelpProp = value; + } + Object.defineProperty(arguments, "0", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + var verifyFormal = a === 0; + return accessorPropertyAttributesAreCorrect(arguments, "0", getFunc, setFunc, "setVerifyHelpProp", true, true) && verifyFormal; + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-290.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-290.js new file mode 100644 index 000000000..0736bdf06 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-290.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.6-4-290 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is own + property of 'O', and is deleted afterwards, and 'desc' is accessor + descriptor, test 'name' is redefined in 'O' with all correct + attribute values (10.6 [[DefineOwnProperty]] step 3) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + delete arguments[0]; + function getFunc() { + return 10; + } + function setFunc(value) { + this.setVerifyHelpProp = value; + } + Object.defineProperty(arguments, "0", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + return accessorPropertyAttributesAreCorrect(arguments, "0", getFunc, setFunc, "setVerifyHelpProp", true, true); + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-291-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-291-1.js new file mode 100644 index 000000000..cc4ca1012 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-291-1.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.6-4-291-1 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'name' 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 + 'name' (10.6 [[DefineOwnProperty]] step 3 and 5.a.i) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function (a, b, c) { + function getFunc1() { + return 10; + } + Object.defineProperty(arguments, "0", { + get: getFunc1, + enumerable: true, + configurable: true + }); + function getFunc2() { + return 20; + } + Object.defineProperty(arguments, "0", { + get: getFunc2, + enumerable: false, + configurable: false + }); + var verifyFormal = a === 0; + return accessorPropertyAttributesAreCorrect(arguments, "0", getFunc2, undefined, undefined, false, false) && verifyFormal; + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-291.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-291.js new file mode 100644 index 000000000..d15626609 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-291.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.6-4-291 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is own + accessor property of 'O', and 'desc' is accessor descriptor, test + updating multiple attribute values of 'name' (10.6 + [[DefineOwnProperty]] step 3) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + function getFunc1() { + return 10; + } + Object.defineProperty(arguments, "0", { + get: getFunc1, + enumerable: true, + configurable: true + }); + function getFunc2() { + return 20; + } + Object.defineProperty(arguments, "0", { + get: getFunc2, + enumerable: false, + configurable: false + }); + return accessorPropertyAttributesAreCorrect(arguments, "0", getFunc2, undefined, undefined, false, false); + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-292-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-292-1.js new file mode 100644 index 000000000..392578ffd --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-292-1.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.6-4-292-1 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'name' is own property of 'O' which is + also defined in [[ParameterMap]] of 'O', and 'desc' is data + descriptor, test updating multiple attribute values of 'name' + (10.6 [[DefineOwnProperty]] step 3 and 5.b) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function (a, b, c) { + Object.defineProperty(arguments, "0", { + value: 20, + writable: false, + enumerable: false, + configurable: false + }); + var verifyFormal = a === 20; + return dataPropertyAttributesAreCorrect(arguments, "0", 20, false, false, false) && verifyFormal; + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-292.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-292.js new file mode 100644 index 000000000..64d9d5de9 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-292.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.6-4-292 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is own + data property of 'O', and 'desc' is data descriptor, test updating + multiple attribute values of 'name' (10.6 [[DefineOwnProperty]] + step 3) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + Object.defineProperty(arguments, "0", { + value: 20, + writable: false, + enumerable: false, + configurable: false + }); + return dataPropertyAttributesAreCorrect(arguments, "0", 20, false, false, false); + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-293-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-293-1.js new file mode 100644 index 000000000..d7d07da1d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-293-1.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.6-4-293-1 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is own + data property of 'O', test TypeError is not thrown when updating + the [[Value]] attribute value of 'name' which is defined as + non-writable and configurable (10.6 [[DefineOwnProperty]] step 3 + and 5b) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + Object.defineProperty(arguments, "0", { + value: 10, + writable: false + }); + Object.defineProperty(arguments, "0", { + value: 20 + }); + return dataPropertyAttributesAreCorrect(arguments, "0", 20, false, true, true); + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-293-2.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-293-2.js new file mode 100644 index 000000000..d4659057b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-293-2.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.6-4-293-2 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'name' 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 'name' + which is defined as unwritable and non-configurable (10.6 + [[DefineOwnProperty]] step 4 and step 5b) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function (a, b, c) { + Object.defineProperty(arguments, "0", { + value: 10, + writable: false, + enumerable: false, + configurable: false + }); + try { + Object.defineProperty(arguments, "0", { + value: 20 + }); + } catch (e) { + var verifyFormal = a === 10; + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arguments, "0", 10, false, false, false) && verifyFormal; + } + return false; + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-293-3.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-293-3.js new file mode 100644 index 000000000..91068d57c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-293-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.6-4-293-3 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'name' is own data property of 'O' + which is also defined in [[ParameterMap]] of 'O', test TypeError + is not thrown when updating the [[Value]] attribute value of + 'name' which is defined as non-writable and configurable (10.6 + [[DefineOwnProperty]] step 3 and step 5.b) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function (a, b, c) { + Object.defineProperty(arguments, "0", { + value: 10, + writable: false, + }); + Object.defineProperty(arguments, "0", { + value: 20 + }); + var verifyFormal = a === 10; + return dataPropertyAttributesAreCorrect(arguments, "0", 20, false, true, true) && verifyFormal; + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-293.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-293.js new file mode 100644 index 000000000..a24456bad --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-293.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.6-4-293 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is own + data property of 'O', test TypeError is thrown when updating the + [[Value]] attribute value of 'name' which is defined as + non-writable and non-configurable (10.6 [[DefineOwnProperty]] step + 3) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + Object.defineProperty(arguments, "0", { + value: 10, + writable: false, + enumerable: false, + configurable: false + }); + try { + Object.defineProperty(arguments, "0", { + value: 20 + }); + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arguments, "0", 10, false, false, false); + } + return false; + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-294-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-294-1.js new file mode 100644 index 000000000..100ec52e1 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-294-1.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.6-4-294-1 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'name' 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 'name' + which is defined as non-configurable (10.6 [[DefineOwnProperty]] + step 4 and 5b) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function (a, b, c) { + Object.defineProperty(arguments, "0", { + value: 10, + writable: false, + enumerable: false, + configurable: false + }); + try { + Object.defineProperty(arguments, "0", { + writable: true + }); + } catch (e) { + var verifyFormal = a === 10; + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arguments, "0", 10, false, false, false) && verifyFormal; + } + return false; + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-294.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-294.js new file mode 100644 index 000000000..5b82a901a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-294.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.6-4-294 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is own + data property of 'O', test TypeError is thrown when updating the + [[Writable]] attribute value of 'name' which is defined as + non-configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + Object.defineProperty(arguments, "0", { + value: 10, + writable: false, + enumerable: false, + configurable: false + }); + try { + Object.defineProperty(arguments, "0", { + writable: true + }); + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arguments, "0", 10, false, false, false); + } + return false; + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-295-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-295-1.js new file mode 100644 index 000000000..c485e86c6 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-295-1.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.6-4-295-1 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'name' 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 + 'name' which is defined as non-configurable (10.6 + [[DefineOwnProperty]] step 4 and step 5b) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function (a, b, c) { + Object.defineProperty(arguments, "0", { + value: 10, + writable: false, + enumerable: true, + configurable: false + }); + try { + Object.defineProperty(arguments, "0", { + enumerable: false + }); + } catch (e) { + var verifyFormal = a === 10; + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arguments, "0", 10, false, true, false) && verifyFormal; + } + return false; + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-295.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-295.js new file mode 100644 index 000000000..4965a2aa7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-295.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.6-4-295 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is own + data property of 'O', test TypeError is thrown when updating the + [[Enumerable]] attribute value of 'name' which is defined as + non-configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + Object.defineProperty(arguments, "0", { + value: 10, + writable: false, + enumerable: true, + configurable: false + }); + try { + Object.defineProperty(arguments, "0", { + enumerable: false + }); + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arguments, "0", 10, false, true, false); + } + return false; + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-296-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-296-1.js new file mode 100644 index 000000000..570a234da --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-296-1.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.6-4-296-1 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'name' 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 + 'name' which is defined as non-configurable (10.6 + [[DefineOwnProperty]] step 4 and step 5b) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function (a, b, c) { + Object.defineProperty(arguments, "0", { + value: 10, + writable: false, + enumerable: false, + configurable: false + }); + try { + Object.defineProperty(arguments, "0", { + configurable: true + }); + } catch (e) { + var verifyFormal = a === 10; + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arguments, "0", 10, false, false, false) && verifyFormal; + } + return false; + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-296.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-296.js new file mode 100644 index 000000000..45ee0515f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-296.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.6-4-296 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is own + data property of 'O', test TypeError is thrown when updating the + [[Configurable]] attribute value of 'name' which is defined as + non-configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + Object.defineProperty(arguments, "0", { + value: 10, + writable: false, + enumerable: false, + configurable: false + }); + try { + Object.defineProperty(arguments, "0", { + configurable: true + }); + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arguments, "0", 10, false, false, false); + } + return false; + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-297-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-297-1.js new file mode 100644 index 000000000..d4fe4f15f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-297-1.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.6-4-297-1 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'name' 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 'name' + which is defined as non-configurable (10.6 [[DefineOwnProperty]] + step 4 and step 5a) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function (a, b, c) { + function getFunc1() { + return 10; + } + Object.defineProperty(arguments, "0", { + get: getFunc1, + enumerable: false, + configurable: false + }); + function getFunc2() { + return 20; + } + try { + Object.defineProperty(arguments, "0", { + get: getFunc2 + }); + } catch (e) { + var verifyFormal = a === 0; + return e instanceof TypeError && accessorPropertyAttributesAreCorrect(arguments, "0", getFunc1, undefined, undefined, false, false) && verifyFormal; + } + return false; + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-297.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-297.js new file mode 100644 index 000000000..6544efa66 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-297.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.6-4-297 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is own + accessor property of 'O', test TypeError is thrown when updating + the [[Get]] attribute value of 'name' which is defined as + non-configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + function getFunc1() { + return 10; + } + Object.defineProperty(arguments, "0", { + get: getFunc1, + enumerable: false, + configurable: false + }); + function getFunc2() { + return 20; + } + try { + Object.defineProperty(arguments, "0", { + get: getFunc2 + }); + } catch (e) { + return e instanceof TypeError && accessorPropertyAttributesAreCorrect(arguments, "0", getFunc1, undefined, undefined, false, false); + } + return false; + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-298-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-298-1.js new file mode 100644 index 000000000..6e701c1e2 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-298-1.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.6-4-298-1 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'name' 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 'name' + which is defined as non-configurable (10.6 [[DefineOwnProperty]] + steps 4 and 5a) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function (a, b, c) { + function getFunc() { + return 10; + } + Object.defineProperty(arguments, "0", { + get: getFunc, + set: undefined, + enumerable: false, + configurable: false + }); + function setFunc(value) { + this.setVerifyHelpProp = value; + } + try { + Object.defineProperty(arguments, "0", { + set: setFunc + }); + } catch (e) { + var verifyFormal = a === 0; + return e instanceof TypeError && + accessorPropertyAttributesAreCorrect(arguments, "0", getFunc, undefined, undefined, false, false) && verifyFormal; + } + return false; + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-298.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-298.js new file mode 100644 index 000000000..1e3ac280d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-298.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.6-4-298 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is own + accessor property of 'O', test TypeError is thrown when updating + the [[Set]] attribute value of 'name' which is defined as + non-configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + function getFunc() { + return 10; + } + Object.defineProperty(arguments, "0", { + get: getFunc, + set: undefined, + enumerable: false, + configurable: false + }); + function setFunc(value) { + this.setVerifyHelpProp = value; + } + try { + Object.defineProperty(arguments, "0", { + set: setFunc + }); + } catch (e) { + return e instanceof TypeError && accessorPropertyAttributesAreCorrect(arguments, "0", getFunc, undefined, undefined, false, false); + } + return false; + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-299-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-299-1.js new file mode 100644 index 000000000..38ce1f45b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-299-1.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.6-4-299-1 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'name' 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 + 'name' which is defined as non-configurable (10.6 + [[DefineOwnProperty]] steps 4 and 5a) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function (a, b, c) { + function getFunc() { + return 10; + } + Object.defineProperty(arguments, "0", { + get: getFunc, + enumerable: true, + configurable: false + }); + try { + Object.defineProperty(arguments, "0", { + enumerable: false + }); + } catch (e) { + var verifyFormal = a === 0; + return e instanceof TypeError && + accessorPropertyAttributesAreCorrect(arguments, "0", getFunc, undefined, undefined, true, false) && verifyFormal; + } + return false; + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-299.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-299.js new file mode 100644 index 000000000..fa0817b65 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-299.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.6-4-299 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is own + accessor property of 'O', test TypeError is thrown when updating + the [[Enumerable]] attribute value of 'name' which is defined as + non-configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + function getFunc() { + return 10; + } + Object.defineProperty(arguments, "0", { + get: getFunc, + enumerable: true, + configurable: false + }); + try { + Object.defineProperty(arguments, "0", { + enumerable: false + }); + } catch (e) { + return e instanceof TypeError && accessorPropertyAttributesAreCorrect(arguments, "0", getFunc, undefined, undefined, true, false); + } + return false; + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-3.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-3.js new file mode 100644 index 000000000..7300c7ea0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-3.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. + +/*--- +info: > + Step 4 of defineProperty calls the [[DefineOwnProperty]] internal method + of O to define the property. For newly defined accessor properties, attributes + missing from desc should have values set to the defaults from 8.6.1. +es5id: 15.2.3.6-4-3 +description: > + Object.defineProperty sets missing attributes to their default + values (accessor)(8.12.9 step 4.b.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + var getter = function () { return 1; }; + var desc = { get: getter }; + + Object.defineProperty(o, "foo", desc); + + var propDesc = Object.getOwnPropertyDescriptor(o, "foo"); + + if (typeof(propDesc.get) === "function" && // the getter must be the function that was provided + propDesc.get === getter && + propDesc.enumerable === false && // false by default + propDesc.configurable === false) { // false by default + return true; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-30.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-30.js new file mode 100644 index 000000000..c26be3784 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-30.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.6-4-30 +description: > + Object.defineProperty - 'name' is own accessor property without a + get function (8.12.9 step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, "foo", { + set: function () { }, + configurable: false + }); + + try { + Object.defineProperty(obj, "foo", { + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-300-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-300-1.js new file mode 100644 index 000000000..8ad3eae8f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-300-1.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.6-4-300-1 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'name' 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 + 'name' which is defined as non-configurable (10.6 + [[DefineOwnProperty]] step 4 and step 5a) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function (a, b, c) { + function getFunc() { + return 0; + } + Object.defineProperty(arguments, "0", { + get: getFunc, + enumerable: true, + configurable: false + }); + try { + Object.defineProperty(arguments, "0", { + configurable: true + }); + } catch (e) { + var verifyFormal = a === 0; + return e instanceof TypeError && + accessorPropertyAttributesAreCorrect(arguments, "0", getFunc, undefined, undefined, true, false) && verifyFormal; + } + return false; + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-300.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-300.js new file mode 100644 index 000000000..c126506f1 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-300.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.6-4-300 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is own + accessor property of 'O', test TypeError is thrown when updating + the [[Configurable]] attribute value of 'name' which is defined as + non-configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + function getFunc() { + return 10; + } + Object.defineProperty(arguments, "0", { + get: getFunc, + enumerable: true, + configurable: false + }); + try { + Object.defineProperty(arguments, "0", { + configurable: true + }); + } catch (e) { + return e instanceof TypeError && accessorPropertyAttributesAreCorrect(arguments, "0", getFunc, undefined, undefined, true, false); + } + return false; + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-301-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-301-1.js new file mode 100644 index 000000000..6b1ec784e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-301-1.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.6-4-301-1 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'name' is an index named property of + 'O', and 'desc' is data descriptor, test 'name' is defined in 'O' + with all correct attribute values (10.6 [[DefineOwnProperty]] step + 3) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function (a, b, c) { + delete arguments[0]; + Object.defineProperty(arguments, "0", { + value: 10, + writable: false, + enumerable: false, + configurable: false + }); + var verifyFormal = a === 0; + return dataPropertyAttributesAreCorrect(arguments, "0", 10, false, false, false) && verifyFormal; + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-301.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-301.js new file mode 100644 index 000000000..84af90c00 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-301.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.6-4-301 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is an + array index named property of 'O' but not defined in + [[ParameterMap]] of 'O', and 'desc' is data descriptor, test + 'name' is defined in 'O' with all correct attribute values (10.6 + [[DefineOwnProperty]] step 3) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + delete arguments[0]; + Object.defineProperty(arguments, "0", { + value: 10, + writable: false, + enumerable: false, + configurable: false + }); + return dataPropertyAttributesAreCorrect(arguments, "0", 10, false, false, false); + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-302-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-302-1.js new file mode 100644 index 000000000..f64d1b88b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-302-1.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.6-4-302-1 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'name' is an index named property of + 'O' but not defined in [[ParameterMap]] of 'O', and 'desc' is + accessor descriptor, test 'name' is defined in 'O' with all + correct attribute values (10.6 [[DefineOwnProperty]] step 3 and + step 5a) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function (a, b, c) { + delete arguments[0]; + function getFunc() { + return 10; + } + function setFunc(value) { + this.setVerifyHelpProp = value; + } + Object.defineProperty(arguments, "0", { + get: getFunc, + set: setFunc, + enumerable: false, + configurable: false + }); + var verifyFormal = a === 0; + return accessorPropertyAttributesAreCorrect(arguments, "0", getFunc, setFunc, "setVerifyHelpProp", false, false) && verifyFormal; + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-302.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-302.js new file mode 100644 index 000000000..030cbe3dd --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-302.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.6-4-302 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is an + index named property of 'O' but not defined in [[ParameterMap]] of + 'O', and 'desc' is accessor descriptor, test 'name' is defined in + 'O' with all correct attribute values (10.6 [[DefineOwnProperty]] + step 3) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + delete arguments[0]; + function getFunc() { + return 10; + } + function setFunc(value) { + this.setVerifyHelpProp = value; + } + Object.defineProperty(arguments, "0", { + get: getFunc, + set: setFunc, + enumerable: false, + configurable: false + }); + return accessorPropertyAttributesAreCorrect(arguments, "0", getFunc, setFunc, "setVerifyHelpProp", false, false); + }(0, 1, 2)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-303.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-303.js new file mode 100644 index 000000000..4cc9b8b56 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-303 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is an + index named accessor property of 'O' but not defined in + [[ParameterMap]] of 'O', and 'desc' is accessor descriptor, test + updating multiple attribute values of 'name' (10.6 + [[DefineOwnProperty]] step 3) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + function getFunc1() { + return 10; + } + Object.defineProperty(arguments, "0", { + get: getFunc1, + enumerable: true, + configurable: true + }); + function getFunc2() { + return 20; + } + Object.defineProperty(arguments, "0", { + get: getFunc2, + enumerable: false, + configurable: false + }); + return accessorPropertyAttributesAreCorrect(arguments, "0", getFunc2, undefined, undefined, false, false); + }()); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-304.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-304.js new file mode 100644 index 000000000..0af11ce92 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-304.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.6-4-304 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is an + index named data property of 'O' but not defined in + [[ParameterMap]] of 'O', and 'desc' is data descriptor, test + updating multiple attribute values of 'name' (10.6 + [[DefineOwnProperty]] step 3) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + Object.defineProperty(arguments, "0", { + value: 20, + writable: false, + enumerable: false, + configurable: false + }); + return dataPropertyAttributesAreCorrect(arguments, "0", 20, false, false, false); + }()); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-305.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-305.js new file mode 100644 index 000000000..a16f290b5 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-305.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.6-4-305 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is an + index named data property of 'O' but not defined in + [[ParameterMap]] of 'O', test TypeError is thrown when updating + the [[Value]] attribute value of 'name' which is not writable and + not configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + Object.defineProperty(arguments, "0", { + value: 0, + writable: false, + configurable: false + }); + + try { + Object.defineProperty(arguments, "0", { + value: 10 + }); + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arguments, "0", 0, false, false, false); + } + return false; + }()); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-306.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-306.js new file mode 100644 index 000000000..a9f64c1dd --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-306.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.6-4-306 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is an + index named data property of 'O' but not defined in + [[ParameterMap]] of 'O', test TypeError is thrown when updating + the [[Writable]] attribute value of 'name' which is not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + Object.defineProperty(arguments, "0", { + value: 0, + writable: false, + enumerable: false, + configurable: false + }); + try { + Object.defineProperty(arguments, "0", { + writable: true + }); + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arguments, "0", 0, false, false, false); + } + return false; + }()); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-307.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-307.js new file mode 100644 index 000000000..933c5503a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-307.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.6-4-307 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is an + index named data property of 'O' but not defined in + [[ParameterMap]] of 'O', test TypeError is thrown when updating + the [[Enumerable]] attribute value of 'name' which is not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + Object.defineProperty(arguments, "0", { + value: 0, + writable: false, + enumerable: true, + configurable: false + }); + try { + Object.defineProperty(arguments, "0", { + enumerable: false + }); + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arguments, "0", 0, false, true, false); + } + return false; + }()); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-308.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-308.js new file mode 100644 index 000000000..68decc8ec --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-308.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.6-4-308 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is an + index named data property of 'O' but not defined in + [[ParameterMap]] of 'O', test TypeError is thrown when updating + the [[Configurable]] attribute value of 'name' which is not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + Object.defineProperty(arguments, "0", { + value: 0, + writable: false, + enumerable: false, + configurable: false + }); + try { + Object.defineProperty(arguments, "0", { + configurable: true + }); + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(arguments, "0", 0, false, false, false); + } + return false; + }()); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-309.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-309.js new file mode 100644 index 000000000..5fda8e75c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-309.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.6-4-309 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is an + index named accessor property of 'O' but not defined in + [[ParameterMap]] of 'O', test TypeError is thrown when updating + the [[Get]] attribute value of 'name' which is not configurable + (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + function getFunc1() { + return 0; + } + Object.defineProperty(arguments, "0", { + get: getFunc1, + enumerable: false, + configurable: false + }); + function getFunc2() { + return 10; + } + try { + Object.defineProperty(arguments, "0", { + get: getFunc2 + }); + return false; + } catch (e) { + return e instanceof TypeError && accessorPropertyAttributesAreCorrect(arguments, "0", getFunc1, undefined, undefined, false, false); + } + }()); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-31.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-31.js new file mode 100644 index 000000000..9dd4fd4ee --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-31.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.6-4-31 +description: > + Object.defineProperty - 'name' 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, "foo", { + get: function () { }, + configurable: true + }); + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + var obj = new ConstructFun(); + Object.defineProperty(obj, "foo", { + set: function () { }, + configurable: false + }); + + try { + Object.defineProperty(obj, "foo", { + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-310.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-310.js new file mode 100644 index 000000000..e37e898cf --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-310.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.6-4-310 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is an + index named accessor property of 'O' but not defined in + [[ParameterMap]] of 'O', test TypeError is thrown when updating + the [[Set]] attribute value of 'name' which is not configurable + (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + function getFunc() { + return 0; + } + Object.defineProperty(arguments, "0", { + get: getFunc, + set: undefined, + enumerable: false, + configurable: false + }); + function setFunc(value) { + this.setVerifyHelpProp = value; + } + try { + Object.defineProperty(arguments, "0", { + set: setFunc + }); + } catch (e) { + return e instanceof TypeError && accessorPropertyAttributesAreCorrect(arguments, "0", getFunc, undefined, undefined, false, false); + } + return false; + }()); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-311.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-311.js new file mode 100644 index 000000000..2c267d325 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-311.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.6-4-311 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is an + index named accessor property of 'O' but not defined in + [[ParameterMap]] of 'O', test TypeError is thrown when updating + the [[Enumerable]] attribute value of 'name' which is not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + function getFunc() { + return 0; + } + Object.defineProperty(arguments, "0", { + get: getFunc, + enumerable: true, + configurable: false + }); + try { + Object.defineProperty(arguments, "0", { + enumerable: false + }); + } catch (e) { + return e instanceof TypeError && accessorPropertyAttributesAreCorrect(arguments, "0", getFunc, undefined, undefined, true, false); + } + return false; + }()); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-312.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-312.js new file mode 100644 index 000000000..2ff370650 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-312.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.6-4-312 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is an + index named accessor property of 'O' but not defined in + [[ParameterMap]] of 'O', test TypeError is thrown when updating + the [[Configurable]] attribute value of 'name' which is not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + function getFunc() { + return 0; + } + Object.defineProperty(arguments, "0", { + get: getFunc, + enumerable: true, + configurable: false + }); + try { + Object.defineProperty(arguments, "0", { + configurable: true + }); + } catch (e) { + return e instanceof TypeError && accessorPropertyAttributesAreCorrect(arguments, "0", getFunc, undefined, undefined, true, false); + } + return false; + }()); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-313-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-313-1.js new file mode 100644 index 000000000..94b29a6e3 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-313-1.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.6-4-313-1 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'P' is own property, 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() { + return (function (a, b, c) { + Object.defineProperty(arguments, "genericProperty", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + return dataPropertyAttributesAreCorrect(arguments, "genericProperty", 1001, true, true, true); + }(1, 2, 3)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-313.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-313.js new file mode 100644 index 000000000..1061ac675 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-313.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.6-4-313 +description: > + Object.defineProperty - '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 3) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + Object.defineProperty(arguments, "genericProperty", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + return dataPropertyAttributesAreCorrect(arguments, "genericProperty", 1001, true, true, true); + }(1, 2, 3)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-314-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-314-1.js new file mode 100644 index 000000000..11dcfd9a0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-314-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.6-4-314-1 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'P' is property, 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() { + return (function (a, b, c) { + function getFunc() { + return "getFunctionString"; + } + function setFunc(value) { + this.testgetFunction = value; + } + Object.defineProperty(arguments, "genericProperty", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + return accessorPropertyAttributesAreCorrect(arguments, "genericProperty", getFunc, setFunc, "testgetFunction", true, true); + }(1, 2, 3)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-314.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-314.js new file mode 100644 index 000000000..a82c9fe4e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-314.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.6-4-314 +description: > + Object.defineProperty - '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 3) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + function getFunc() { + return "getFunctionString"; + } + function setFunc(value) { + this.testgetFunction = value; + } + Object.defineProperty(arguments, "genericProperty", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + return accessorPropertyAttributesAreCorrect(arguments, "genericProperty", getFunc, setFunc, "testgetFunction", true, true); + }(1, 2, 3)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-315-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-315-1.js new file mode 100644 index 000000000..934c465e4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-315-1.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.6-4-315-1 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'P' is own accessor property 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() { + return (function (a, b, c) { + Object.defineProperty(arguments, "genericProperty", { + get: function () { + return 1001; + }, + set: function (value) { + this.testgetFunction1 = value; + }, + enumerable: true, + configurable: true + }); + function getFunc() { + return "getFunctionString"; + } + function setFunc(value) { + this.testgetFunction = value; + } + Object.defineProperty(arguments, "genericProperty", { + get: getFunc, + set: setFunc, + enumerable: false, + configurable: false + }); + var verifyFormal = c === 3; + return accessorPropertyAttributesAreCorrect(arguments, "genericProperty", getFunc, setFunc, "testgetFunction", false, false) && verifyFormal; + }(1, 2, 3)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-315.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-315.js new file mode 100644 index 000000000..b999c2634 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-315.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.6-4-315 +description: > + Object.defineProperty - '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 3) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + Object.defineProperty(arguments, "genericProperty", { + get: function () { + return 1001; + }, + set: function (value) { + this.testgetFunction1 = value; + }, + enumerable: true, + configurable: true + }); + function getFunc() { + return "getFunctionString"; + } + function setFunc(value) { + this.testgetFunction = value; + } + Object.defineProperty(arguments, "genericProperty", { + get: getFunc, + set: setFunc, + enumerable: false, + configurable: false + }); + return accessorPropertyAttributesAreCorrect(arguments, "genericProperty", getFunc, setFunc, "testgetFunction", false, false); + }(1, 2, 3)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-316-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-316-1.js new file mode 100644 index 000000000..4f9b50861 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-316-1.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.6-4-316-1 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'P' is own data property 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() { + return (function (a, b, c) { + Object.defineProperty(arguments, "genericProperty", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + Object.defineProperty(arguments, "genericProperty", { + value: 1002, + enumerable: false, + configurable: false + }); + return dataPropertyAttributesAreCorrect(arguments, "genericProperty", 1002, true, false, false); + }(1, 2, 3)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-316.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-316.js new file mode 100644 index 000000000..c12cf363c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-316.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.6-4-316 +description: > + Object.defineProperty - '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 3) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + Object.defineProperty(arguments, "genericProperty", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + Object.defineProperty(arguments, "genericProperty", { + value: 1002, + enumerable: false, + configurable: false + }); + return dataPropertyAttributesAreCorrect(arguments, "genericProperty", 1002, true, false, false); + }(1, 2, 3)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-317-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-317-1.js new file mode 100644 index 000000000..67f92c911 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-317-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.6-4-317-1 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'P' is 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() { + return (function (a, b, c) { + Object.defineProperty(arguments, "genericProperty", { + value: 1001, + writable: false, + configurable: false + }); + try { + Object.defineProperty(arguments, "genericProperty", { + value: 1002 + }); + } catch (e) { + var verifyFormal = b === 2; + return e instanceof TypeError && + dataPropertyAttributesAreCorrect(arguments, "genericProperty", 1001, false, false, false) && verifyFormal; + } + return false; + }(1, 2, 3)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-317.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-317.js new file mode 100644 index 000000000..d6932e0c0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-317.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.6-4-317 +description: > + Object.defineProperty - '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() { + return (function () { + Object.defineProperty(arguments, "genericProperty", { + value: 1001, + writable: false, + configurable: false + }); + try { + Object.defineProperty(arguments, "genericProperty", { + value: 1002 + }); + } catch (e) { + return e instanceof TypeError && + dataPropertyAttributesAreCorrect(arguments, "genericProperty", 1001, false, false, false); + } + return false; + }(1, 2, 3)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-318-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-318-1.js new file mode 100644 index 000000000..27d5c6a7d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-318-1.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.6-4-318-1 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'name' is own data property of 'O', + test TypeError is thrown when updating the [[Writable]] attribute + value of 'name' which is not configurable (10.6 + [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function (a, b, c) { + Object.defineProperty(arguments, "genericProperty", { + writable: false, + configurable: false + }); + try { + Object.defineProperty(arguments, "genericProperty", { + writable: true + }); + } catch (e) { + return e instanceof TypeError && + dataPropertyAttributesAreCorrect(arguments, "genericProperty", undefined, false, false, false); + } + return false; + }(1, 2, 3)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-318.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-318.js new file mode 100644 index 000000000..f1425044d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-318.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.6-4-318 +description: > + Object.defineProperty - 'O' is an Arguments object, 'name' is + generic own data property of 'O', test TypeError is thrown when + updating the [[Writable]] attribute value of 'name' which is not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + return (function () { + Object.defineProperty(arguments, "genericProperty", { + writable: false, + configurable: false + }); + try { + Object.defineProperty(arguments, "genericProperty", { + writable: true + }); + } catch (e) { + return e instanceof TypeError && + dataPropertyAttributesAreCorrect(arguments, "genericProperty", undefined, false, false, false); + } + return false; + }(1, 2, 3)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-319-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-319-1.js new file mode 100644 index 000000000..2df5b34ad --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-319-1.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.6-4-319-1 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'P' is 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() { + return (function (a, b, c) { + Object.defineProperty(arguments, "genericProperty", { + enumerable: true, + configurable: false + }); + try { + Object.defineProperty(arguments, "genericProperty", { + enumerable: false + }); + } catch (e) { + return e instanceof TypeError && + dataPropertyAttributesAreCorrect(arguments, "genericProperty", undefined, false, true, false); + } + return false; + }(1, 2, 3)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-319.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-319.js new file mode 100644 index 000000000..916de4531 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-319.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.6-4-319 +description: > + Object.defineProperty - 'O' is an Arguments object, 'P' is 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() { + return (function () { + Object.defineProperty(arguments, "genericProperty", { + enumerable: true, + configurable: false + }); + try { + Object.defineProperty(arguments, "genericProperty", { + enumerable: false + }); + } catch (e) { + return e instanceof TypeError && + dataPropertyAttributesAreCorrect(arguments, "genericProperty", undefined, false, true, false); + } + return false; + }(1, 2, 3)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-32.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-32.js new file mode 100644 index 000000000..55b06bace --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-32.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.6-4-32 +description: > + Object.defineProperty - 'name' is an inherited accessor property + without a get function (8.12.9 step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + var proto = {}; + Object.defineProperty(proto, "foo", { + set: function () { }, + configurable: false + }); + + var ConstructFun = function () { }; + ConstructFun.prototype = proto; + var obj = new ConstructFun(); + + Object.defineProperty(obj, "foo", { + configurable: true + }); + return obj.hasOwnProperty("foo") && typeof obj.foo === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-320-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-320-1.js new file mode 100644 index 000000000..614468a7c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-320-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.6-4-320-1 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'P' is 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() { + return (function (a, b, c) { + Object.defineProperty(arguments, "genericProperty", { + configurable: false + }); + try { + Object.defineProperty(arguments, "genericProperty", { + configurable: true + }); + } catch (e) { + return e instanceof TypeError && + dataPropertyAttributesAreCorrect(arguments, "genericProperty", undefined, false, false, false); + } + return false; + }(1, 2, 3)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-320.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-320.js new file mode 100644 index 000000000..7ad8de9e6 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-320.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.6-4-320 +description: > + Object.defineProperty - 'O' is an Arguments object, 'P' is 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() { + return (function () { + Object.defineProperty(arguments, "genericProperty", { + configurable: false + }); + try { + Object.defineProperty(arguments, "genericProperty", { + configurable: true + }); + } catch (e) { + return e instanceof TypeError && + dataPropertyAttributesAreCorrect(arguments, "genericProperty", undefined, false, false, false); + } + return false; + }(1, 2, 3)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-321-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-321-1.js new file mode 100644 index 000000000..3805e0f28 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-321-1.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.6-4-321-1 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'P' is 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() { + return (function (a, b, c) { + function getFunc() { + return "genericPropertyString"; + } + function setFunc(value) { + this.helpVerifyGet = value; + } + Object.defineProperty(arguments, "genericProperty", { + get: getFunc, + set: setFunc, + configurable: false + }); + try { + Object.defineProperty(arguments, "genericProperty", { + get: function () { + return "overideGenericPropertyString"; + } + }); + } catch (e) { + var verifyFormal = a === 1; + return e instanceof TypeError && + accessorPropertyAttributesAreCorrect(arguments, "genericProperty", getFunc, setFunc, "helpVerifyGet", false, false, false) && verifyFormal; + } + return false; + }(1, 2, 3)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-321.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-321.js new file mode 100644 index 000000000..90a378c1c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-321.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.6-4-321 +description: > + Object.defineProperty - 'O' is an Arguments object, 'P' is 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() { + return (function () { + function getFunc() { + return "genericPropertyString"; + } + function setFunc(value) { + this.helpVerifyGet = value; + } + Object.defineProperty(arguments, "genericProperty", { + get: getFunc, + set: setFunc, + configurable: false + }); + try { + Object.defineProperty(arguments, "genericProperty", { + get: function () { + return "overideGenericPropertyString"; + } + }); + } catch (e) { + return e instanceof TypeError && + accessorPropertyAttributesAreCorrect(arguments, "genericProperty", getFunc, setFunc, "helpVerifyGet", false, false, false); + } + return false; + }(1, 2, 3)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-322-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-322-1.js new file mode 100644 index 000000000..c62fde716 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-322-1.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.6-4-322-1 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'P' is 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() { + return (function (a, b, c) { + function setFunc(value) { + this.genericPropertyString = value; + } + Object.defineProperty(arguments, "genericProperty", { + set: setFunc, + configurable: false + }); + try { + Object.defineProperty(arguments, "genericProperty", { + set: function (value) { + this.genericPropertyString1 = value; + } + }); + } catch (e) { + return e instanceof TypeError && + accessorPropertyAttributesAreCorrect(arguments, "genericProperty", undefined, setFunc, "genericPropertyString", false, false, false); + } + return false; + }(1, 2, 3)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-322.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-322.js new file mode 100644 index 000000000..f53eb4ed2 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-322.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.6-4-322 +description: > + Object.defineProperty - 'O' is an Arguments object, 'P' is 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() { + return (function () { + function setFunc(value) { + this.genericPropertyString = value; + } + Object.defineProperty(arguments, "genericProperty", { + set: setFunc, + configurable: false + }); + try { + Object.defineProperty(arguments, "genericProperty", { + set: function (value) { + this.genericPropertyString1 = value; + } + }); + } catch (e) { + return e instanceof TypeError && + accessorPropertyAttributesAreCorrect(arguments, "genericProperty", undefined, setFunc, "genericPropertyString", false, false, false); + } + return false; + }(1, 2, 3)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-323-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-323-1.js new file mode 100644 index 000000000..4f38a7210 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-323-1.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.6-4-323-1 +description: > + Object.defineProperty - ''O' is an Arguments object of a function + that has formal parameters, 'P' is 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() { + return (function (a, b, c) { + function setFunc(value) { + this.genericPropertyString = value; + } + Object.defineProperty(arguments, "genericProperty", { + set: setFunc, + enumerable: true, + configurable: false + }); + try { + Object.defineProperty(arguments, "genericProperty", { + enumerable: false + }); + } catch (e) { + verifyFormal = c === 3; + return e instanceof TypeError && + accessorPropertyAttributesAreCorrect(arguments, "genericProperty", undefined, setFunc, "genericPropertyString", true, false) && verifyFormal; + } + return false; + }(1, 2, 3)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-323.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-323.js new file mode 100644 index 000000000..7b3937b84 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-323.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.6-4-323 +description: > + Object.defineProperty - ''O' is an Arguments object, 'P' is 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() { + return (function () { + function setFunc(value) { + this.genericPropertyString = value; + } + Object.defineProperty(arguments, "genericProperty", { + set: setFunc, + enumerable: true, + configurable: false + }); + try { + Object.defineProperty(arguments, "genericProperty", { + enumerable: false + }); + } catch (e) { + return e instanceof TypeError && + accessorPropertyAttributesAreCorrect(arguments, "genericProperty", undefined, setFunc, "genericPropertyString", true, false); + } + return false; + }(1, 2, 3)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-324-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-324-1.js new file mode 100644 index 000000000..12384ea2a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-324-1.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.6-4-324-1 +description: > + Object.defineProperty - 'O' is an Arguments object of a function + that has formal parameters, 'P' is 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() { + return (function (a, b, c) { + function setFunc(value) { + this.genericPropertyString = value; + } + Object.defineProperty(arguments, "genericProperty", { + set: setFunc, + configurable: false + }); + try { + Object.defineProperty(arguments, "genericProperty", { + configurable: true + }); + } catch (e) { + return e instanceof TypeError && + accessorPropertyAttributesAreCorrect(arguments, "genericProperty", undefined, setFunc, "genericPropertyString", false, false, false); + } + return false; + }(1, 2, 3)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-324.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-324.js new file mode 100644 index 000000000..00e2d81dc --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-324.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.6-4-324 +description: > + Object.defineProperty - 'O' is an Arguments object, 'P' is 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() { + return (function () { + function setFunc(value) { + this.genericPropertyString = value; + } + Object.defineProperty(arguments, "genericProperty", { + set: setFunc, + configurable: false + }); + try { + Object.defineProperty(arguments, "genericProperty", { + configurable: true + }); + } catch (e) { + return e instanceof TypeError && + accessorPropertyAttributesAreCorrect(arguments, "genericProperty", undefined, setFunc, "genericPropertyString", false, false, false); + } + return false; + }(1, 2, 3)); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-325-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-325-1.js new file mode 100644 index 000000000..29eb269d6 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-325-1.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.6-4-325-1 +description: > + Object.defineProperty - 'O' is an Arguments object which created + with function take formal parameters, '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 argObj = (function (a, b, c) { return arguments; })(1, 2, 3); + var accessed = false; + + Object.defineProperty(argObj, 0, { + get: function () { + accessed = true; + return 12; + } + }); + + return argObj[0] === 12 && accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-325.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-325.js new file mode 100644 index 000000000..19051ff2b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-325.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.6-4-325 +description: > + Object.defineProperty - '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 argObj = (function () { return arguments; })(1, 2, 3); + var accessed = false; + + Object.defineProperty(argObj, 0, { + get: function () { + accessed = true; + return 12; + } + }); + + return argObj[0] === 12 && accessed; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-326.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-326.js new file mode 100644 index 000000000..9e8844a56 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-326.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.6-4-326 +description: > + ES5 Attributes - property ([[Writable]] is true, [[Enumerable]] is + true, [[Configurable]] is true) is writable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: true, + configurable: true + }); + var propertyDefineCorrect = (obj.prop === 2010); + obj.prop = 1001; + + return propertyDefineCorrect && obj.prop === 1001; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-327.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-327.js new file mode 100644 index 000000000..02846c078 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-327.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.6-4-327 +description: > + ES5 Attributes - property ([[Writable]] is true, [[Enumerable]] is + true, [[Configurable]] is true) is enumerable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: true, + configurable: true + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var property in obj) { + if (property === "prop") { + return propertyDefineCorrect && desc.enumerable === true; + } + } + return false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-328.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-328.js new file mode 100644 index 000000000..f6248ac5f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-328.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.6-4-328 +description: > + ES5 Attributes - property ([[Writable]] is true, [[Enumerable]] is + true, [[Configurable]] is true) is deletable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: true, + configurable: true + }); + var beforeDelete = obj.hasOwnProperty("prop"); + delete obj.prop; + var afterDelete = obj.hasOwnProperty("prop"); + return beforeDelete && !afterDelete; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-329.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-329.js new file mode 100644 index 000000000..fdcd3c343 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-329.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.6-4-329 +description: > + ES5 Attributes - success to update [[Writable]] attribute of data + property ([[Writable]] is true, [[Enumerable]] is true, + [[Configurable]] is true) to different value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: true, + configurable: true + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + writable: false + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc1.writable === true && obj.prop === 2010 && desc2.writable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-33.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-33.js new file mode 100644 index 000000000..1f0a634e8 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-33 +description: > + Object.defineProperty - 'O' is a Function object that uses + Object's [[GetOwnProperty]] method to access the 'name' property + (8.12.9 step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + var fun = function () { }; + + Object.defineProperty(fun, "foo", { + value: 12, + configurable: false + }); + + try { + Object.defineProperty(fun, "foo", { + value: 11, + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError && fun.foo === 12; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-330.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-330.js new file mode 100644 index 000000000..d8997ae1d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-330.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.6-4-330 +description: > + ES5 Attributes - success to update [[enumerable]] attribute of + data property ([[Writable]] is true, [[Enumerable]] is true, + [[Configurable]] is true) to different value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: true, + configurable: true + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + enumerable: false + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc1.enumerable === true && obj.prop === 2010 && desc2.enumerable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-331.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-331.js new file mode 100644 index 000000000..56ffadbde --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-331.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.6-4-331 +description: > + ES5 Attributes - success to update [[Configurable]] attribute of + data property ([[Writable]] is true, [[Enumerable]] is true, + [[Configurable]] is true) to different value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: true, + configurable: true + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + configurable: false + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc1.configurable === true && obj.prop === 2010 && desc2.configurable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-332.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-332.js new file mode 100644 index 000000000..b5f145656 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-332.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.6-4-332 +description: > + ES5 Attributes - success to update the data property ([[Writable]] + is true, [[Enumerable]] is true, [[Configurable]] is true) to an + accessor property +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: true, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + function getFunc() { + return 20; + } + Object.defineProperty(obj, "prop", { + get: getFunc + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("value") && desc2.get === getFunc; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-333-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-333-1.js new file mode 100644 index 000000000..3e91e0e6a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-333-1.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.6-4-333-1 +description: > + Object.defineProperty will update [[Value]] attribute of named + property 'P' successfully when [[Configurable]] attribute is + false, [[Writable]] attribute is true and 'O' is an Object object + (8.12.9 - step 10) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "property", { + value: 1001, + writable: true, + configurable: false + }); + + Object.defineProperty(obj, "property", { + value: 1002 + }); + + return dataPropertyAttributesAreCorrect(obj, "property", 1002, true, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-333-10.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-333-10.js new file mode 100644 index 000000000..c6a0187ec --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-333-10.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.6-4-333-10 +description: > + ES5 Attributes - indexed data property 'P' with attributes + [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: false + is writable using simple assignment, 'O' is an Arguments object +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = (function () { + return arguments; + }()); + + Object.defineProperty(obj, "0", { + value: 2010, + writable: true, + enumerable: true, + configurable: false + }); + var verifyValue = (obj[0] === 2010); + obj[0] = 1001; + + return verifyValue && obj[0] === 1001; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-333-11.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-333-11.js new file mode 100644 index 000000000..37f217f73 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-333-11.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.6-4-333-11 +description: > + ES5 Attributes - indexed property 'P' with attributes + [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: false + is writable using simple assignment, 'O' is an Arguments object +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = (function (x) { + return arguments; + }(1001)); + + Object.defineProperty(obj, "0", { + value: 2010, + writable: true, + enumerable: true, + configurable: false + }); + var verifyValue = (obj[0] === 2010); + + return verifyValue; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-333-2.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-333-2.js new file mode 100644 index 000000000..12981e797 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-333-2.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.6-4-333-2 +description: > + Object.defineProperty will update [[Value]] attribute of indexed + property 'P' successfully when [[Configurable]] attribute is + false, [[Writable]] attribute is true and 'A' is an Array object + (8.12.9 - step 10) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = []; + + Object.defineProperty(obj, "0", { + value: 1001, + writable: true, + configurable: false + }); + + Object.defineProperty(obj, "0", { + value: 1002 + }); + + return dataPropertyAttributesAreCorrect(obj, "0", 1002, true, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-333-3.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-333-3.js new file mode 100644 index 000000000..140ddcb5e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-333-3.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.6-4-333-3 +description: > + Object.defineProperty will update [[Value]] attribute of named + property 'P' successfully when [[Configurable]] attribute is + false, [[Writable]] attribute is true and 'O' is an Arguments + object (8.12.9 - step 10) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = (function () { + return arguments; + }()); + + Object.defineProperty(obj, "property", { + value: 1001, + writable: true, + configurable: false + }); + + Object.defineProperty(obj, "property", { + value: 1002 + }); + + return dataPropertyAttributesAreCorrect(obj, "property", 1002, true, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-333-4.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-333-4.js new file mode 100644 index 000000000..ee97ff9f8 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-333-4.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.6-4-333-4 +description: > + Indexed property 'P' with attributes [[Writable]]: true, + [[Enumerable]]:true, [[Configurable]]:false is writable using + simple assignment, 'A' is an Array Object +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = []; + + Object.defineProperty(obj, "0", { + value: 2010, + writable: true, + enumerable: true, + configurable: false + }); + var verifyValue = (obj[0] === 2010); + obj[0] = 1001; + + return verifyValue && obj[0] === 1001; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-333-5.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-333-5.js new file mode 100644 index 000000000..5a0f4ccb5 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-333-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.6-4-333-5 +description: > + ES5 Attributes - named data property 'P' with attributes + [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: false + is writable using simple assignment, 'O' is an Arguments object +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = (function () { + return arguments; + }()); + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: true, + configurable: false + }); + var verifyValue = (obj.prop === 2010); + obj.prop = 1001; + + return verifyValue && obj.prop === 1001; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-333-6.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-333-6.js new file mode 100644 index 000000000..d76802574 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-333-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.6-4-333-6 +description: > + Object.defineProperty will update [[Value]] attribute of indexed + property 'P' successfully when [[Configurable]] attribute is + false, [[Writable]] attribute is true and 'O' is an Object object + (8.12.9 - step 10) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "0", { + value: 1001, + writable: true, + configurable: false + }); + + Object.defineProperty(obj, "0", { + value: 1002 + }); + + return dataPropertyAttributesAreCorrect(obj, "0", 1002, true, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-333-7.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-333-7.js new file mode 100644 index 000000000..4f15006f1 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-333-7.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.6-4-333-7 +description: > + Object.defineProperty will update [[Value]] attribute of named + property 'P' successfully when [[Configurable]] attribute is + false, [[Writable]] attribute is true and 'A' is an Array object + (8.12.9 - step 10) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = []; + + Object.defineProperty(obj, "prop", { + value: 1001, + writable: true, + configurable: false + }); + + Object.defineProperty(obj, "prop", { + value: 1002 + }); + + return dataPropertyAttributesAreCorrect(obj, "prop", 1002, true, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-333-8.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-333-8.js new file mode 100644 index 000000000..89d18fed0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-333-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.6-4-333-8 +description: > + Object.defineProperty will update [[Value]] attribute of indexed + property 'P'successfully when [[Configurable]] attribute is false, + [[Writable]] attribute is true and 'O' is an Arguments object + (8.12.9 - step 10) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = (function () { + return arguments; + }()); + + Object.defineProperty(obj, "0", { + value: 1001, + writable: true, + configurable: false + }); + + Object.defineProperty(obj, "0", { + value: 1002 + }); + + return dataPropertyAttributesAreCorrect(obj, "0", 1002, true, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-333-9.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-333-9.js new file mode 100644 index 000000000..c1397eaf7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-333-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.6-4-333-9 +description: > + Object.defineProperty - Named property 'P' with attributes + [[Writable]]: true, [[Enumerable]]:true, [[Configurable]]:false is + writable using simple assignment, 'A' is an Array Object +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = []; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: true, + configurable: false + }); + var verifyValue = (obj.prop === 2010); + obj.prop = 1001; + + return verifyValue && obj.prop === 1001; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-333.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-333.js new file mode 100644 index 000000000..7f4b2a8ba --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-333.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.6-4-333 +description: > + ES5 Attributes - property ([[Writable]] is true, [[Enumerable]] is + true, [[Configurable]] is false) is writable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: true, + configurable: false + }); + var propertyDefineCorrect = (obj.prop === 2010); + obj.prop = 1001; + + return propertyDefineCorrect && obj.prop === 1001; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-334.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-334.js new file mode 100644 index 000000000..b63bf105d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-334.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.6-4-334 +description: > + ES5 Attributes - property ([[Writable]] is true, [[Enumerable]] is + true, [[Configurable]] is false) is enumerable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: true, + configurable: false + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p in obj) { + if (p === "prop") { + return propertyDefineCorrect && desc.enumerable === true; + } + } + return false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-335.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-335.js new file mode 100644 index 000000000..435c74aa3 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-335.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.6-4-335 +description: > + ES5 Attributes - property ([[Writable]] is true, [[Enumerable]] is + true, [[Configurable]] is false) is undeletable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: true, + configurable: false + }); + var beforeDelete = obj.hasOwnProperty("prop"); + delete obj.prop; + var afterDelete = obj.hasOwnProperty("prop"); + return beforeDelete && obj.prop === 2010 && afterDelete; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-336.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-336.js new file mode 100644 index 000000000..d17087b16 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-336.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.6-4-336 +description: > + ES5 Attributes - Success to update [[Writable]] attribute of data + property ([[Writable]] is true, [[Enumerable]] is true, + [[Configurable]] is false) to different value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: true, + configurable: false + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + writable: false + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc1.writable === true && obj.prop === 2010 && desc2.writable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-337.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-337.js new file mode 100644 index 000000000..141b8a73b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-337.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.6-4-337 +description: > + ES5 Attributes - fail to update [[Enumerable]] attribute of data + property ([[Writable]] is true, [[Enumerable]] is true, + [[Configurable]] is false) to different value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: true, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + enumerable: false + }); + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + return propertyDefineCorrect && desc1.enumerable === true && obj.prop === 2010 && desc2.enumerable === true && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-338.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-338.js new file mode 100644 index 000000000..139fcb254 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-338.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.6-4-338 +description: > + ES5 Attributes - fail to update [[Configurable]] attribute of data + property ([[Writable]] is true, [[Enumerable]] is true, + [[Configurable]] is false) to different value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: true, + configurable: false + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + configurable: true + }); + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + return propertyDefineCorrect && desc1.configurable === false && obj.prop === 2010 && desc2.configurable === false && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-339-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-339-1.js new file mode 100644 index 000000000..5f7e72685 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-339-1.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.6-4-339-1 +description: > + Object.defineProperty - Updating indexed data property 'P' with + attributes [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false to an accessor property does not succeed, + 'A' is an Array object (8.12.9 - step 9.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = []; + + Object.defineProperty(obj, "0", { + value: 2010, + writable: true, + enumerable: true, + configurable: false + }); + var propertyDefineCorrect = obj.hasOwnProperty("0"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "0"); + + function getFunc() { + return 20; + } + try { + Object.defineProperty(obj, "0", { + get: getFunc + }); + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "0"); + return propertyDefineCorrect && desc1.value === 2010 && obj[0] === 2010 && typeof desc2.get === "undefined" && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-339-2.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-339-2.js new file mode 100644 index 000000000..93c950501 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-339-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.6-4-339-2 +description: > + Object.defineProperty - Updating named data property 'P' with + attributes [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false to an accessor property does not succeed, + 'O' is an Arguments object (8.12.9 - step 9.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = (function () { + return arguments; + }()); + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: true, + configurable: false + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + function getFunc() { + return 20; + } + try { + Object.defineProperty(obj, "prop", { + get: getFunc + }); + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + return propertyDefineCorrect && desc1.value === 2010 && obj.prop === 2010 && typeof desc2.get === "undefined" && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-339-3.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-339-3.js new file mode 100644 index 000000000..6688b6bff --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-339-3.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.6-4-339-3 +description: > + Object.defineProperty - Updating named data property 'P' with + attributes [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false to an accessor property does not succeed, + 'A' is an Array object (8.12.9 - step 9.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = []; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: true, + configurable: false + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + function getFunc() { + return 20; + } + try { + Object.defineProperty(obj, "prop", { + get: getFunc + }); + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + return propertyDefineCorrect && desc1.value === 2010 && obj.prop === 2010 && + typeof desc2.get === "undefined" && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-339-4.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-339-4.js new file mode 100644 index 000000000..8e81ff6af --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-339-4.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.6-4-339-4 +description: > + Object.defineProperty - Updating indexed data property 'P' with + attributes [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false to an accessor property does not succeed, + 'O' is an Arguments object (8.12.9 - step 9.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = (function () { + return arguments; + }()); + + Object.defineProperty(obj, "0", { + value: 2010, + writable: true, + enumerable: true, + configurable: false + }); + var propertyDefineCorrect = obj.hasOwnProperty("0"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "0"); + + function getFunc() { + return 20; + } + try { + Object.defineProperty(obj, "0", { + get: getFunc + }); + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "0"); + return propertyDefineCorrect && desc1.value === 2010 && obj[0] === 2010 && + typeof desc2.get === "undefined" && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-339.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-339.js new file mode 100644 index 000000000..9d36f53d8 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-339.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.6-4-339 +description: > + ES5 Attributes - fail to update the data property ([[Writable]] is + true, [[Enumerable]] is true, [[Configurable]] is false) to an + accessor property +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: true, + configurable: false + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + function getFunc() { + return 20; + } + try { + Object.defineProperty(obj, "prop", { + get: getFunc + }); + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + return propertyDefineCorrect && desc1.value === 2010 && obj.prop === 2010 && typeof desc2.get === "undefined" && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-34.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-34.js new file mode 100644 index 000000000..d0b3545ea --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-34 +description: > + Object.defineProperty - 'O' is an Array object that uses Object's + [[GetOwnProperty]] method to access the 'name' property (8.12.9 + step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + var arrObj = []; + + Object.defineProperty(arrObj, "foo", { + value: 12, + configurable: false + }); + + try { + Object.defineProperty(arrObj, "foo", { + value: 11, + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError && arrObj.foo === 12; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-340.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-340.js new file mode 100644 index 000000000..8a071c2d9 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-340.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.6-4-340 +description: > + ES5 Attributes - property ([[Writable]] is true, [[Enumerable]] is + false, [[Configurable]] is true) is writable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: false, + configurable: true + }); + var propertyDefineCorrect = (obj.prop === 2010); + obj.prop = 1001; + + return propertyDefineCorrect && obj.prop === 1001; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-341.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-341.js new file mode 100644 index 000000000..c6f2fdfda --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-341.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.6-4-341 +description: > + ES5 Attributes - property ([[Writable]] is true, [[Enumerable]] is + false, [[Configurable]] is true) is non-enumerable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: false, + configurable: true + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p in obj) { + if (p === "prop") { + return false; + } + } + return propertyDefineCorrect && desc.enumerable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-342.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-342.js new file mode 100644 index 000000000..e1514ce0b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-342.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.6-4-342 +description: > + ES5 Attributes - property ([[Writable]] is true, [[Enumerable]] is + false, [[Configurable]] is true) is deletable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: false, + configurable: true + }); + var beforeDelete = obj.hasOwnProperty("prop"); + delete obj.prop; + var afterDelete = obj.hasOwnProperty("prop"); + return beforeDelete && !afterDelete; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-343.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-343.js new file mode 100644 index 000000000..3095e6b32 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-343.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.6-4-343 +description: > + ES5 Attributes - success to update [[Writable]] attribute of data + property ([[Writable]] is true, [[Enumerable]] is false, + [[Configurable]] is true) to different value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: false, + configurable: true + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + writable: false + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc1.writable === true && obj.prop === 2010 && desc2.writable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-344.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-344.js new file mode 100644 index 000000000..d8921e120 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-344.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.6-4-344 +description: > + ES5 Attributes - success to update [[Enumerable]] attribute of + data property ([[Writable]] is true, [[Enumerable]] is false, + [[Configurable]] is true) to different value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: false, + configurable: true + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + enumerable: true + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc1.enumerable === false && obj.prop === 2010 && desc2.enumerable === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-345.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-345.js new file mode 100644 index 000000000..20c769f35 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-345.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.6-4-345 +description: > + ES5 Attributes - success to update [[Configurable]] attribute of + data property ([[Writable]] is true, [[Enumerable]] is false, + [[Configurable]] is true) to different value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: false, + configurable: true + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + configurable: false + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc1.configurable === true && obj.prop === 2010 && desc2.configurable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-346.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-346.js new file mode 100644 index 000000000..a520a5d88 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-346.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.6-4-346 +description: > + ES5 Attributes - success to update the data property ([[Writable]] + is true, [[Enumerable]] is false, [[Configurable]] is true) to an + accessor property +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: false, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + function getFunc() { + return 20; + } + Object.defineProperty(obj, "prop", { + get: getFunc + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("value") && desc2.hasOwnProperty("get"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-347.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-347.js new file mode 100644 index 000000000..a1345d679 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-347.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.6-4-347 +description: > + ES5 Attributes - property ([[Writable]] is true, [[Enumerable]] is + false, [[Configurable]] is false) is writable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: false, + configurable: false + }); + var propertyDefineCorrect = (obj.prop === 2010); + obj.prop = 1001; + + return propertyDefineCorrect && obj.prop === 1001; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-348.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-348.js new file mode 100644 index 000000000..7572ee581 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-348.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.6-4-348 +description: > + ES5 Attributes - property ([[Writable]] is true, [[Enumerable]] is + false, [[Configurable]] is false) is non-enumerable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: false, + configurable: false + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p in obj) { + if (p === "prop") { + return false; + } + } + return propertyDefineCorrect && desc.enumerable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-349.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-349.js new file mode 100644 index 000000000..c2996028c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-349.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.6-4-349 +description: > + ES5 Attributes - property ([[Writable]] is true, [[Enumerable]] is + false, [[Configurable]] is false) is undeletable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: false, + configurable: false + }); + var beforeDelete = obj.hasOwnProperty("prop"); + delete obj.prop; + var afterDelete = obj.hasOwnProperty("prop"); + return beforeDelete && obj.prop === 2010 && afterDelete; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-35.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-35.js new file mode 100644 index 000000000..38fd93306 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-35.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.6-4-35 +description: > + Object.defineProperty - 'O' is a String object which implements + its own [[GetOwnProperty]] method to access the 'name' property + (8.12.9 step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + var str = new String("abc"); + + Object.defineProperty(str, "foo", { + value: 12, + configurable: false + }); + + try { + Object.defineProperty(str, "foo", { + value: 11, + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError && str.foo === 12; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-350.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-350.js new file mode 100644 index 000000000..8b91f28d4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-350.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.6-4-350 +description: > + ES5 Attributes - fail to update [[Writable]] attribute of data + property ([[Writable]] is true, [[Enumerable]] is false, + [[Configurable]] is false) to different value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: false, + configurable: false + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + writable: false + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc1.writable === true && obj.prop === 2010 && desc2.writable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-351.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-351.js new file mode 100644 index 000000000..382cfcda9 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-351.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.6-4-351 +description: > + ES5 Attributes - fail to update [[Enumerable]] attribute of data + property ([[Writable]] is true, [[Enumerable]] is false, + [[Configurable]] is false) to different value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: false, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + enumerable: true + }); + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + return propertyDefineCorrect && desc1.enumerable === false && obj.prop === 2010 && desc2.enumerable === false && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-352.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-352.js new file mode 100644 index 000000000..844572009 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-352.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.6-4-352 +description: > + ES5 Attributes - fail to update [[Configurable]] attribute of data + property ([[Writable]] is true, [[Enumerable]] is false, + [[Configurable]] is false) to different value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: false, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + configurable: true + }); + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + return propertyDefineCorrect && desc1.configurable === false && obj.prop === 2010 && desc2.configurable === false && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-353.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-353.js new file mode 100644 index 000000000..439a296eb --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-353.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.6-4-353 +description: > + ES5 Attributes - fail to update the data property ([[Writable]] is + true, [[Enumerable]] is false, [[Configurable]] is false) to an + accessor property +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: true, + enumerable: false, + configurable: false + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + function getFunc() { + return 20; + } + try { + Object.defineProperty(obj, "prop", { + get: getFunc + }); + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + return propertyDefineCorrect && desc1.value === 2010 && obj.prop === 2010 && typeof desc2.get === "undefined" && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-354-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-1.js new file mode 100644 index 000000000..6df341a79 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-1.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.6-4-354-1 +description: > + Object.defineProperty will update [[Value]] attribute of named + property 'P' successfully when [[Configurable]] attribute is true + and [[Writable]] attribute is false, 'O' is an Object object + (8.12.9 step - Note) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "property", { + value: 1001, + writable: false, + configurable: true + }); + + Object.defineProperty(obj, "property", { + value: 1002 + }); + + return dataPropertyAttributesAreCorrect(obj, "property", 1002, false, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-354-10.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-10.js new file mode 100644 index 000000000..be6c69226 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-10.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.6-4-354-10 +description: > + Object.defineProperty will update [[Value]] attribute of indexed + property 'P' successfully when [[Configurable]] attribute is true + and [[Writable]] attribute is false, 'O' is an Object object + (8.12.9 step - Note) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "0", { + value: 1001, + writable: false, + configurable: true + }); + + Object.defineProperty(obj, "0", { + value: 1002 + }); + + return dataPropertyAttributesAreCorrect(obj, "0", 1002, false, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-354-11.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-11.js new file mode 100644 index 000000000..d93238f5f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-11.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.6-4-354-11 +description: > + Object.defineProperty will update [[Value]] attribute of named + property 'P' successfully when [[Configurable]] attribute is true + and [[Writable]] attribute is false, 'A' is an Array object + (8.12.9 step - Note) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = []; + + Object.defineProperty(obj, "prop", { + value: 1001, + writable: false, + configurable: true + }); + + Object.defineProperty(obj, "prop", { + value: 1002 + }); + + return dataPropertyAttributesAreCorrect(obj, "prop", 1002, false, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-354-12.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-12.js new file mode 100644 index 000000000..d3f8b3467 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-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.6-4-354-12 +description: > + Object.defineProperty will update [[Value]] attribute of indexed + property successfully when [[Configurable]] attribute is true and + [[Writable]] attribute is false, 'O' is an Arguments object + (8.12.9 - step Note) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = (function () { + return arguments; + }()); + + Object.defineProperty(obj, "0", { + value: 1001, + writable: false, + configurable: true + }); + + Object.defineProperty(obj, "0", { + value: 1002 + }); + + return dataPropertyAttributesAreCorrect(obj, "0", 1002, false, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-354-13.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-13.js new file mode 100644 index 000000000..3f7aece49 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-13.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.6-4-354-13 +description: > + Object.defineProperty will update [[Value]] attribute of indexed + property successfully when [[Configurable]] attribute is true and + [[Writable]] attribute is false, 'O' is the global object (8.12.9 + - step Note) +includes: + - runTestCase.js + - fnGlobalObject.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = fnGlobalObject(); + + try { + Object.defineProperty(obj, "0", { + value: 1001, + writable: false, + configurable: true + }); + + Object.defineProperty(obj, "0", { + value: 1002 + }); + + return dataPropertyAttributesAreCorrect(obj, "0", 1002, false, false, true); + } finally { + delete obj[0]; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-354-15.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-15.js new file mode 100644 index 000000000..03a93ff7f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-15.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.6-4-354-15 +description: > + Object.defineProperty - Named property 'P' with attributes + [[Writable]]: false, [[Enumerable]]: true, [[Configurable]]: true + is non-writable using simple assignment, 'A' is an Array object +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = []; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: true, + configurable: true + }); + var verifyValue = (obj.prop === 2010); + obj.prop = 1001; + + return verifyValue && obj.prop === 2010; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-354-16.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-16.js new file mode 100644 index 000000000..765de208f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-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.6-4-354-16 +description: > + ES5 Attributes - property 'P' is an indexed data property with + attributes [[Writable]]: false, [[Enumerable]]: true, + [[Configurable]] : true) is non-writable using simple assignment, + 'O' is an Arguments object +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = (function () { + return arguments; + }()); + + Object.defineProperty(obj, "0", { + value: 2010, + writable: false, + enumerable: true, + configurable: true + }); + var valueVerify = (obj[0] === 2010); + obj[0] = 1001; + + return valueVerify && obj[0] === 2010; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-354-2.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-2.js new file mode 100644 index 000000000..3719a1991 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-2.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.6-4-354-2 +description: > + Object.defineProperty will update [[Value]] attribute of indexed + property 'P' successfully when [[Configurable]] attribute is true + and [[Writable]] attribute is false, 'A' is an Array object + (8.12.9 step - Note) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = []; + + Object.defineProperty(obj, "0", { + value: 1001, + writable: false, + configurable: true + }); + + Object.defineProperty(obj, "0", { + value: 1002 + }); + + return dataPropertyAttributesAreCorrect(obj, "0", 1002, false, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-354-3.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-3.js new file mode 100644 index 000000000..f5dfce189 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-3.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.6-4-354-3 +description: > + Object.defineProperty will update [[Value]] attribute successfully + when [[Configurable]] attribute is true and [[Writable]] attribute + is false, 'O' is an Arguments object (8.12.9 - step Note) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = (function () { + return arguments; + }()); + + Object.defineProperty(obj, "property", { + value: 1001, + writable: false, + configurable: true + }); + + Object.defineProperty(obj, "property", { + value: 1002 + }); + + return dataPropertyAttributesAreCorrect(obj, "property", 1002, false, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-354-4.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-4.js new file mode 100644 index 000000000..fc5e8d4d4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-4.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.6-4-354-4 +description: > + Object.defineProperty will update [[Value]] attribute successfully + when [[Configurable]] attribute is true and [[Writable]] attribute + is false, 'O' is the global object (8.12.9 - step Note) +includes: + - runTestCase.js + - fnGlobalObject.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = fnGlobalObject(); + + try { + Object.defineProperty(obj, "property", { + value: 1001, + writable: false, + configurable: true + }); + + Object.defineProperty(obj, "property", { + value: 1002 + }); + + return dataPropertyAttributesAreCorrect(obj, "property", 1002, false, false, true); + } finally { + delete obj.property; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-354-6.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-6.js new file mode 100644 index 000000000..21fbcfc95 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-6.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.6-4-354-6 +description: > + Object.defineProperty - Indexed property 'P' with attributes + [[Writable]]: false, [[Enumerable]]: true, [[Configurable]]: true + is non-writable using simple assignment, 'A' is an Array object +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = []; + + Object.defineProperty(obj, "0", { + value: 2010, + writable: false, + enumerable: true, + configurable: true + }); + var verifyValue = (obj[0] === 2010); + obj[0] = 1001; + + return verifyValue && obj[0] === 2010; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-354-7.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-7.js new file mode 100644 index 000000000..8cfed4fc2 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-7.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.6-4-354-7 +description: > + ES5 Attributes - property 'P' with attributes [[Writable]]: false, + [[Enumerable]]: true, [[Configurable]] : true) is non-writable + using simple assignment, 'O' is an Arguments object +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = (function () { + return arguments; + }()); + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: true, + configurable: true + }); + var valueVerify = (obj.prop === 2010); + obj.prop = 1001; + + return valueVerify && obj.prop === 2010; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-354-8.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-8.js new file mode 100644 index 000000000..8c3d61e92 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-354-8.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.6-4-354-8 +description: > + ES5 Attributes - property 'P' with attributes [[Writable]]: false, + [[Enumerable]]: true, [[Configurable]]: true is non-writable using + simple assignment, 'O' is the global object +includes: + - runTestCase.js + - fnGlobalObject.js +---*/ + +function testcase() { + var obj = fnGlobalObject(); + try { + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: true, + configurable: true + }); + var valueVerify = (obj.prop === 2010); + obj.prop = 1001; + + return valueVerify && obj.prop === 2010; + } finally { + delete obj.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-354.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-354.js new file mode 100644 index 000000000..928550170 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-354.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.6-4-354 +description: > + ES5 Attributes - property ([[Writable]] is false, [[Enumerable]] + is true, [[Configurable]] is true) is unwritable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: true, + configurable: true + }); + var propertyDefineCorrect = (obj.prop === 2010); + obj.prop = 1001; + + return propertyDefineCorrect && obj.prop === 2010; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-355.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-355.js new file mode 100644 index 000000000..5c2fc05d1 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-355.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.6-4-355 +description: > + ES5 Attributes - property ([[Writable]] is false, [[Enumerable]] + is true, [[Configurable]] is true) is enumerable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: true, + configurable: true + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var property in obj) { + if (property === "prop") { + return propertyDefineCorrect && desc.enumerable === true; + } + } + return false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-356.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-356.js new file mode 100644 index 000000000..a7d1c27ba --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-356.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.6-4-356 +description: > + ES5 Attributes - property ([[Writable]] is false, [[Enumerable]] + is true, [[Configurable]] is true) is deletable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: true, + configurable: true + }); + var beforeDelete = obj.hasOwnProperty("prop"); + delete obj.prop; + var afterDelete = obj.hasOwnProperty("prop"); + return beforeDelete && !afterDelete; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-357.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-357.js new file mode 100644 index 000000000..5570996f9 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-357.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.6-4-357 +description: > + ES5 Attributes - success to update [[Writable]] attribute of data + property ([[Writable]] is false, [[Enumerable]] is true, + [[Configurable]] is true) to different value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: true, + configurable: true + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + writable: true + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc1.writable === false && obj.prop === 2010 && desc2.writable === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-358.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-358.js new file mode 100644 index 000000000..2c5f6ee0d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-358.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.6-4-358 +description: > + ES5 Attributes - success to update [[Enumerable]] attribute of + data property ([[Writable]] is false, [[Enumerable]] is true, + [[Configurable]] is true) to different value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: true, + configurable: true + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + enumerable: false + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc1.enumerable === true && obj.prop === 2010 && desc2.enumerable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-359.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-359.js new file mode 100644 index 000000000..4d0775fc7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-359.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.6-4-359 +description: > + ES5 Attributes - success to update [[Configurable]] attribute of + data property ([[Writable]] is false, [[Enumerable]] is true, + [[Configurable]] is true) to different value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: true, + configurable: true + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + configurable: false + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc1.configurable === true && obj.prop === 2010 && desc2.configurable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-36.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-36.js new file mode 100644 index 000000000..579aff566 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-36.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.6-4-36 +description: > + Object.defineProperty - 'O' is a Boolean object that uses Object's + [[GetOwnProperty]] method to access the 'name' property (8.12.9 + step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = new Boolean(true); + + Object.defineProperty(obj, "foo", { + value: 12, + configurable: false + }); + + try { + Object.defineProperty(obj, "foo", { + value: 11, + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError && obj.foo === 12; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-360-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-360-1.js new file mode 100644 index 000000000..048bcb8c7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-360-1.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.6-4-360-1 +description: > + ES5 Attributes - Updating indexed data property 'P' whose + attributes are [[Writable]]: false, [[Enumerable]]: true, + [[Configurable]]: true to an accessor property, 'A' is an Array + object (8.12.9 - step 9.b.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = []; + + Object.defineProperty(obj, "0", { + value: 2010, + writable: false, + enumerable: true, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "0"); + + function getFunc() { + return 20; + } + Object.defineProperty(obj, "0", { + get: getFunc + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "0"); + + return desc1.hasOwnProperty("value") && desc2.hasOwnProperty("get") && + desc2.enumerable === true && desc2.configurable === true && + obj[0] === 20 && typeof desc2.set === "undefined" && desc2.get === getFunc; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-360-2.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-360-2.js new file mode 100644 index 000000000..e8bd74845 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-360-2.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.6-4-360-2 +description: > + ES5 Attributes - Updating data property 'P' whose attributes are + [[Writable]]: false, [[Enumerable]]: true, [[Configurable]]: true + to an accessor property, 'O' is an Arguments object (8.12.9 - step + 9.b.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = (function () { + return arguments; + }()); + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: true, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + function getFunc() { + return 20; + } + Object.defineProperty(obj, "prop", { + get: getFunc + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("value") && desc2.hasOwnProperty("get") && + desc2.enumerable === true && desc2.configurable === true && + obj.prop === 20 && typeof desc2.set === "undefined" && desc2.get === getFunc; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-360-3.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-360-3.js new file mode 100644 index 000000000..3077e9c0d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-360-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.6-4-360-3 +description: > + ES5 Attributes - Updating data property 'P' whose attributes are + [[Writable]]: false, [[Enumerable]]: true, [[Configurable]]: true + to an accessor property, 'O' is the global object (8.12.9 - step + 9.b.i) +includes: + - runTestCase.js + - fnGlobalObject.js +---*/ + +function testcase() { + var obj = fnGlobalObject(); + try { + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: true, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + function getFunc() { + return 20; + } + Object.defineProperty(obj, "prop", { + get: getFunc + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("value") && desc2.hasOwnProperty("get") && + desc2.enumerable === true && desc2.configurable === true && + obj.prop === 20 && typeof desc2.set === "undefined" && desc2.get === getFunc; + } finally { + delete obj.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-360-5.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-360-5.js new file mode 100644 index 000000000..0f8399146 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-360-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.6-4-360-5 +description: > + ES5 Attributes - Updating named data property 'P' whose attributes + are [[Writable]]: false, [[Enumerable]]: true, [[Configurable]]: + true to an accessor property, 'A' is an Array object (8.12.9 - + step 9.b.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = []; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: true, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + function getFunc() { + return 20; + } + Object.defineProperty(obj, "prop", { + get: getFunc + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("value") && desc2.hasOwnProperty("get") && + desc2.enumerable === true && desc2.configurable === true && + obj.prop === 20 && typeof desc2.set === "undefined" && desc2.get === getFunc; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-360-6.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-360-6.js new file mode 100644 index 000000000..577a98959 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-360-6.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.6-4-360-6 +description: > + ES5 Attributes - Updating indexed data property 'P' whose + attributes are [[Writable]]: false, [[Enumerable]]: true, + [[Configurable]]: true to an accessor property, 'O' is an + Arguments object (8.12.9 - step 9.b.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = (function () { + return arguments; + }()); + + Object.defineProperty(obj, "0", { + value: 2010, + writable: false, + enumerable: true, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "0"); + + function getFunc() { + return 20; + } + Object.defineProperty(obj, "0", { + get: getFunc + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "0"); + + return desc1.hasOwnProperty("value") && desc2.hasOwnProperty("get") && + desc2.enumerable === true && desc2.configurable === true && + obj[0] === 20 && typeof desc2.set === "undefined" && desc2.get === getFunc; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-360-7.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-360-7.js new file mode 100644 index 000000000..dee88492b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-360-7.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.6-4-360-7 +description: > + ES5 Attributes - Updating indexed data property 'P' whose + attributes are [[Writable]]: false, [[Enumerable]]: true, + [[Configurable]]: true to an accessor property, 'O' is the global + object (8.12.9 - step 9.b.i) +includes: + - runTestCase.js + - fnGlobalObject.js +---*/ + +function testcase() { + var obj = fnGlobalObject(); + try { + Object.defineProperty(obj, "0", { + value: 2010, + writable: false, + enumerable: true, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "0"); + + function getFunc() { + return 20; + } + Object.defineProperty(obj, "0", { + get: getFunc + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "0"); + + return desc1.hasOwnProperty("value") && desc2.hasOwnProperty("get") && + desc2.enumerable === true && desc2.configurable === true && + obj[0] === 20 && typeof desc2.set === "undefined" && desc2.get === getFunc; + } finally { + delete obj[0]; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-360.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-360.js new file mode 100644 index 000000000..731238d04 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-360.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.6-4-360 +description: > + ES5 Attributes - success to update the data property ([[Writable]] + is false, [[Enumerable]] is true, [[Configurable]] is true) to an + accessor property +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: true, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + function getFunc() { + return 20; + } + Object.defineProperty(obj, "prop", { + get: getFunc + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("value") && desc2.hasOwnProperty("get"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-361.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-361.js new file mode 100644 index 000000000..79ec2298e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-361.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.6-4-361 +description: > + ES5 Attributes - property ([[Writable]] is false, [[Enumerable]] + is true, [[Configurable]] is false) is unwritable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: true, + configurable: false + }); + var propertyDefineCorrect = (obj.prop === 2010); + obj.prop = 1001; + + return propertyDefineCorrect && obj.prop === 2010; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-362.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-362.js new file mode 100644 index 000000000..7d8c8f150 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-362.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.6-4-362 +description: > + ES5 Attributes - property ([[Writable]] is false, [[Enumerable]] + is true, [[Configurable]] is false) is enumerable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: true, + configurable: false + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var property in obj) { + if (property === "prop") { + return propertyDefineCorrect && desc.enumerable === true; + } + } + return false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-363.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-363.js new file mode 100644 index 000000000..85d87f129 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-363.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.6-4-363 +description: > + ES5 Attributes - property ([[Writable]] is false, [[Enumerable]] + is true, [[Configurable]] is false) is undeletable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: true, + configurable: false + }); + var beforeDelete = obj.hasOwnProperty("prop"); + delete obj.prop; + var afterDelete = obj.hasOwnProperty("prop"); + return beforeDelete && obj.prop === 2010 && afterDelete; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-364.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-364.js new file mode 100644 index 000000000..15b82bc3b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-364.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.6-4-364 +description: > + ES5 Attributes - fail to update [[Writable]] attribute of data + property ([[Writable]] is false, [[Enumerable]] is true, + [[Configurable]] is false) to different value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: true, + configurable: false + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + try { + Object.defineProperty(obj, "prop", { + writable: true + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc1.writable === false && obj.prop === 2010 && desc2.writable === false && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-365.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-365.js new file mode 100644 index 000000000..1819daad5 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-365.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.6-4-365 +description: > + ES5 Attributes - fail to update [[Enumerable]] attribute of data + property ([[Writable]] is false, [[Enumerable]] is true, + [[Configurable]] is false) to different value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: true, + configurable: false + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + try { + Object.defineProperty(obj, "prop", { + enumerable: false + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc1.enumerable === true && obj.prop === 2010 && desc2.enumerable === true && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-366.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-366.js new file mode 100644 index 000000000..94022c0f6 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-366.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.6-4-366 +description: > + ES5 Attributes - fail to update [[Configurable]] attribute of data + property ([[Writable]] is false, [[Enumerable]] is true, + [[Configurable]] is false) to different value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: true, + configurable: false + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + try { + Object.defineProperty(obj, "prop", { + configurable: true + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc1.configurable === false && obj.prop === 2010 && desc2.configurable === false && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-367.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-367.js new file mode 100644 index 000000000..7c05ae9e2 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-367.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.6-4-367 +description: > + ES5 Attributes - fail to update the data property ([[Writable]] is + false, [[Enumerable]] is true, [[Configurable]] is false) to an + accessor property +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: true, + configurable: false + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + function getFunc() { + return 20; + } + try { + Object.defineProperty(obj, "prop", { + get: getFunc + }); + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + return propertyDefineCorrect && desc1.value === 2010 && obj.prop === 2010 && typeof desc2.get === "undefined" && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-368.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-368.js new file mode 100644 index 000000000..3b2d1fb08 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-368.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.6-4-368 +description: > + ES5 Attributes - property ([[Writable]] is false, [[Enumerable]] + is false, [[Configurable]] is true) is unwritable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: false, + configurable: true + }); + var propertyDefineCorrect = (obj.prop === 2010); + obj.prop = 1001; + + return propertyDefineCorrect && obj.prop === 2010; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-369.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-369.js new file mode 100644 index 000000000..3c9ce77e9 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-369.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.6-4-369 +description: > + ES5 Attributes - property ([[Writable]] is false, [[Enumerable]] + is false, [[Configurable]] is true) is non-enumerable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: false, + configurable: true + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p in obj) { + if (p === "prop") { + return false; + } + } + return propertyDefineCorrect && desc.enumerable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-37.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-37.js new file mode 100644 index 000000000..ba28df25a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-37.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.6-4-37 +description: > + Object.defineProperty - 'O' is a Number object that uses Object's + [[GetOwnProperty]] method to access the 'name' property (8.12.9 + step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = new Number(-2); + + Object.defineProperty(obj, "foo", { + value: 12, + configurable: false + }); + + try { + Object.defineProperty(obj, "foo", { + value: 11, + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError && obj.foo === 12; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-370.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-370.js new file mode 100644 index 000000000..33122718c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-370.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.6-4-370 +description: > + ES5 Attributes - property ([[Writable]] is false, [[Enumerable]] + is false, [[Configurable]] is true) is deletable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: false, + configurable: true + }); + var beforeDelete = obj.hasOwnProperty("prop"); + delete obj.prop; + var afterDelete = obj.hasOwnProperty("prop"); + return beforeDelete && !afterDelete; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-371.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-371.js new file mode 100644 index 000000000..990a6e44b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-371.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.6-4-371 +description: > + ES5 Attributes - success to update [[Writable]] attribute of data + property ([[Writable]] is false, [[Enumerable]] is false, + [[Configurable]] is true) to different value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: false, + configurable: true + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + writable: true + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc1.writable === false && obj.prop === 2010 && desc2.writable === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-372.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-372.js new file mode 100644 index 000000000..0428495e0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-372.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.6-4-372 +description: > + ES5 Attributes - success to update [[Enumerable]] attribute of + data property ([[Writable]] is false, [[Enumerable]] is false, + [[Configurable]] is true) to different value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: false, + configurable: true + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + enumerable: true + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc1.enumerable === false && obj.prop === 2010 && desc2.enumerable === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-373.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-373.js new file mode 100644 index 000000000..4d0b945e4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-373.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.6-4-373 +description: > + ES5 Attributes - success to update [[Configurable]] attribute of + data property ([[Writable]] is false, [[Enumerable]] is false, + [[Configurable]] is true) to different value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: false, + configurable: true + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + configurable: false + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc1.configurable === true && obj.prop === 2010 && desc2.configurable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-374.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-374.js new file mode 100644 index 000000000..428ced7a0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-374.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.6-4-374 +description: > + ES5 Attributes - success to update the data property ([[Writable]] + is false, [[Enumerable]] is false, [[Configurable]] is true) to an + accessor property +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: false, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + function getFunc() { + return 20; + } + Object.defineProperty(obj, "prop", { + get: getFunc + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("value") && desc2.get === getFunc; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-375.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-375.js new file mode 100644 index 000000000..003d4cdfc --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-375.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.6-4-375 +description: > + ES5 Attributes - property ([[Writable]] is false, [[Enumerable]] + is false, [[Configurable]] is false) is unwritable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: false, + configurable: false + }); + var propertyDefineCorrect = (obj.prop === 2010); + obj.prop = 1001; + + return propertyDefineCorrect && obj.prop === 2010; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-376.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-376.js new file mode 100644 index 000000000..b0212432b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-376.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.6-4-376 +description: > + ES5 Attributes - property ([[Writable]] is false, [[Enumerable]] + is false, [[Configurable]] is false) is non-enumerable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: false, + configurable: false + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p in obj) { + if (p === "prop") { + return false; + } + } + return propertyDefineCorrect && desc.enumerable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-377.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-377.js new file mode 100644 index 000000000..9a0819298 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-377.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.6-4-377 +description: > + ES5 Attributes - property ([[Writable]] is false, [[Enumerable]] + is false, [[Configurable]] is false) is undeletable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: false, + configurable: false + }); + var beforeDelete = obj.hasOwnProperty("prop"); + delete obj.prop; + var afterDelete = obj.hasOwnProperty("prop"); + return beforeDelete && obj.prop === 2010 && afterDelete; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-378.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-378.js new file mode 100644 index 000000000..747eaca73 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-378.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.6-4-378 +description: > + ES5 Attributes - fail to update [[Writable]] attribute of data + property ([[Writable]] is false, [[Enumerable]] is false, + [[Configurable]] is false) to different value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: false, + configurable: false + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + writable: true + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc1.writable === false && obj.prop === 2010 && desc2.writable === false && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-379.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-379.js new file mode 100644 index 000000000..3e13a1cfd --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-379.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.6-4-379 +description: > + ES5 Attributes - fail to update [[Enumerable]] attribute of data + property ([[Writable]] is false, [[Enumerable]] is false, + [[Configurable]] is false) to different value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: false, + configurable: false + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + try { + Object.defineProperty(obj, "prop", { + enumerable: true + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc1.enumerable === false && obj.prop === 2010 && desc2.enumerable === false && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-38.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-38.js new file mode 100644 index 000000000..ed21f8542 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-38.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.6-4-38 +description: > + Object.defineProperty - 'O' is the Math object that uses Object's + [[GetOwnProperty]] method to access the 'name' property (8.12.9 + step 1) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + try { + Object.defineProperty(Math, "foo", { + value: 12, + configurable: true + }); + + return dataPropertyAttributesAreCorrect(Math, "foo", 12, false, false, true); + } finally { + delete Math.foo; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-380.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-380.js new file mode 100644 index 000000000..96b15decb --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-380.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.6-4-380 +description: > + ES5 Attributes - fail to update [[Configurable]] attribute of data + property ([[Writable]] is false, [[Enumerable]] is false, + [[Configurable]] is false) to different value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: false, + configurable: false + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + configurable: true + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc1.configurable === false && obj.prop === 2010 && desc2.configurable === false && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-381.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-381.js new file mode 100644 index 000000000..d6f865f01 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-381.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.6-4-381 +description: > + ES5 Attributes - fail to update the data property ([[Writable]] is + false, [[Enumerable]] is false, [[Configurable]] is false) to an + accessor property +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 2010, + writable: false, + enumerable: false, + configurable: false + }); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + function getFunc() { + return 20; + } + try { + Object.defineProperty(obj, "prop", { + get: getFunc + }); + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + return propertyDefineCorrect && desc1.value === 2010 && obj.prop === 2010 && typeof desc2.get === "undefined" && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-382.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-382.js new file mode 100644 index 000000000..0838cbb57 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-382.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.6-4-382 +description: ES5 Attributes - [[Value]] attribute of data property is a number +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: 1001 + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.prop === 1001 && desc.value === 1001; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-383.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-383.js new file mode 100644 index 000000000..9d8536283 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-383.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.6-4-383 +description: ES5 Attributes - [[Value]] attribute of data property is a string +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: "ThisIsAString" + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.prop === "ThisIsAString" && desc.value === "ThisIsAString"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-384.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-384.js new file mode 100644 index 000000000..b196bb124 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-384.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.6-4-384 +description: ES5 Attributes - [[Value]] attribute of data property is a boolean +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: false + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.prop === false && desc.value === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-385.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-385.js new file mode 100644 index 000000000..1445d46f4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-385.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.6-4-385 +description: > + ES5 Attributes - [[Value]] attribute of data property is a generic + object +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var tempObj = { testproperty: 100 }; + + Object.defineProperty(obj, "prop", { + value: tempObj + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.prop === tempObj && desc.value === tempObj; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-386.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-386.js new file mode 100644 index 000000000..aed8b6f48 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-386.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.6-4-386 +description: > + ES5 Attributes - [[Value]] attribute of data property is an Array + object +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var arrObj = []; + + Object.defineProperty(obj, "prop", { + value: arrObj + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.prop === arrObj && desc.value === arrObj; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-387.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-387.js new file mode 100644 index 000000000..6a397026d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-387.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.6-4-387 +description: > + ES5 Attributes - [[Value]] attribute of data property is a String + object +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var strObj = new String(); + + Object.defineProperty(obj, "prop", { + value: strObj + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.prop === strObj && desc.value === strObj; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-388.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-388.js new file mode 100644 index 000000000..788c93ce5 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-388.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.6-4-388 +description: > + ES5 Attributes - [[Value]] attribute of data property is a Number + object +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var numObj = new Number(); + + Object.defineProperty(obj, "prop", { + value: numObj + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.prop === numObj && desc.value === numObj; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-389.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-389.js new file mode 100644 index 000000000..b066e1b47 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-389.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.6-4-389 +description: > + ES5 Attributes - [[Value]] attribute of data property is a Boolean + Object +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var boolObj = new Boolean(); + + Object.defineProperty(obj, "prop", { + value: boolObj + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.prop === boolObj && desc.value === boolObj; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-39.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-39.js new file mode 100644 index 000000000..4468b9da3 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-39 +description: > + Object.defineProperty - 'O' is a Date object that uses Object's + [[GetOwnProperty]] method to access the 'name' property (8.12.9 + step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = new Date(); + + Object.defineProperty(desc, "foo", { + value: 12, + configurable: false + }); + + try { + Object.defineProperty(desc, "foo", { + value: 11, + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError && desc.foo === 12; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-390.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-390.js new file mode 100644 index 000000000..64e26f075 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-390.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.6-4-390 +description: > + ES5 Attributes - [[Value]] attribute of data property is a + Function object +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var funObj = function () { }; + + Object.defineProperty(obj, "prop", { + value: funObj + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.prop === funObj && desc.value === funObj; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-391.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-391.js new file mode 100644 index 000000000..44947b38e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-391.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.6-4-391 +description: > + ES5 Attributes - [[Value]] attribute of data property is an Error + object +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var errObj = new Error(); + + Object.defineProperty(obj, "prop", { + value: errObj + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.prop === errObj && desc.value === errObj; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-392.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-392.js new file mode 100644 index 000000000..ce1909bf6 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-392.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.6-4-392 +description: > + ES5 Attributes - [[Value]] attribute of data property is a Date + object +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var dateObj = new Date(); + + Object.defineProperty(obj, "prop", { + value: dateObj + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.prop === dateObj && desc.value === dateObj; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-393.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-393.js new file mode 100644 index 000000000..2edd5dcc9 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-393.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.6-4-393 +description: > + ES5 Attributes - [[Value]] attribute of data property is a RegExp + object +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var regObj = new RegExp(); + + Object.defineProperty(obj, "prop", { + value: regObj + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.prop === regObj && desc.value === regObj; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-394.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-394.js new file mode 100644 index 000000000..e600e04af --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-394.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.6-4-394 +description: ES5 Attributes - [[Value]] attribute of data property is undefined +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: undefined + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.hasOwnProperty("prop") && typeof obj.prop === "undefined" && typeof desc.value === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-395.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-395.js new file mode 100644 index 000000000..1208bebd7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-395.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.6-4-395 +description: ES5 Attributes - [[Value]] attribute of data property is null +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: null + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.prop === null && desc.value === null; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-396.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-396.js new file mode 100644 index 000000000..4e8a11c36 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-396.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.6-4-396 +description: ES5 Attributes - [[Value]] attribute of data property is NaN +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: NaN + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.prop !== obj.prop && desc.value !== desc.value; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-397.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-397.js new file mode 100644 index 000000000..aa909d9ed --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-397.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.6-4-397 +description: ES5 Attributes - [[Value]] attribute of data property is Infinity +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: Infinity + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.prop === Infinity && desc.value === Infinity; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-398.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-398.js new file mode 100644 index 000000000..ad82c3f94 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-398.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.6-4-398 +description: ES5 Attributes - [[Value]] attribute of data property is -Infinity +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: -Infinity + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.prop === -Infinity && desc.value === -Infinity; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-399.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-399.js new file mode 100644 index 000000000..08b047fd0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-399.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.6-4-399 +description: > + ES5 Attributes - [[Value]] attribute of data property is the + global object +includes: + - runTestCase.js + - fnGlobalObject.js +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + value: fnGlobalObject() + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.prop === fnGlobalObject() && desc.value === fnGlobalObject(); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-4.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-4.js new file mode 100644 index 000000000..2c521f901 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-4.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. + +/*--- +info: > + Step 4 of defineProperty calls the [[DefineOwnProperty]] internal method + of O to define the property. For newly defined properties, step 4.a.1 of + [[DefineOwnProperty]] creates a data property if handed a generic desc. +es5id: 15.2.3.6-4-4 +description: > + Object.defineProperty defines a data property if given a generic + desc(8.12.9 step 4.a.i) +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + var desc = {}; + Object.defineProperty(o, "foo", desc); + + var propDesc = Object.getOwnPropertyDescriptor(o, "foo"); + if (propDesc.value === undefined && // this is the value that was set + propDesc.writable === false && // false by default + propDesc.enumerable === false && // false by default + propDesc.configurable === false) { // false by default + return true; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-40.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-40.js new file mode 100644 index 000000000..0ed4df549 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-40.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.6-4-40 +description: > + Object.defineProperty - 'O' is a RegExp object that uses Object's + [[GetOwnProperty]] method to access the 'name' property (8.12.9 + step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = new RegExp(); + + Object.defineProperty(desc, "foo", { + value: 12, + configurable: false + }); + + try { + Object.defineProperty(desc, "foo", { + value: 11, + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError && desc.foo === 12; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-402.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-402.js new file mode 100644 index 000000000..738322542 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-402.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.6-4-402 +description: > + ES5 Attributes - [[Value]] attribute of inherited property of + [[Prototype]] internal property is correct (String instance) +includes: [runTestCase.js] +---*/ + +function testcase() { + try { + Object.defineProperty(String.prototype, "prop", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + var strObj = new String(); + + return !strObj.hasOwnProperty("prop") && strObj.prop === 1001; + } finally { + delete String.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-403.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-403.js new file mode 100644 index 000000000..4b31b066d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-403.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.6-4-403 +description: > + ES5 Attributes - Successfully add a property to an object when the + object's prototype has a property with same name and [[Writable]] + attribute is set to true (Array instance) +includes: [runTestCase.js] +---*/ + +function testcase() { + try { + Object.defineProperty(Array.prototype, "prop", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + var arrObj = []; + arrObj.prop = 1002; + + return arrObj.hasOwnProperty("prop") && arrObj.prop === 1002; + } finally { + delete Array.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-404.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-404.js new file mode 100644 index 000000000..dc23d169a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-404.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.6-4-404 +description: > + ES5 Attributes - Inherited property whose [[Enumerable]] attribute + is set to true is enumerable (Boolean instance) +includes: [runTestCase.js] +---*/ + +function testcase() { + try { + Object.defineProperty(Boolean.prototype, "prop", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + var boolObj = new Boolean(); + + var verifyEnumerable = false; + for (var p in boolObj) { + if (p === "prop") { + verifyEnumerable = true; + } + } + + return !boolObj.hasOwnProperty("prop") && verifyEnumerable; + } finally { + delete Boolean.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-405.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-405.js new file mode 100644 index 000000000..4a8308f4f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-405.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.6-4-405 +description: > + ES5 Attributes - Failed to add a property to an object when the + object's object has a property with same name and [[Writable]] + attribute is set to false (Number instance) +includes: [runTestCase.js] +---*/ + +function testcase() { + try { + Object.defineProperty(Number.prototype, "prop", { + value: 1001, + writable: false, + enumerable: false, + configurable: true + }); + var numObj = new Number(); + numObj.prop = 1002; + + return !numObj.hasOwnProperty("prop") && numObj.prop === 1001; + } finally { + delete Number.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-406.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-406.js new file mode 100644 index 000000000..f13cfdfea --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-406.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.6-4-406 +description: > + ES5 Attributes - Inherited property whose [[Enumerable]] attribute + is set to false is non-enumerable (Function instance) +includes: [runTestCase.js] +---*/ + +function testcase() { + try { + Object.defineProperty(Function.prototype, "prop", { + value: 1001, + writable: false, + enumerable: false, + configurable: true + }); + var funObj = function () { }; + + var verifyEnumerable = false; + for (var p in funObj) { + if (p === "prop") { + verifyEnumerable = true; + } + } + + return !funObj.hasOwnProperty("prop") && !verifyEnumerable; + } finally { + delete Function.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-407.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-407.js new file mode 100644 index 000000000..3cb71e564 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-407.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.6-4-407 +description: > + ES5 Attributes - [[Value]] attribute of inherited property of + [[Prototype]] internal property is correct (Error Instance) +includes: [runTestCase.js] +---*/ + +function testcase() { + try { + Object.defineProperty(Error.prototype, "prop", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + var errObj = new Error(); + + return !errObj.hasOwnProperty("prop") && errObj.prop === 1001; + } finally { + delete Error.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-408.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-408.js new file mode 100644 index 000000000..0c2dd72fe --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-408.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.6-4-408 +description: > + ES5 Attributes - Successfully add a property to an object when the + object's prototype has a property with same name and [[Writable]] + attribute is set to true (Date instance) +includes: [runTestCase.js] +---*/ + +function testcase() { + try { + Object.defineProperty(Date.prototype, "prop", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + var dateObj = new Date(); + dateObj.prop = 1002; + + return dateObj.hasOwnProperty("prop") && dateObj.prop === 1002; + } finally { + delete Date.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-409.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-409.js new file mode 100644 index 000000000..4c6b876f3 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-409.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.6-4-409 +description: > + ES5 Attributes - Inherited property whose [[Enumerable]] attribute + is set to false is enumerable (RegExp instance) +includes: [runTestCase.js] +---*/ + +function testcase() { + try { + Object.defineProperty(RegExp.prototype, "prop", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + var regObj = new RegExp(); + + var verifyEnumerable = false; + for (var p in regObj) { + if (p === "prop") { + verifyEnumerable = true; + } + } + + return !regObj.hasOwnProperty("prop") && verifyEnumerable; + } finally { + delete RegExp.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-41.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-41.js new file mode 100644 index 000000000..895eeff91 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-41 +description: > + Object.defineProperty - 'O' is the JSON object that uses Object's + [[GetOwnProperty]] method to access the 'name' property (8.12.9 + step 1) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + try { + Object.defineProperty(JSON, "foo", { + value: 12, + configurable: true + }); + + return dataPropertyAttributesAreCorrect(JSON, "foo", 12, false, false, true); + } finally { + delete JSON.foo; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-410.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-410.js new file mode 100644 index 000000000..7f0a26713 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-410.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.6-4-410 +description: > + ES5 Attributes - Failed to add a property to an object when the + object's prototype has a property with the same name and + [[Writable]] set to false (JSON) +includes: [runTestCase.js] +---*/ + +function testcase() { + try { + Object.defineProperty(Object.prototype, "prop", { + value: 1001, + writable: false, + enumerable: false, + configurable: true + }); + JSON.prop = 1002; + + return !JSON.hasOwnProperty("prop") && JSON.prop === 1001; + } finally { + delete Object.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-411.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-411.js new file mode 100644 index 000000000..7e68e4491 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-411.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.6-4-411 +description: > + ES5 Attributes - Inherited property whose [[Enumerable]] attribute + is set to false is non-enumerable (Math) +includes: [runTestCase.js] +---*/ + +function testcase() { + try { + Object.defineProperty(Object.prototype, "prop", { + value: 1001, + writable: false, + enumerable: false, + configurable: true + }); + + var verifyEnumerable = false; + for (var p in Math) { + if (p === "prop") { + verifyEnumerable = true; + } + } + + return !Math.hasOwnProperty("prop") && !verifyEnumerable; + } finally { + delete Object.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-412.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-412.js new file mode 100644 index 000000000..08b905e1d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-412.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.6-4-412 +description: > + ES5 Attributes - [[Value]] field of inherited property of + [[Prototype]] internal property is correct(Object.create) +includes: [runTestCase.js] +---*/ + +function testcase() { + var appointment = {}; + + Object.defineProperty(appointment, "startTime", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + Object.defineProperty(appointment, "name", { + value: "NAME", + writable: true, + enumerable: true, + configurable: true + }); + + var meeting = Object.create(appointment); + Object.defineProperty(meeting, "conferenceCall", { + value: "In-person meeting", + writable: true, + enumerable: true, + configurable: true + }); + + var teamMeeting = Object.create(meeting); + + var hasOwnProperty = !teamMeeting.hasOwnProperty("name") && + !teamMeeting.hasOwnProperty("startTime") && + !teamMeeting.hasOwnProperty('conferenceCall'); + + return hasOwnProperty && teamMeeting.name === "NAME" && + teamMeeting.startTime === 1001 && + teamMeeting.conferenceCall === "In-person meeting"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-413.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-413.js new file mode 100644 index 000000000..454faaf5c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-413.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.6-4-413 +description: > + ES5 Attributes - Successfully add a property to an object when the + object's prototype has a property with the same name and + [[Writable]] set to true (Object.create) +includes: [runTestCase.js] +---*/ + +function testcase() { + var appointment = {}; + + Object.defineProperty(appointment, "startTime", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + Object.defineProperty(appointment, "name", { + value: "NAME", + writable: true, + enumerable: true, + configurable: true + }); + + var meeting = Object.create(appointment); + Object.defineProperty(meeting, "conferenceCall", { + value: "In-person meeting", + writable: true, + enumerable: true, + configurable: true + }); + + var teamMeeting = Object.create(meeting); + teamMeeting.name = "Team Meeting"; + var dateObj = new Date("10/31/2010 08:00"); + teamMeeting.startTime = dateObj; + teamMeeting.conferenceCall = "4255551212"; + + var hasOwnProperty = teamMeeting.hasOwnProperty("name") && + teamMeeting.hasOwnProperty("startTime") && + teamMeeting.hasOwnProperty('conferenceCall'); + + return hasOwnProperty && teamMeeting.name === "Team Meeting" && + teamMeeting.startTime === dateObj && + teamMeeting.conferenceCall === "4255551212"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-414.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-414.js new file mode 100644 index 000000000..478ea974c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-414.js @@ -0,0 +1,62 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.6-4-414 +description: > + ES5 Attributes - Inherited property whose [[Enumerable]] attribute + is set to true is enumerable (Object.create) +includes: [runTestCase.js] +---*/ + +function testcase() { + var appointment = new Object(); + + Object.defineProperty(appointment, "startTime", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + Object.defineProperty(appointment, "name", { + value: "NAME", + writable: true, + enumerable: true, + configurable: true + }); + + var meeting = Object.create(appointment); + Object.defineProperty(meeting, "conferenceCall", { + value: "In-person meeting", + writable: true, + enumerable: true, + configurable: true + }); + + var teamMeeting = Object.create(meeting); + + var verifyTimeProp = false; + var verifyNameProp = false; + var verifyCallProp = false; + for (var p in teamMeeting) { + if (p === "startTime") { + verifyTimeProp = true; + } + if (p === "name") { + verifyNameProp = true; + } + if (p === "conferenceCall") { + verifyCallProp = true; + } + } + + var hasOwnProperty = !teamMeeting.hasOwnProperty("name") && + !teamMeeting.hasOwnProperty("startTime") && + !teamMeeting.hasOwnProperty("conferenceCall"); + + return hasOwnProperty && verifyTimeProp && verifyNameProp && verifyCallProp; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-415.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-415.js new file mode 100644 index 000000000..a94009512 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-415.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.6-4-415 +description: > + ES5 Attributes - Failed to add properties to an object when the + object's prototype has properties with the same name and + [[Writable]] set to false (Object.create) +includes: [runTestCase.js] +---*/ + +function testcase() { + var appointment = new Object(); + + Object.defineProperty(appointment, "startTime", { + value: 1001, + writable: false, + enumerable: false, + configurable: true + }); + Object.defineProperty(appointment, "name", { + value: "NAME", + writable: false, + enumerable: false, + configurable: true + }); + + var meeting = Object.create(appointment); + Object.defineProperty(meeting, "conferenceCall", { + value: "In-person meeting", + writable: false, + enumerable: false, + configurable: true + }); + + var teamMeeting = Object.create(meeting); + teamMeeting.name = "Team Meeting"; + var dateObj = new Date("10/31/2010 08:00"); + teamMeeting.startTime = dateObj; + teamMeeting.conferenceCall = "4255551212"; + + var hasOwnProperty = !teamMeeting.hasOwnProperty("name") && + !teamMeeting.hasOwnProperty("startTime") && + !teamMeeting.hasOwnProperty('conferenceCall'); + + return hasOwnProperty && teamMeeting.name === "NAME" && + teamMeeting.startTime === 1001 && + teamMeeting.conferenceCall === "In-person meeting"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-416.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-416.js new file mode 100644 index 000000000..c637139aa --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-416.js @@ -0,0 +1,62 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.6-4-416 +description: > + ES5 Attributes - Inherited properties whose [[Enumerable]] + attribute is set to false is non-enumerable (Object.create) +includes: [runTestCase.js] +---*/ + +function testcase() { + var appointment = {}; + + Object.defineProperty(appointment, "startTime", { + value: 1001, + writable: false, + enumerable: false, + configurable: true + }); + Object.defineProperty(appointment, "name", { + value: "NAME", + writable: false, + enumerable: false, + configurable: true + }); + + var meeting = Object.create(appointment); + Object.defineProperty(meeting, "conferenceCall", { + value: "In-person meeting", + writable: false, + enumerable: false, + configurable: true + }); + + var teamMeeting = Object.create(meeting); + + var verifyTimeProp = false; + var verifyNameProp = false; + var verifyCallProp = false; + for (var p in teamMeeting) { + if (p === "startTime") { + verifyTimeProp = true; + } + if (p === "name") { + verifyNameProp = true; + } + if (p === "conferenceCall") { + verifyCallProp = true; + } + } + + var hasOwnProperty = !teamMeeting.hasOwnProperty("name") && + !teamMeeting.hasOwnProperty("startTime") && + !teamMeeting.hasOwnProperty("conferenceCall"); + + return hasOwnProperty && !verifyTimeProp && !verifyNameProp && !verifyCallProp; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-417.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-417.js new file mode 100644 index 000000000..df05c133a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-417.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.6-4-417 +description: > + ES5 Attributes - [[Value]] attribute of inherited property of + [[Prototype]] internal property is correct(Function.prototype.bind) +includes: [runTestCase.js] +---*/ + +function testcase() { + var foo = function () { }; + try { + Object.defineProperty(Function.prototype, "prop", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + + var obj = foo.bind({}); + + return !obj.hasOwnProperty("prop") && obj.prop === 1001; + } finally { + delete Function.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-418.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-418.js new file mode 100644 index 000000000..f5f789a4a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-418.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.6-4-418 +description: > + ES5 Attributes - Successfully add a property to an object when the + object's prototype has a property with the same name and + [[Writable]] set to true (Function.prototype.bind) +includes: [runTestCase.js] +---*/ + +function testcase() { + var foo = function () { }; + try { + Object.defineProperty(Function.prototype, "prop", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + + var obj = foo.bind({}); + obj.prop = 1002; + + return obj.hasOwnProperty("prop") && obj.prop === 1002; + } finally { + delete Function.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-419.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-419.js new file mode 100644 index 000000000..3122c68f7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-419.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.6-4-419 +description: > + ES5 Attributes - Inherited property whose [[Enumerable]] attribute + is set to true is enumerable (Function.prototype.bind) +includes: [runTestCase.js] +---*/ + +function testcase() { + var foo = function () { }; + try { + Object.defineProperty(Function.prototype, "prop", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + + var obj = foo.bind({}); + var verifyEnumerable = false; + for (var p in obj) { + if (p === "prop") { + verifyEnumerable = true; + } + } + + return !obj.hasOwnProperty("prop") && verifyEnumerable; + } finally { + delete Function.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-42.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-42.js new file mode 100644 index 000000000..bec9abc58 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-42.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.6-4-42 +description: > + Object.defineProperty - 'O' is an Error object that uses Object's + [[GetOwnProperty]] method to access the 'name' property (8.12.9 + step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = new Error(); + + Object.defineProperty(desc, "foo", { + value: 12, + configurable: false + }); + + try { + Object.defineProperty(desc, "foo", { + value: 11, + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError && desc.foo === 12; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-420.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-420.js new file mode 100644 index 000000000..a24612f20 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-420.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.6-4-420 +description: > + ES5 Attributes - Failed to add a property to an object when the + object's prototype has a property with the same name and + [[Writable]] set to false(Function.prototype.bind) +includes: [runTestCase.js] +---*/ + +function testcase() { + var foo = function () { }; + try { + Object.defineProperty(Function.prototype, "prop", { + value: 1001, + writable: false, + enumerable: false, + configurable: true + }); + + var obj = foo.bind({}); + obj.prop = 1002; + + return !obj.hasOwnProperty("prop") && obj.prop === 1001; + } finally { + delete Function.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-421.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-421.js new file mode 100644 index 000000000..eb630ed4c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-421.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.6-4-421 +description: > + ES5 Attributes - Inherited property whose [[Enumerable]] attribute + is set to false is non-enumerable (Function.prototype.bind) +includes: [runTestCase.js] +---*/ + +function testcase() { + var foo = function () { }; + try { + Object.defineProperty(Function.prototype, "prop", { + value: 1001, + writable: false, + enumerable: false, + configurable: true + }); + + var obj = foo.bind({}); + var verifyEnumerable = false; + for (var p in obj) { + if (p === "prop") { + verifyEnumerable = true; + } + } + + return !obj.hasOwnProperty("prop") && !verifyEnumerable; + } finally { + delete Function.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-422.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-422.js new file mode 100644 index 000000000..7573daa6e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-422.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.6-4-422 +description: > + ES5 Attributes - [[Get]] attribute of accessor property ([[Get]] + is undefined, [[Set]] is undefined, [[Enumerable]] is true, + [[Configurable]] is true) is undefined +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: true, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && typeof desc.get === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-423.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-423.js new file mode 100644 index 000000000..33360568e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-423.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.6-4-423 +description: > + ES5 Attributes - [[Set]] attribute of accessor property ([[Get]] + is undefined, [[Set]] is undefined, [[Enumerable]] is true, + [[Configurable]] is true) is undefined +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: true, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && typeof desc.set === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-424.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-424.js new file mode 100644 index 000000000..82242bf59 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-424.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.6-4-424 +description: > + ES5 Attributes - property ([[Get]] is undefined, [[Set]] is + undefined, [[Enumerable]] is true, [[Configurable]] is true) is + enumerable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: true, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + for (var p in obj) { + if (p === "prop") { + return propertyDefineCorrect && desc.enumerable === true; + } + } + + return false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-425.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-425.js new file mode 100644 index 000000000..fcb00fb2a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-425.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.6-4-425 +description: > + ES5 Attributes - property ([[Get]] is undefined, [[Set]] is + undefined, [[Enumerable]] is true, [[Configurable]] is true) is + deletable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: true, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + delete obj.prop; + + return propertyDefineCorrect && desc.configurable === true && !obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-426.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-426.js new file mode 100644 index 000000000..6b91cbb13 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-426.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.6-4-426 +description: > + ES5 Attributes - success to update [[Get]] attribute of accessor + property ([[Get]] is undefined, [[Set]] is undefined, + [[Enumerable]] is true, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: true, + configurable: true + }); + + var result1 = typeof obj.prop === "undefined"; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + get: getFunc + }); + + var result2 = obj.prop === 1001; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return result1 && result2 && typeof desc1.get === "undefined" && desc2.get === getFunc; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-427.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-427.js new file mode 100644 index 000000000..7d4f5b8d4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-427.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.6-4-427 +description: > + ES5 Attributes - success to update [[Set]] attribute of accessor + property ([[Get]] is undefined, [[Set]] is undefined, + [[Enumerable]] is true, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: true, + configurable: true + }); + + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + set: setFunc + }); + + obj.prop = "overrideData"; + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && typeof desc1.set === "undefined" && desc2.set === setFunc && verifySetFunc === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-428.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-428.js new file mode 100644 index 000000000..efe78cf4f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-428.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.6-4-428 +description: > + ES5 Attributes - success to update [[Enumerable]] attribute of + accessor property ([[Get]] is undefined, [[Set]] is undefined, + [[Enumerable]] is true, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: true, + configurable: true + }); + var result1 = false; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p1 in obj) { + if (p1 === "prop") { + result1 = true; + } + } + + Object.defineProperty(obj, "prop", { + enumerable: false + }); + var result2 = false; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p2 in obj) { + if (p2 === "prop") { + result2 = true; + } + } + + return result1 && !result2 && desc1.enumerable === true && desc2.enumerable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-429.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-429.js new file mode 100644 index 000000000..2b5d02d37 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-429.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.6-4-429 +description: > + ES5 Attributes - success to update [[Configurable]] attribute of + accessor property ([[Get]] is undefined, [[Set]] is undefined, + [[Enumerable]] is true, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: true, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + configurable: false + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + delete obj.prop; + + return desc1.configurable === true && desc2.configurable === false && obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-43.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-43.js new file mode 100644 index 000000000..f09a8958a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-43.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.6-4-43 +description: > + Object.defineProperty - 'O' is an Arguments object which + implements its own [[GetOwnProperty]] method to access the 'name' + property (8.12.9 step 1) +includes: [runTestCase.js] +---*/ + +function testcase() { + var argObj = (function () { return arguments; })(); + + Object.defineProperty(argObj, "foo", { + value: 12, + configurable: false + }); + + try { + Object.defineProperty(argObj, "foo", { + value: 11, + configurable: true + }); + return false; + } catch (e) { + return e instanceof TypeError && argObj.foo === 12; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-430.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-430.js new file mode 100644 index 000000000..63c0ca51b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-430.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.6-4-430 +description: > + ES5 Attributes - success to update the accessor property ([[Get]] + is undefined, [[Set]] is undefined, [[Enumerable]] is true, + [[Configurable]] is true) to a data property +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: true, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + value: 1001 + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("get") && desc2.hasOwnProperty("value"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-431.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-431.js new file mode 100644 index 000000000..c3a0c23ed --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-431.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.6-4-431 +description: > + ES5 Attributes - [[Get]] attribute of accessor property ([[Get]] + is undefined, [[Set]] is undefined, [[Enumerable]] is true, + [[Configurable]] is false) is undefined +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: true, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && typeof desc.get === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-432.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-432.js new file mode 100644 index 000000000..1ad6a7a48 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-432.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.6-4-432 +description: > + ES5 Attributes - [[Set]] attribute of accessor property ([[Get]] + is undefined, [[Set]] is undefined, [[Enumerable]] is true, + [[Configurable]] is false) is undefined +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: true, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && typeof desc.set === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-433.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-433.js new file mode 100644 index 000000000..aef5ca61f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-433.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.6-4-433 +description: > + ES5 Attributes - property ([[Get]] is undefined, [[Set]] is + undefined, [[Enumerable]] is true, [[Configurable]] is false) is + enumerable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: true, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + for (var p in obj) { + if (p === "prop") { + return propertyDefineCorrect && desc.enumerable === true; + } + } + + return false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-434.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-434.js new file mode 100644 index 000000000..24768ee82 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-434.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.6-4-434 +description: > + ES5 Attributes - property ([[Get]] is undefined, [[Set]] is + undefined, [[Enumerable]] is true, [[Configurable]] is false) is + undeletable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: true, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + delete obj.prop; + + return propertyDefineCorrect && desc.configurable === false && obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-435.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-435.js new file mode 100644 index 000000000..331dc0cb4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-435.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.6-4-435 +description: > + ES5 Attributes - fail to update [[Get]] attribute of accessor + property ([[Get]] is undefined, [[Set]] is undefined, + [[Enumerable]] is true, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: true, + configurable: false + }); + + var result1 = typeof obj.prop === "undefined"; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + get: getFunc + }); + + return false; + } catch (e) { + var result2 = typeof obj.prop === "undefined"; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + return result1 && result2 && typeof desc1.get === "undefined" && typeof desc2.get === "undefined" && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-436.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-436.js new file mode 100644 index 000000000..a8503bc1e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-436.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.6-4-436 +description: > + ES5 Attributes - fail to update [[Set]] attribute of accessor + property ([[Get]] is undefined, [[Set]] is undefined, + [[Enumerable]] is true, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: true, + configurable: false + }); + + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + set: setFunc + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + return typeof desc1.set === "undefined" && typeof desc2.set === "undefined" && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-437.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-437.js new file mode 100644 index 000000000..c2f11136d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-437.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.6-4-437 +description: > + ES5 Attributes - fail to update [[Enumerable]] attribute of + accessor property ([[Get]] is undefined, [[Set]] is undefined, + [[Enumerable]] is true, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: true, + configurable: false + }); + var result1 = false; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p1 in obj) { + if (p1 === "prop") { + result1 = true; + } + } + + try { + Object.defineProperty(obj, "prop", { + enumerable: false + }); + + return false; + } catch (e) { + var result2 = false; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p2 in obj) { + if (p2 === "prop") { + result2 = true; + } + } + + return result1 && result2 && desc1.enumerable === true && desc2.enumerable === true && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-438.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-438.js new file mode 100644 index 000000000..674c7b6d4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-438.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.6-4-438 +description: > + ES5 Attributes - fail to update [[Configurable]] attribute of + accessor property ([[Get]] is undefined, [[Set]] is undefined, + [[Enumerable]] is true, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: true, + configurable: false + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + configurable: true + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + delete obj.prop; + + return desc1.configurable === false && desc2.configurable === false && obj.hasOwnProperty("prop") && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-439.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-439.js new file mode 100644 index 000000000..1c54048cc --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-439.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.6-4-439 +description: > + ES5 Attributes - fail to update the accessor property ([[Get]] is + undefined, [[Set]] is undefined, [[Enumerable]] is true, + [[Configurable]] is false) to a data property +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: true, + configurable: false + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + value: 1001 + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("get") && !desc2.hasOwnProperty("value") && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-440.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-440.js new file mode 100644 index 000000000..1f7f48d3e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-440.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.6-4-440 +description: > + ES5 Attributes - [[Get]] attribute of accessor property ([[Get]] + is undefined, [[Set]] is undefined, [[Enumerable]] is false, + [[Configurable]] is true) is undefined +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: false, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && typeof desc.get === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-441.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-441.js new file mode 100644 index 000000000..4f6c93b4a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-441.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.6-4-441 +description: > + ES5 Attributes - [[Set]] attribute of accessor property ([[Get]] + is undefined, [[Set]] is undefined, [[Enumerable]] is false, + [[Configurable]] is true) is undefined +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: false, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && typeof desc.set === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-442.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-442.js new file mode 100644 index 000000000..be2f8ab99 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-442.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.6-4-442 +description: > + ES5 Attributes - property ([[Get]] is undefined, [[Set]] is + undefined, [[Enumerable]] is false, [[Configurable]] is true) is + non-enumerable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: false, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + for (var p in obj) { + if (p === "prop") { + return false; + } + } + + return propertyDefineCorrect && desc.enumerable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-443.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-443.js new file mode 100644 index 000000000..e2f647a2d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-443.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.6-4-443 +description: > + ES5 Attributes - property ([[Get]] is undefined, [[Set]] is + undefined, [[Enumerable]] is false, [[Configurable]] is true) is + deletable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: false, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + delete obj.prop; + + return propertyDefineCorrect && desc.configurable === true && !obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-444.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-444.js new file mode 100644 index 000000000..80f684819 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-444.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.6-4-444 +description: > + ES5 Attributes - success to update [[Get]] attribute of accessor + property ([[Get]] is undefined, [[Set]] is undefined, + [[Enumerable]] is false, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: false, + configurable: true + }); + + var result1 = typeof obj.prop === "undefined"; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + get: getFunc + }); + + var result2 = obj.prop === 1001; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return result1 && result2 && typeof desc1.get === "undefined" && desc2.get === getFunc; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-445.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-445.js new file mode 100644 index 000000000..03f58f85d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-445.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.6-4-445 +description: > + ES5 Attributes - success to update [[Set]] attribute of accessor + property ([[Get]] is undefined, [[Set]] is undefined, + [[Enumerable]] is false, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: false, + configurable: true + }); + + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + + Object.defineProperty(obj, "prop", { + set: setFunc + }); + + obj.prop = "overrideData"; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return typeof desc1.set === "undefined" && propertyDefineCorrect && desc2.set === setFunc && verifySetFunc === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-446.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-446.js new file mode 100644 index 000000000..858bb8776 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-446.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.6-4-446 +description: > + ES5 Attributes - success to update [[Enumerable]] attribute of + accessor property ([[Get]] is undefined, [[Set]] is undefined, + [[Enumerable]] is false, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: false, + configurable: true + }); + var result1 = false; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p1 in obj) { + if (p1 === "prop") { + result1 = true; + } + } + + Object.defineProperty(obj, "prop", { + enumerable: true + }); + var result2 = false; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p2 in obj) { + if (p2 === "prop") { + result2 = true; + } + } + + return !result1 && result2 && desc1.enumerable === false && desc2.enumerable === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-447.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-447.js new file mode 100644 index 000000000..92a88f912 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-447.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.6-4-447 +description: > + ES5 Attributes - success to update [[Configurable]] attribute of + accessor property ([[Get]] is undefined, [[Set]] is undefined, + [[Enumerable]] is false, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: false, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + configurable: false + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + delete obj.prop; + + return desc1.configurable === true && desc2.configurable === false && obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-448.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-448.js new file mode 100644 index 000000000..57515598d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-448.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.6-4-448 +description: > + ES5 Attributes - success to update the accessor property ([[Get]] + is undefined, [[Set]] is undefined, [[Enumerable]] is false, + [[Configurable]] is true) to a data property +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: false, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + value: 1001 + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("get") && desc2.hasOwnProperty("value"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-449.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-449.js new file mode 100644 index 000000000..b6d44a886 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-449.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.6-4-449 +description: > + ES5 Attributes - [[Get]] attribute of accessor property ([[Get]] + is undefined, [[Set]] is undefined, [[Enumerable]] is false, + [[Configurable]] is false) is undefined +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: false, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && typeof desc.get === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-45.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-45.js new file mode 100644 index 000000000..ced4ff42f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-45.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.6-4-45 +description: > + Object.defineProperty - 'O' is the global object that uses + Object's [[GetOwnProperty]] method to access the 'name' property + (8.12.9 step 1) +includes: + - runTestCase.js + - fnGlobalObject.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + try { + Object.defineProperty(fnGlobalObject(), "foo", { + value: 12, + configurable: true + }); + + return dataPropertyAttributesAreCorrect(fnGlobalObject(), "foo", 12, false, false, true); + } finally { + delete fnGlobalObject().foo; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-450.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-450.js new file mode 100644 index 000000000..8d6192cce --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-450.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.6-4-450 +description: > + ES5 Attributes - [[Set]] attribute of accessor property ([[Get]] + is undefined, [[Set]] is undefined, [[Enumerable]] is false, + [[Configurable]] is false) is undefined +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: false, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && typeof desc.set === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-451.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-451.js new file mode 100644 index 000000000..197767c79 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-451.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.6-4-451 +description: > + ES5 Attributes - property ([[Get]] is undefined, [[Set]] is + undefined, [[Enumerable]] is false, [[Configurable]] is false) is + non-enumerable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: false, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + for (var p in obj) { + if (p === "prop") { + return false; + } + } + + return propertyDefineCorrect && desc.enumerable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-452.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-452.js new file mode 100644 index 000000000..b66aecd8e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-452.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.6-4-452 +description: > + ES5 Attributes - property ([[Get]] is undefined, [[Set]] is + undefined, [[Enumerable]] is false, [[Configurable]] is false) is + undeletable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: false, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + delete obj.prop; + + return propertyDefineCorrect && desc.configurable === false && obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-453.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-453.js new file mode 100644 index 000000000..eb6b117e0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-453.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.6-4-453 +description: > + ES5 Attributes - fail to update [[Get]] attribute of accessor + property ([[Get]] is undefined, [[Set]] is undefined, + [[Enumerable]] is false, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: false, + configurable: false + }); + + var result1 = typeof obj.prop === "undefined"; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + get: getFunc + }); + + return false; + } catch (e) { + var result2 = typeof obj.prop === "undefined"; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + return result1 && result2 && typeof desc1.get === "undefined" && typeof desc2.get === "undefined" && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-454.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-454.js new file mode 100644 index 000000000..05b26a07d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-454.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.6-4-454 +description: > + ES5 Attributes - fail to update [[Set]] attribute of accessor + property ([[Get]] is undefined, [[Set]] is undefined, + [[Enumerable]] is false, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: false, + configurable: false + }); + + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + set: setFunc + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + return typeof desc1.set === "undefined" && typeof desc2.set === "undefined" && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-455.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-455.js new file mode 100644 index 000000000..cf805575e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-455.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.6-4-455 +description: > + ES5 Attributes - fail to update [[Enumerable]] attribute of + accessor property ([[Get]] is undefined, [[Set]] is undefined, + [[Enumerable]] is false, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: false, + configurable: false + }); + var result1 = false; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p1 in obj) { + if (p1 === "prop") { + result1 = true; + } + } + + try { + Object.defineProperty(obj, "prop", { + enumerable: true + }); + + return false; + } catch (e) { + var result2 = false; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p2 in obj) { + if (p2 === "prop") { + result2 = true; + } + } + + return !result1 && !result2 && desc1.enumerable === false && desc2.enumerable === false && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-456.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-456.js new file mode 100644 index 000000000..89b1e2645 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-456.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.6-4-456 +description: > + ES5 Attributes - fail to update [[Configurable]] attribute of + accessor property ([[Get]] is undefined, [[Set]] is undefined, + [[Enumerable]] is false, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: false, + configurable: false + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + configurable: true + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + delete obj.prop; + + return desc1.configurable === false && desc2.configurable === false && obj.hasOwnProperty("prop") && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-457.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-457.js new file mode 100644 index 000000000..ba2784b6e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-457.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.6-4-457 +description: > + ES5 Attributes - fail to update the accessor property ([[Get]] is + undefined, [[Set]] is undefined, [[Enumerable]] is false, + [[Configurable]] is false) to a data property +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: undefined, + enumerable: false, + configurable: false + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + value: 1001 + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("get") && !desc2.hasOwnProperty("value") && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-458.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-458.js new file mode 100644 index 000000000..3fe70fb82 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-458.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.6-4-458 +description: > + ES5 Attributes - [[Get]] attribute of accessor property ([[Get]] + is undefined, [[Set]] is a Function, [[Enumerable]] is true, + [[Configurable]] is true) is undefined +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: true, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && typeof desc.get === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-459.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-459.js new file mode 100644 index 000000000..2f3839c10 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-459.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.6-4-459 +description: > + ES5 Attributes - [[Set]] attribute of accessor property ([[Get]] + is undefined, [[Set]] is a Function, [[Enumerable]] is true, + [[Configurable]] is true) is the expected function +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: true, + configurable: true + }); + + obj.prop = "overrideData"; + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc.set === setFunc && verifySetFunc === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-46.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-46.js new file mode 100644 index 000000000..f12b3b64f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-46 +description: > + Object.defineProperty - 'name' is defined as data property if + 'name' property doesn't exist in 'O' and 'desc' is generic + descriptor (8.12.9 step 4.a) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { + enumerable: true + }); + + var isEnumerable = false; + for (var item in obj) { + if (obj.hasOwnProperty(item) && item === "property") { + isEnumerable = true; + } + } + + return obj.hasOwnProperty("property") && isEnumerable; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-460.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-460.js new file mode 100644 index 000000000..5fd1af405 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-460.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.6-4-460 +description: > + ES5 Attributes - property ([[Get]] is undefined, [[Set]] is a + Function, [[Enumerable]] is true, [[Configurable]] is true) is + enumerable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: true, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + for (var p in obj) { + if (p === "prop") { + return propertyDefineCorrect && desc.enumerable === true; + } + } + + return false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-461.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-461.js new file mode 100644 index 000000000..dc9a6f616 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-461.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.6-4-461 +description: > + ES5 Attributes - property ([[Get]] is undefined, [[Set]] is a + Function, [[Enumerable]] is true, [[Configurable]] is true) is + deletable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: true, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + delete obj.prop; + + return propertyDefineCorrect && desc.configurable === true && !obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-462.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-462.js new file mode 100644 index 000000000..384e9c290 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-462.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.6-4-462 +description: > + ES5 Attributes - success to update [[Get]] attribute of accessor + property ([[Get]] is undefined, [[Set]] is a Function, + [[Enumerable]] is true, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: true, + configurable: true + }); + + var result1 = typeof obj.prop === "undefined"; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + get: getFunc + }); + + var result2 = obj.prop === 1001; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return result1 && result2 && typeof desc1.get === "undefined" && desc2.get === getFunc; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-463.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-463.js new file mode 100644 index 000000000..4e59aa493 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-463.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.6-4-463 +description: > + ES5 Attributes - success to update [[Set]] attribute of accessor + property ([[Get]] is undefined, [[Set]] is a Function, + [[Enumerable]] is true, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: true, + configurable: true + }); + + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + set: undefined + }); + + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.set === setFunc && typeof desc2.set === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-464.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-464.js new file mode 100644 index 000000000..42475b55c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-464.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.6-4-464 +description: > + ES5 Attributes - success to update [[Enumerable]] attribute of + accessor property ([[Get]] is undefined, [[Set]] is a Function, + [[Enumerable]] is true, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: true, + configurable: true + }); + + var result1 = false; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p1 in obj) { + if (p1 === "prop") { + result1 = true; + } + } + + Object.defineProperty(obj, "prop", { + enumerable: false + }); + var result2 = false; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p2 in obj) { + if (p2 === "prop") { + result2 = true; + } + } + + return result1 && !result2 && desc1.enumerable === true && desc2.enumerable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-465.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-465.js new file mode 100644 index 000000000..171489311 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-465.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.6-4-465 +description: > + ES5 Attributes - success to update [[Configurable]] attribute of + accessor property ([[Get]] is undefined, [[Set]] is a Function, + [[Enumerable]] is true, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: true, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + configurable: false + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + delete obj.prop; + + return desc1.configurable === true && desc2.configurable === false && obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-466.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-466.js new file mode 100644 index 000000000..8cc835069 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-466.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.6-4-466 +description: > + ES5 Attributes - success to update the accessor property ([[Get]] + is undefined, [[Set]] is a Function, [[Enumerable]] is true, + [[Configurable]] is true) to a data property +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: true, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + value: 1001 + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("get") && desc2.hasOwnProperty("value"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-467.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-467.js new file mode 100644 index 000000000..736658cea --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-467.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.6-4-467 +description: > + ES5 Attributes - [[Get]] attribute of accessor property ([[Get]] + is undefined, [[Set]] is a Function, [[Enumerable]] is true, + [[Configurable]] is false) is undefined +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: true, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && typeof desc.get === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-468.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-468.js new file mode 100644 index 000000000..54f09a111 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-468.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.6-4-468 +description: > + ES5 Attributes - [[Set]] attribute of accessor property ([[Get]] + is undefined, [[Set]] is a Function, [[Enumerable]] is true, + [[Configurable]] is false) is the expected function +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: true, + configurable: false + }); + + obj.prop = "overrideData"; + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc.set === setFunc && verifySetFunc === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-469.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-469.js new file mode 100644 index 000000000..ff845d3ef --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-469.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.6-4-469 +description: > + ES5 Attributes - property ([[Get]] is undefined, [[Set]] is a + Function, [[Enumerable]] is true, [[Configurable]] is false) is + enumerable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: true, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + for (var p in obj) { + if (p === "prop") { + return propertyDefineCorrect && desc.enumerable === true; + } + } + + return false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-47.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-47.js new file mode 100644 index 000000000..ed2dec6ae --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-47.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.6-4-47 +description: > + Object.defineProperty - 'name' property doesn't exist in 'O', + [[Value]] of 'name' property is set as undefined if it is absent + in data descriptor 'desc' (8.12.9 step 4.a.i) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { + writable: true, + enumerable: true, + configurable: false + }); + + return dataPropertyAttributesAreCorrect(obj, "property", undefined, true, true, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-470.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-470.js new file mode 100644 index 000000000..53caecb88 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-470.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.6-4-470 +description: > + ES5 Attributes - property ([[Get]] is undefined, [[Set]] is a + Function, [[Enumerable]] is true, [[Configurable]] is false) is + undeletable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: true, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + delete obj.prop; + + return propertyDefineCorrect && desc.configurable === false && obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-471.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-471.js new file mode 100644 index 000000000..5f7515434 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-471.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.6-4-471 +description: > + ES5 Attributes - fail to update [[Get]] attribute of accessor + property ([[Get]] is undefined, [[Set]] is a Function, + [[Enumerable]] is true, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: true, + configurable: false + }); + + var result1 = typeof obj.prop === "undefined"; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + get: getFunc + }); + + return false; + } catch (e) { + var result2 = typeof obj.prop === "undefined"; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return result1 && result2 && typeof desc1.get === "undefined" && typeof desc2.get === "undefined" && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-472.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-472.js new file mode 100644 index 000000000..356a17197 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-472.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.6-4-472 +description: > + ES5 Attributes - fail to update [[Set]] attribute of accessor + property ([[Get]] is undefined, [[Set]] is a Function, + [[Enumerable]] is true, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: true, + configurable: false + }); + + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + set: undefined + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.set === setFunc && desc2.set === setFunc && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-473.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-473.js new file mode 100644 index 000000000..b0c0932bd --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-473.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.6-4-473 +description: > + ES5 Attributes - fail to update [[Enumerable]] attribute of + accessor property ([[Get]] is undefined, [[Set]] is a Function, + [[Enumerable]] is true, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: true, + configurable: false + }); + + var result1 = false; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p1 in obj) { + if (p1 === "prop") { + result1 = true; + } + } + + try { + Object.defineProperty(obj, "prop", { + enumerable: false + }); + + return false; + } catch (e) { + var result2 = false; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p2 in obj) { + if (p2 === "prop") { + result2 = true; + } + } + + return result1 && result2 && desc1.enumerable === true && desc2.enumerable === true && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-474.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-474.js new file mode 100644 index 000000000..e423c5807 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-474.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.6-4-474 +description: > + ES5 Attributes - fail to update [[Configurable]] attribute of + accessor property ([[Get]] is undefined, [[Set]] is a Function, + [[Enumerable]] is true, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: true, + configurable: false + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + configurable: true + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + delete obj.prop; + + return desc1.configurable === false && desc2.configurable === false && obj.hasOwnProperty("prop") && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-475.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-475.js new file mode 100644 index 000000000..fdd5eda79 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-475.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.6-4-475 +description: > + ES5 Attributes - fail to update the accessor property ([[Get]] is + undefined, [[Set]] is a Function, [[Enumerable]] is true, + [[Configurable]] is false) to a data property +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: true, + configurable: false + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + value: 1001 + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("get") && !desc2.hasOwnProperty("value") && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-476.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-476.js new file mode 100644 index 000000000..a2db321cb --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-476.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.6-4-476 +description: > + ES5 Attributes - [[Get]] attribute of accessor property ([[Get]] + is undefined, [[Set]] is a Function, [[Enumerable]] is false, + [[Configurable]] is true) is undefined +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: false, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && typeof desc.get === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-477.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-477.js new file mode 100644 index 000000000..3189d0d62 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-477.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.6-4-477 +description: > + ES5 Attributes - [[Set]] attribute of accessor property ([[Get]] + is undefined, [[Set]] is a Function, [[Enumerable]] is false, + [[Configurable]] is true) is the expected function +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: false, + configurable: true + }); + + obj.prop = "overrideData"; + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc.set === setFunc && verifySetFunc === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-478.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-478.js new file mode 100644 index 000000000..a711bc5e0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-478.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.6-4-478 +description: > + ES5 Attributes - property ([[Get]] is undefined, [[Set]] is a + Function, [[Enumerable]] is false, [[Configurable]] is true) is + non-enumerable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: false, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + for (var p in obj) { + if (p === "prop") { + return false; + } + } + + return propertyDefineCorrect && desc.enumerable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-479.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-479.js new file mode 100644 index 000000000..b8e042342 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-479.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.6-4-479 +description: > + ES5 Attributes - property ([[Get]] is undefined, [[Set]] is a + Function, [[Enumerable]] is false, [[Configurable]] is true) is + deletable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: false, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + delete obj.prop; + + return propertyDefineCorrect && desc.configurable === true && !obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-48.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-48.js new file mode 100644 index 000000000..602305b60 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-48.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.6-4-48 +description: > + Object.defineProperty - 'name' property doesn't exist in 'O', test + [[Writable]] of 'name' property of 'Attributes' is set as false + value if absent in data descriptor 'desc' (8.12.9 step 4.a.i) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { + value: 1001, + enumerable: true, + configurable: false + }); + + return dataPropertyAttributesAreCorrect(obj, "property", 1001, false, true, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-480.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-480.js new file mode 100644 index 000000000..6ce7cfa43 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-480.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.6-4-480 +description: > + ES5 Attributes - success to update [[Get]] attribute of accessor + property ([[Get]] is undefined, [[Set]] is a Function, + [[Enumerable]] is false, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: false, + configurable: true + }); + + var result1 = typeof obj.prop === "undefined"; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + get: getFunc + }); + + var result2 = obj.prop === 1001; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return result1 && result2 && typeof desc1.get === "undefined" && desc2.get === getFunc; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-481.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-481.js new file mode 100644 index 000000000..1b619c4de --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-481.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.6-4-481 +description: > + ES5 Attributes - success to update [[Set]] attribute of accessor + property ([[Get]] is undefined, [[Set]] is a Function, + [[Enumerable]] is false, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: false, + configurable: true + }); + + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + set: undefined + }); + + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.set === setFunc && typeof desc2.set === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-482.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-482.js new file mode 100644 index 000000000..7c59d1d74 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-482.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.6-4-482 +description: > + ES5 Attributes - success to update [[Enumerable]] attribute of + accessor property ([[Get]] is undefined, [[Set]] is a Function, + [[Enumerable]] is false, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: false, + configurable: true + }); + + var result1 = false; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p1 in obj) { + if (p1 === "prop") { + result1 = true; + } + } + + Object.defineProperty(obj, "prop", { + enumerable: true + }); + var result2 = false; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p2 in obj) { + if (p2 === "prop") { + result2 = true; + } + } + + return !result1 && result2 && desc1.enumerable === false && desc2.enumerable === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-483.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-483.js new file mode 100644 index 000000000..7a7c24c57 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-483.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.6-4-483 +description: > + ES5 Attributes - success to update [[Configurable]] attribute of + accessor property ([[Get]] is undefined, [[Set]] is a Function, + [[Enumerable]] is false, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: false, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + configurable: false + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + delete obj.prop; + + return desc1.configurable === true && desc2.configurable === false && obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-484.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-484.js new file mode 100644 index 000000000..f856deb54 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-484.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.6-4-484 +description: > + ES5 Attributes - success to update the accessor property ([[Get]] + is undefined, [[Set]] is a Function, [[Enumerable]] is false, + [[Configurable]] is true) to a data property +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: false, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + value: 1001 + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("get") && desc2.hasOwnProperty("value"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-485.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-485.js new file mode 100644 index 000000000..0ba85b5f5 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-485.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.6-4-485 +description: > + ES5 Attributes - [[Get]] attribute of accessor property ([[Get]] + is undefined, [[Set]] is a Function, [[Enumerable]] is false, + [[Configurable]] is false) is undefined +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: false, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && typeof desc.get === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-486.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-486.js new file mode 100644 index 000000000..a05f242d4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-486.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.6-4-486 +description: > + ES5 Attributes - [[Set]] attribute of accessor property ([[Get]] + is undefined, [[Set]] is a Function, [[Enumerable]] is false, + [[Configurable]] is false) is the expected function +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: false, + configurable: false + }); + + obj.prop = "overrideData"; + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc.set === setFunc && verifySetFunc === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-487.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-487.js new file mode 100644 index 000000000..8a713bad4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-487.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.6-4-487 +description: > + ES5 Attributes - property ([[Get]] is undefined, [[Set]] is a + Function, [[Enumerable]] is false, [[Configurable]] is false) is + non-enumerable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: false, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + for (var p in obj) { + if (p === "prop") { + return false; + } + } + + return propertyDefineCorrect && desc.enumerable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-488.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-488.js new file mode 100644 index 000000000..f207463a0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-488.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.6-4-488 +description: > + ES5 Attributes - property ([[Get]] is undefined, [[Set]] is a + Function, [[Enumerable]] is false, [[Configurable]] is false) is + undeletable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: false, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + delete obj.prop; + + return propertyDefineCorrect && desc.configurable === false && obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-489.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-489.js new file mode 100644 index 000000000..c5d3406c4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-489.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.6-4-489 +description: > + ES5 Attributes - fail to update [[Get]] attribute of accessor + property ([[Get]] is undefined, [[Set]] is a Function, + [[Enumerable]] is false, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: false, + configurable: false + }); + + var result1 = typeof obj.prop === "undefined"; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + get: getFunc + }); + + return false; + } catch (e) { + var result2 = typeof obj.prop === "undefined"; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return result1 && result2 && typeof desc1.get === "undefined" && typeof desc2.get === "undefined" && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-49.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-49.js new file mode 100644 index 000000000..dcce16400 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-49.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.6-4-49 +description: > + Object.defineProperty - 'name' property doesn't exist in 'O', test + [[Enumerable]] of 'name' property of 'Attributes' is set as false + value if absent in data descriptor 'desc' (8.12.9 step 4.a.i) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { + value: 1001, + writable: true, + configurable: true + }); + return dataPropertyAttributesAreCorrect(obj, "property", 1001, true, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-490.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-490.js new file mode 100644 index 000000000..14b6b3757 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-490.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.6-4-490 +description: > + ES5 Attributes - fail to update [[Set]] attribute of accessor + property ([[Get]] is undefined, [[Set]] is a Function, + [[Enumerable]] is false, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: false, + configurable: false + }); + + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + set: undefined + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.set === setFunc && desc2.set === setFunc && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-491.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-491.js new file mode 100644 index 000000000..55f0c60e8 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-491.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.6-4-491 +description: > + ES5 Attributes - fail to update [[Enumerable]] attribute of + accessor property ([[Get]] is undefined, [[Set]] is a Function, + [[Enumerable]] is false, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: false, + configurable: false + }); + + var result1 = false; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p1 in obj) { + if (p1 === "prop") { + result1 = true; + } + } + + try { + Object.defineProperty(obj, "prop", { + enumerable: true + }); + + return false; + } catch (e) { + var result2 = false; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p2 in obj) { + if (p2 === "prop") { + result2 = true; + } + } + + return !result1 && !result2 && desc1.enumerable === false && desc2.enumerable === false && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-492.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-492.js new file mode 100644 index 000000000..68d32e80b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-492.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.6-4-492 +description: > + ES5 Attributes - fail to update [[Configurable]] attribute of + accessor property ([[Get]] is undefined, [[Set]] is a Function, + [[Enumerable]] is false, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: false, + configurable: false + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + configurable: true + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + delete obj.prop; + + return desc1.configurable === false && desc2.configurable === false && obj.hasOwnProperty("prop") && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-493.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-493.js new file mode 100644 index 000000000..3e35f2f1b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-493.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.6-4-493 +description: > + ES5 Attributes - fail to update the accessor property ([[Get]] is + undefined, [[Set]] is a Function, [[Enumerable]] is false, + [[Configurable]] is false) to a data property +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: undefined, + set: setFunc, + enumerable: false, + configurable: false + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + value: 1001 + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("get") && !desc2.hasOwnProperty("value") && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-494.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-494.js new file mode 100644 index 000000000..7fc84bff6 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-494.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.6-4-494 +description: > + ES5 Attributes - [[Get]] attribute of accessor property ([[Get]] + is a Function, [[Set]] is undefined, [[Enumerable]] is true, + [[Configurable]] is true) is the expected function +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: true, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc.get === getFunc && obj.prop === 1001; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-495.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-495.js new file mode 100644 index 000000000..620e83ab6 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-495.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.6-4-495 +description: > + ES5 Attributes - [[Set]] attribute of accessor property ([[Get]] + is a Function, [[Set]] is undefined, [[Enumerable]] is true, + [[Configurable]] is true) is undefined +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: true, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && typeof desc.set === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-496.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-496.js new file mode 100644 index 000000000..20806d6ba --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-496.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.6-4-496 +description: > + ES5 Attributes - property ([[Get]] is a Function, [[Set]] is + undefined, [[Enumerable]] is true, [[Configurable]] is true) is + enumerable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: true, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + for (var p in obj) { + if (p === "prop") { + return propertyDefineCorrect && desc.enumerable === true; + } + } + + return false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-497.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-497.js new file mode 100644 index 000000000..a35087245 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-497.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.6-4-497 +description: > + ES5 Attributes - property ([[Get]] is a Function, [[Set]] is + undefined, [[Enumerable]] is true, [[Configurable]] is true) is + deletable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: true, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + delete obj.prop; + + return propertyDefineCorrect && desc.configurable === true && !obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-498.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-498.js new file mode 100644 index 000000000..84708ab36 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-498.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.6-4-498 +description: > + ES5 Attributes - success to update [[Get]] attribute of accessor + property ([[Get]] is a Function, [[Set]] is undefined, + [[Enumerable]] is true, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: true, + configurable: true + }); + + var result1 = obj.prop === 1001; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + get: undefined + }); + + var result2 = typeof obj.prop === "undefined"; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return result1 && result2 && desc1.get === getFunc && typeof desc2.get === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-499.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-499.js new file mode 100644 index 000000000..9e79446ba --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-499.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.6-4-499 +description: > + ES5 Attributes - success to update [[Set]] attribute of accessor + property ([[Get]] is a Function, [[Set]] is undefined, + [[Enumerable]] is true, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: true, + configurable: true + }); + + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + set: setFunc + }); + + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + obj.prop = "overrideData"; + return typeof desc1.set === "undefined" && desc2.set === setFunc && verifySetFunc === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-5.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-5.js new file mode 100644 index 000000000..8dfe0f5c0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-5.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. + +/*--- +info: > + Step 4 of defineProperty calls the [[DefineOwnProperty]] internal method + of O to define the property. Step 6 of [[DefineOwnProperty]] returns if + every field of desc also occurs in current and every field in desc has + the same value as current. +es5id: 15.2.3.6-4-5 +description: > + Object.defineProperty is no-op if current and desc are the same + data desc +includes: [runTestCase.js] +---*/ + +function testcase() { + function sameDataDescriptorValues(d1, d2) { + return (d1.value === d2.value && + d1.enumerable === d2.enumerable && + d1.writable === d2.writable && + d1.configurable === d2.configurable); + } + + var o = {}; + + // create a data valued property with the following attributes: + // value: 101, enumerable: true, writable: true, configurable: true + o["foo"] = 101; + + // query for, and save, the desc. A subsequent call to defineProperty + // with the same desc should not disturb the property definition. + var d1 = Object.getOwnPropertyDescriptor(o, "foo"); + + // now, redefine the property with the same descriptor + // the property defintion should not get disturbed. + var desc = { value: 101, enumerable: true, writable: true, configurable: true }; + Object.defineProperty(o, "foo", desc); + + var d2 = Object.getOwnPropertyDescriptor(o, "foo"); + + if (sameDataDescriptorValues(d1, d2) === true) { + return true; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-50.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-50.js new file mode 100644 index 000000000..30d55351b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-50.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.6-4-50 +description: > + Object.defineProperty - 'name' property doesn't exist in 'O', test + [[Configurable]] of 'name' property is set as false if it is + absent in data descriptor 'desc' (8.12.9 step 4.a.i) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", { + value: 1001, + writable: true, + enumerable: true + }); + return dataPropertyAttributesAreCorrect(obj, "property", 1001, true, true, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-500.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-500.js new file mode 100644 index 000000000..a0b466ee7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-500.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.6-4-500 +description: > + ES5 Attributes - success to update [[Enumerable]] attribute of + accessor property ([[Get]] is Function, [[Set]] is undefined, + [[Enumerable]] is true, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: true, + configurable: true + }); + var result1 = false; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p1 in obj) { + if (p1 === "prop") { + result1 = true; + } + } + + Object.defineProperty(obj, "prop", { + enumerable: false + }); + var result2 = false; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p2 in obj) { + if (p2 === "prop") { + result2 = true; + } + } + + return result1 && !result2 && desc1.enumerable === true && desc2.enumerable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-501.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-501.js new file mode 100644 index 000000000..2f3baf5c5 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-501.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.6-4-501 +description: > + ES5 Attributes - success to update [[Configurable]] attribute of + accessor property ([[Get]] is a Function, [[Set]] is undefined, + [[Enumerable]] is true, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: true, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + configurable: false + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + delete obj.prop; + + return desc1.configurable === true && desc2.configurable === false && obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-502.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-502.js new file mode 100644 index 000000000..57870b7e4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-502.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.6-4-502 +description: > + ES5 Attributes - success to update the accessor property ([[Get]] + is a Function, [[Set]] is undefined, [[Enumerable]] is true, + [[Configurable]] is true) to a data property +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: true, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + value: 1001 + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("get") && desc2.hasOwnProperty("value"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-503.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-503.js new file mode 100644 index 000000000..b3bcecc03 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-503.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.6-4-503 +description: > + ES5 Attributes - [[Get]] attribute of accessor property ([[Get]] + is a Function, [[Set]] is undefined, [[Enumerable]] is true, + [[Configurable]] is false) is the expected function +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: true, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc.get === getFunc && obj.prop === 1001; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-504.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-504.js new file mode 100644 index 000000000..85ce1bbf5 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-504.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.6-4-504 +description: > + ES5 Attributes - [[Set]] attribute of accessor property ([[Get]] + is a Function, [[Set]] is undefined, [[Enumerable]] is true, + [[Configurable]] is false) is undefined +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: true, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && typeof desc.set === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-505.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-505.js new file mode 100644 index 000000000..2f9c8ecb1 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-505.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.6-4-505 +description: > + ES5 Attributes - property ([[Get]] is a Function, [[Set]] is + undefined, [[Enumerable]] is true, [[Configurable]] is false) is + enumerable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: true, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + for (var p in obj) { + if (p === "prop") { + return propertyDefineCorrect && desc.enumerable === true; + } + } + + return false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-506.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-506.js new file mode 100644 index 000000000..5492204e7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-506.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.6-4-506 +description: > + ES5 Attributes - property ([[Get]] is a Function, [[Set]] is + undefined, [[Enumerable]] is true, [[Configurable]] is false) is + undeletable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: true, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + delete obj.prop; + + return propertyDefineCorrect && desc.configurable === false && obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-507.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-507.js new file mode 100644 index 000000000..cb5929f42 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-507.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.6-4-507 +description: > + ES5 Attributes - fail to update [[Get]] attribute of accessor + property ([[Get]] is a Function, [[Set]] is undefined, + [[Enumerable]] is true, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: true, + configurable: false + }); + + var result1 = obj.prop === 1001; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + get: undefined + }); + + return false; + } catch (e) { + var result2 = obj.prop === 1001; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return result1 && result2 && desc1.get === getFunc && desc2.get === getFunc && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-508.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-508.js new file mode 100644 index 000000000..5023935b4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-508.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.6-4-508 +description: > + ES5 Attributes - fail to update [[Set]] attribute of accessor + property ([[Get]] is a Function, [[Set]] is undefined, + [[Enumerable]] is true, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: true, + configurable: false + }); + + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + set: setFunc + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return typeof desc1.set === "undefined" && typeof desc2.set === "undefined" && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-509.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-509.js new file mode 100644 index 000000000..b6e79edc6 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-509.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.6-4-509 +description: > + ES5 Attributes - fail to update [[Enumerable]] attribute of + accessor property ([[Get]] is a Function, [[Set]] is undefined, + [[Enumerable]] is true, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: true, + configurable: false + }); + var result1 = false; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p1 in obj) { + if (p1 === "prop") { + result1 = true; + } + } + + try { + Object.defineProperty(obj, "prop", { + enumerable: false + }); + + return false; + } catch (e) { + var result2 = false; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p2 in obj) { + if (p2 === "prop") { + result2 = true; + } + } + + return result1 && result2 && desc1.enumerable === true && desc2.enumerable === true && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-51.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-51.js new file mode 100644 index 000000000..e865661aa --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-51.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.6-4-51 +description: > + Object.defineProperty - desc is data descriptor, test updating all + attribute values of 'name' (8.12.9 step 4.a.i) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = { "property": 1 }; // default value of attributes: writable: true, configurable: true, enumerable: true + + Object.defineProperty(obj, "property", { + value: 1001, + writable: false, + enumerable: false, + configurable: false + }); + + return dataPropertyAttributesAreCorrect(obj, "property", 1001, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-510.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-510.js new file mode 100644 index 000000000..55ff979fa --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-510.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.6-4-510 +description: > + ES5 Attributes - fail to update [[Configurable]] attribute of + accessor property ([[Get]] is a Function, [[Set]] is undefined, + [[Enumerable]] is true, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: true, + configurable: false + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + configurable: true + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + delete obj.prop; + + return desc1.configurable === false && desc2.configurable === false && obj.hasOwnProperty("prop") && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-511.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-511.js new file mode 100644 index 000000000..b2a05a7c1 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-511.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.6-4-511 +description: > + ES5 Attributes - fail to update the accessor property ([[Get]] is + a Function, [[Set]] is undefined, [[Enumerable]] is true, + [[Configurable]] is false) to a data property +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: true, + configurable: false + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + value: 1001 + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("get") && !desc2.hasOwnProperty("value") && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-512.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-512.js new file mode 100644 index 000000000..be2781e8f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-512.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.6-4-512 +description: > + ES5 Attributes - [[Get]] attribute of accessor property ([[Get]] + is a Function, [[Set]] is undefined, [[Enumerable]] is false, + [[Configurable]] is true) is the expected function +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: false, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc.get === getFunc && obj.prop === 1001; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-513.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-513.js new file mode 100644 index 000000000..c49b2c767 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-513.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.6-4-513 +description: > + ES5 Attributes - [[Set]] attribute of accessor property ([[Get]] + is a Function, [[Set]] is undefined, [[Enumerable]] is false, + [[Configurable]] is true) is undefined +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: false, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && typeof desc.set === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-514.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-514.js new file mode 100644 index 000000000..27f0c2b91 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-514.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.6-4-514 +description: > + ES5 Attributes - property ([[Get]] is a Function, [[Set]] is + undefined, [[Enumerable]] is false, [[Configurable]] is true) is + non-enumerable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: false, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + for (var p in obj) { + if (p === "prop") { + return false; + } + } + + return propertyDefineCorrect && desc.enumerable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-515.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-515.js new file mode 100644 index 000000000..2d4bf7c54 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-515.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.6-4-515 +description: > + ES5 Attributes - property ([[Get]] is a Function, [[Set]] is + undefined, [[Enumerable]] is false, [[Configurable]] is true) is + deletable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: false, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + delete obj.prop; + + return propertyDefineCorrect && desc.configurable === true && !obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-516.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-516.js new file mode 100644 index 000000000..90fbb22ee --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-516.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.6-4-516 +description: > + ES5 Attributes - success to update [[Get]] attribute of accessor + property ([[Get]] is a Function, [[Set]] is undefined, + [[Enumerable]] is false, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: false, + configurable: true + }); + + var result1 = obj.prop === 1001; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + get: undefined + }); + + var result2 = typeof obj.prop === "undefined"; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return result1 && result2 && desc1.get === getFunc && typeof desc2.get === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-517.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-517.js new file mode 100644 index 000000000..01d1a7e60 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-517.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.6-4-517 +description: > + ES5 Attributes - success to update [[Set]] attribute of accessor + property ([[Get]] is a Function, [[Set]] is undefined, + [[Enumerable]] is false, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: false, + configurable: true + }); + + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + + Object.defineProperty(obj, "prop", { + set: setFunc + }); + + obj.prop = "overrideData"; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return typeof desc1.set === "undefined" && propertyDefineCorrect && desc2.set === setFunc && verifySetFunc === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-518.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-518.js new file mode 100644 index 000000000..94dccc300 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-518.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.6-4-518 +description: > + ES5 Attributes - success to update [[Enumerable]] attribute of + accessor property ([[Get]] is a Function, [[Set]] is undefined, + [[Enumerable]] is false, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: false, + configurable: true + }); + var result1 = false; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p1 in obj) { + if (p1 === "prop") { + result1 = true; + } + } + + Object.defineProperty(obj, "prop", { + enumerable: true + }); + var result2 = false; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p2 in obj) { + if (p2 === "prop") { + result2 = true; + } + } + + return !result1 && result2 && desc1.enumerable === false && desc2.enumerable === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-519.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-519.js new file mode 100644 index 000000000..fcf391261 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-519.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.6-4-519 +description: > + ES5 Attributes - success to update [[Configurable]] attribute of + accessor property ([[Get]] is a Function, [[Set]] is undefined, + [[Enumerable]] is false, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: false, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + configurable: false + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + delete obj.prop; + + return desc1.configurable === true && desc2.configurable === false && obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-52.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-52.js new file mode 100644 index 000000000..416aeac5f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-52.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.6-4-52 +description: > + Object.defineProperty - 'desc' is generic descriptor without any + attribute, test 'name' is defined in 'obj' with all default + attribute values (8.12.9 step 4.a.i) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = {}; + + Object.defineProperty(obj, "property", {}); + + return dataPropertyAttributesAreCorrect(obj, "property", undefined, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-520.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-520.js new file mode 100644 index 000000000..d3fd2b4bb --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-520.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.6-4-520 +description: > + ES5 Attributes - success to update the accessor property ([[Get]] + is a Function, [[Set]] is undefined, [[Enumerable]] is false, + [[Configurable]] is true) to a data property +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: false, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + value: 1001 + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("get") && desc2.hasOwnProperty("value"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-521.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-521.js new file mode 100644 index 000000000..d6373cca7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-521.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.6-4-521 +description: > + ES5 Attributes - [[Get]] attribute of accessor property ([[Get]] + is a Function, [[Set]] is undefined, [[Enumerable]] is false, + [[Configurable]] is false) is the expected function +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: false, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc.get === getFunc && obj.prop === 1001; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-522.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-522.js new file mode 100644 index 000000000..f573b3847 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-522.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.6-4-522 +description: > + ES5 Attributes - [[Set]] attribute of accessor property ([[Get]] + is a Function, [[Set]] is undefined, [[Enumerable]] is false, + [[Configurable]] is false) is undefined +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: false, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && typeof desc.set === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-523.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-523.js new file mode 100644 index 000000000..5bbb48cd0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-523.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.6-4-523 +description: > + ES5 Attributes - property ([[Get]] is a Function, [[Set]] is + undefined, [[Enumerable]] is false, [[Configurable]] is false) is + non-enumerable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: false, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + for (var p in obj) { + if (p === "prop") { + return false; + } + } + + return propertyDefineCorrect && desc.enumerable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-524.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-524.js new file mode 100644 index 000000000..663300157 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-524.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.6-4-524 +description: > + ES5 Attributes - property ([[Get]] is a Function, [[Set]] is + undefined, [[Enumerable]] is false, [[Configurable]] is false) is + undeletable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: false, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + delete obj.prop; + + return propertyDefineCorrect && desc.configurable === false && obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-525.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-525.js new file mode 100644 index 000000000..abbc05a98 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-525.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.6-4-525 +description: > + ES5 Attributes - fail to update [[Get]] attribute of accessor + property ([[Get]] is a Function, [[Set]] is undefined, + [[Enumerable]] is false, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: false, + configurable: false + }); + + var result1 = obj.prop === 1001; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + get: undefined + }); + + return false; + } catch (e) { + var result2 = obj.prop === 1001; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return result1 && result2 && desc1.get === getFunc && desc2.get === getFunc && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-526.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-526.js new file mode 100644 index 000000000..aa0ffb950 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-526.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.6-4-526 +description: > + ES5 Attributes - fail to update [[Set]] attribute of accessor + property ([[Get]] is a Function, [[Set]] is undefined, + [[Enumerable]] is false, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: false, + configurable: false + }); + + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + set: setFunc + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return typeof desc1.set === "undefined" && typeof desc2.set === "undefined" && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-527.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-527.js new file mode 100644 index 000000000..b2fc44c8d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-527.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.6-4-527 +description: > + ES5 Attributes - fail to update [[Enumerable]] attribute of + accessor property ([[Get]] is a Function, [[Set]] is undefined, + [[Enumerable]] is false, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: false, + configurable: false + }); + var result1 = false; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p1 in obj) { + if (p1 === "prop") { + result1 = true; + } + } + + try { + Object.defineProperty(obj, "prop", { + enumerable: true + }); + + return false; + } catch (e) { + var result2 = false; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p2 in obj) { + if (p2 === "prop") { + result2 = true; + } + } + + return !result1 && !result2 && desc1.enumerable === false && desc2.enumerable === false && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-528.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-528.js new file mode 100644 index 000000000..c16ac8de1 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-528.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.6-4-528 +description: > + ES5 Attributes - fail to update [[Configurable]] attribute of + accessor property ([[Get]] is a Function, [[Set]] is undefined, + [[Enumerable]] is false, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: false, + configurable: false + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + configurable: true + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + delete obj.prop; + + return desc1.configurable === false && desc2.configurable === false && obj.hasOwnProperty("prop") && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-529.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-529.js new file mode 100644 index 000000000..0fab958b4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-529.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.6-4-529 +description: > + ES5 Attributes - fail to update the accessor property ([[Get]] is + a Function, [[Set]] is undefined, [[Enumerable]] is false, + [[Configurable]] is false) to a data property +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: undefined, + enumerable: false, + configurable: false + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + value: 1001 + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("get") && !desc2.hasOwnProperty("value") && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-53.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-53.js new file mode 100644 index 000000000..5076fe14d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-53 +description: > + Object.defineProperty - 'name' property doesn't exist in 'O', test + [[Get]] of 'name' property is set as undefined if it is absent in + accessor descriptor 'desc' (8.12.9 step 4.b) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = {}; + var setFunc = function (value) { + obj.setVerifyHelpProp = value; + }; + + Object.defineProperty(obj, "property", { + set: setFunc, + enumerable: true, + configurable: true + }); + + return accessorPropertyAttributesAreCorrect(obj, "property", undefined, setFunc, "setVerifyHelpProp", true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-530.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-530.js new file mode 100644 index 000000000..475413729 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-530.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.6-4-530 +description: > + ES5 Attributes - [[Get]] attribute of accessor property ([[Get]] + is a Function, [[Set]] is a Function, [[Enumerable]] is true, + [[Configurable]] is true) is the expected function +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc.get === getFunc && obj.prop === 1001; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-531-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-1.js new file mode 100644 index 000000000..c361ec258 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-1.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.6-4-531-1 +description: > + Object.defineProperty will update [[Get]] and [[Set]] attributes + of named accessor property 'P' successfully when [[Configurable]] + attribute is true, 'O' is an Object object (8.12.9 step 11) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + obj.verifySetFunction = "data"; + Object.defineProperty(obj, "property", { + get: function () { + return obj.verifySetFunction; + }, + set: function (value) { + obj.verifySetFunction = value; + }, + configurable: true + }); + + obj.verifySetFunction1 = "data1"; + var getFunc = function () { + return obj.verifySetFunction1; + }; + var setFunc = function (value) { + obj.verifySetFunction1 = value; + }; + + Object.defineProperty(obj, "property", { + get: getFunc, + set: setFunc + }); + + return accessorPropertyAttributesAreCorrect(obj, "property", getFunc, setFunc, "verifySetFunction1", false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-531-10.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-10.js new file mode 100644 index 000000000..4a9823406 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-10.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.6-4-531-10 +description: > + Object.defineProperty will update [[Get]] and [[Set]] attributes + of indexed accessor property 'P' successfully when + [[Configurable]] attribute is true, 'O' is an Object object + (8.12.9 step 11) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + obj.verifySetFunction = "data"; + Object.defineProperty(obj, "0", { + get: function () { + return obj.verifySetFunction; + }, + set: function (value) { + obj.verifySetFunction = value; + }, + configurable: true + }); + + obj.verifySetFunction1 = "data1"; + var getFunc = function () { + return obj.verifySetFunction1; + }; + var setFunc = function (value) { + obj.verifySetFunction1 = value; + }; + + Object.defineProperty(obj, "0", { + get: getFunc, + set: setFunc + }); + + return accessorPropertyAttributesAreCorrect(obj, "0", getFunc, setFunc, "verifySetFunction1", false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-531-11.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-11.js new file mode 100644 index 000000000..b2a8871a5 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-11.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.6-4-531-11 +description: > + Object.defineProperty will update [[Get]] and [[Set]] attributes + of named accessor property 'P' successfully when [[Configurable]] + attribute is true, 'A' is an Array object (8.12.9 step 11) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = []; + + obj.verifySetFunction = "data"; + Object.defineProperty(obj, "prop", { + get: function () { + return obj.verifySetFunction; + }, + set: function (value) { + obj.verifySetFunction = value; + }, + configurable: true + }); + + obj.verifySetFunction1 = "data1"; + var getFunc = function () { + return obj.verifySetFunction1; + }; + var setFunc = function (value) { + obj.verifySetFunction1 = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc + }); + + return accessorPropertyAttributesAreCorrect(obj, "prop", getFunc, setFunc, "verifySetFunction1", false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-531-12.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-12.js new file mode 100644 index 000000000..ee06fc899 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-12.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.6-4-531-12 +description: > + Object.defineProperty will update [[Get]] and [[Set]] attributes + of indexed accessor property successfully when [[Configurable]] + attribute is true, 'O' is an Arguments object (8.12.9 step 11) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = (function () { + return arguments; + }()); + + obj.verifySetFunction = "data"; + Object.defineProperty(obj, "0", { + get: function () { + return obj.verifySetFunction; + }, + set: function (value) { + obj.verifySetFunction = value; + }, + configurable: true + }); + + obj.verifySetFunction1 = "data1"; + var getFunc = function () { + return obj.verifySetFunction1; + }; + var setFunc = function (value) { + obj.verifySetFunction1 = value; + }; + + Object.defineProperty(obj, "0", { + get: getFunc, + set: setFunc + }); + + return accessorPropertyAttributesAreCorrect(obj, "0", getFunc, setFunc, "verifySetFunction1", false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-531-13.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-13.js new file mode 100644 index 000000000..70f387324 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-13.js @@ -0,0 +1,55 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.6-4-531-13 +description: > + Object.defineProperty will update [[Get]] and [[Set]] attributes + of indexed accessor property 'P' successfully when + [[Configurable]] attribute is true, 'O' is the global object + (8.12.9 step 11) +includes: + - runTestCase.js + - fnGlobalObject.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = fnGlobalObject(); + try { + obj.verifySetFunction = "data"; + Object.defineProperty(obj, "0", { + get: function () { + return obj.verifySetFunction; + }, + set: function (value) { + obj.verifySetFunction = value; + }, + configurable: true + }); + + obj.verifySetFunction1 = "data1"; + var getFunc = function () { + return obj.verifySetFunction1; + }; + var setFunc = function (value) { + obj.verifySetFunction1 = value; + }; + + Object.defineProperty(obj, "0", { + get: getFunc, + set: setFunc + }); + + return accessorPropertyAttributesAreCorrect(obj, "0", getFunc, setFunc, "verifySetFunction1", false, true); + } finally { + delete obj[0]; + delete obj.verifySetFunction; + delete obj.verifySetFunction1; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-531-15.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-15.js new file mode 100644 index 000000000..132ae375a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-15.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.6-4-531-15 +description: > + ES5 Attributes - Updating a named accessor property 'P' using + simple assignment is successful, 'A' is an Array object (8.12.5 + step 5.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = []; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + var getFunc = function () { + return verifySetFunc; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + + obj.prop = "overrideData"; + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc.set === setFunc && obj.prop === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-531-16.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-16.js new file mode 100644 index 000000000..ac266babb --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-16.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.6-4-531-16 +description: > + ES5 Attributes - Updating an indexed accessor property 'P' using + simple assignment, 'O' is an Arguments object (8.12.5 step 5.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = (function () { + return arguments; + }()); + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + var getFunc = function () { + return verifySetFunc; + }; + + Object.defineProperty(obj, "0", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + + obj[0] = "overrideData"; + var propertyDefineCorrect = obj.hasOwnProperty("0"); + var desc = Object.getOwnPropertyDescriptor(obj, "0"); + + return propertyDefineCorrect && desc.set === setFunc && obj[0] === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-531-17.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-17.js new file mode 100644 index 000000000..25de8f1e7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-17.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.6-4-531-17 +description: > + ES5 Attributes - Updating an indexed accessor property 'P' using + simple assignment is successful, 'O' is the global object (8.12.5 + step 5.b) +includes: + - runTestCase.js + - fnGlobalObject.js +---*/ + +function testcase() { + var obj = fnGlobalObject(); + try { + obj.verifySetFunc = "data"; + var setFunc = function (value) { + obj.verifySetFunc = value; + }; + var getFunc = function () { + return obj.verifySetFunc; + }; + + Object.defineProperty(obj, "0", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + + obj[0] = "overrideData"; + var propertyDefineCorrect = obj.hasOwnProperty("0"); + var desc = Object.getOwnPropertyDescriptor(obj, "0"); + + return propertyDefineCorrect && desc.set === setFunc && obj[0] === "overrideData"; + } finally { + delete obj[0]; + delete obj.verifySetFunc; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-531-2.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-2.js new file mode 100644 index 000000000..e705a17bd --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-2.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.6-4-531-2 +description: > + Object.defineProperty will update [[Get]] and [[Set]] attributes + of indexed accessor property 'P' successfully when + [[Configurable]] attribute is true, 'A' is an Array object (8.12.9 + step 11) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = []; + + obj.verifySetFunction = "data"; + Object.defineProperty(obj, "0", { + get: function () { + return obj.verifySetFunction; + }, + set: function (value) { + obj.verifySetFunction = value; + }, + configurable: true + }); + + obj.verifySetFunction1 = "data1"; + var getFunc = function () { + return obj.verifySetFunction1; + }; + var setFunc = function (value) { + obj.verifySetFunction1 = value; + }; + + Object.defineProperty(obj, "0", { + get: getFunc, + set: setFunc + }); + + return accessorPropertyAttributesAreCorrect(obj, "0", getFunc, setFunc, "verifySetFunction1", false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-531-3.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-3.js new file mode 100644 index 000000000..85fe3ca93 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-3.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.6-4-531-3 +description: > + Object.defineProperty will update [[Get]] and [[Set]] attributes + of named accessor property successfully when [[Configurable]] + attribute is true, 'O' is an Arguments object (8.12.9 step 11) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = (function () { + return arguments; + }()); + + obj.verifySetFunction = "data"; + Object.defineProperty(obj, "property", { + get: function () { + return obj.verifySetFunction; + }, + set: function (value) { + obj.verifySetFunction = value; + }, + configurable: true + }); + + obj.verifySetFunction1 = "data1"; + var getFunc = function () { + return obj.verifySetFunction1; + }; + var setFunc = function (value) { + obj.verifySetFunction1 = value; + }; + + Object.defineProperty(obj, "property", { + get: getFunc, + set: setFunc + }); + + return accessorPropertyAttributesAreCorrect(obj, "property", getFunc, setFunc, "verifySetFunction1", false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-531-4.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-4.js new file mode 100644 index 000000000..b0f2a8034 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-4.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.6-4-531-4 +description: > + Object.defineProperty will update [[Get]] and [[Set]] attributes + of named accessor property 'P' successfully when [[Configurable]] + attribute is true, 'O' is the global object (8.12.9 step 11) +includes: + - runTestCase.js + - fnGlobalObject.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = fnGlobalObject(); + try { + obj.verifySetFunction = "data"; + Object.defineProperty(obj, "property", { + get: function () { + return obj.verifySetFunction; + }, + set: function (value) { + obj.verifySetFunction = value; + }, + configurable: true + }); + + obj.verifySetFunction1 = "data1"; + var getFunc = function () { + return obj.verifySetFunction1; + }; + var setFunc = function (value) { + obj.verifySetFunction1 = value; + }; + + Object.defineProperty(obj, "property", { + get: getFunc, + set: setFunc + }); + + return accessorPropertyAttributesAreCorrect(obj, "property", getFunc, setFunc, "verifySetFunction1", false, true); + } finally { + delete obj.property; + delete obj.verifySetFunction; + delete obj.verifySetFunction1; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-531-6.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-6.js new file mode 100644 index 000000000..f63bdf9e0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-6.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.6-4-531-6 +description: > + ES5 Attributes - Updating an indexed accessor property 'P' without + [[Set]] using simple assignment is failed, 'A' is an Array object + (8.12.5 step 5.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = []; + + var verifySetFunc = "data"; + var getFunc = function () { + return verifySetFunc; + }; + + Object.defineProperty(obj, "0", { + get: getFunc, + enumerable: true, + configurable: true + }); + + obj[0] = "overrideData"; + var propertyDefineCorrect = obj.hasOwnProperty("0"); + var desc = Object.getOwnPropertyDescriptor(obj, "0"); + + return propertyDefineCorrect && typeof desc.set === "undefined" && obj[0] === "data"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-531-7.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-7.js new file mode 100644 index 000000000..6e35bab3f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-7.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.6-4-531-7 +description: > + ES5 Attributes - Updating a named accessor property 'P' without + [[Set]] using simple assignment is failed, 'O' is an Arguments + object (8.12.5 step 5.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = (function () { + return arguments; + }()); + + var verifySetFunc = "data"; + var getFunc = function () { + return verifySetFunc; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + enumerable: true, + configurable: true + }); + + obj.prop = "overrideData"; + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && typeof desc.set === "undefined" && obj.prop === "data"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-531-8.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-8.js new file mode 100644 index 000000000..c68dd029b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-531-8.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.6-4-531-8 +description: > + ES5 Attributes - Updating a named accessor property 'P' without + [[Set]] using simple assignment is failed, 'O' is the global + object (8.12.5 step 5.b) +includes: + - runTestCase.js + - fnGlobalObject.js +---*/ + +function testcase() { + var obj = fnGlobalObject(); + try { + obj.verifySetFunc = "data"; + var getFunc = function () { + return obj.verifySetFunc; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + enumerable: true, + configurable: true + }); + + obj.prop = "overrideData"; + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && typeof desc.set === "undefined" && obj.prop === "data"; + } finally { + delete obj.prop; + delete obj.verifySetFunc; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-531.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-531.js new file mode 100644 index 000000000..1b6764a4c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-531.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.6-4-531 +description: > + ES5 Attributes - [[Set]] attribute of accessor property ([[Get]] + is a Function, [[Set]] is a Function, [[Enumerable]] is true, + [[Configurable]] is true) is the expected function +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + + obj.prop = "overrideData"; + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc.set === setFunc && verifySetFunc === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-532.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-532.js new file mode 100644 index 000000000..cdd4f577f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-532.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.6-4-532 +description: > + ES5 Attributes - property ([[Get]] is a Function, [[Set]] is a + Function, [[Enumerable]] is true, [[Configurable]] is true) is + enumerable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + for (var p in obj) { + if (p === "prop") { + return propertyDefineCorrect && desc.enumerable === true; + } + } + + return false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-533.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-533.js new file mode 100644 index 000000000..6ed543792 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-533.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.6-4-533 +description: > + ES5 Attributes - property ([[Get]] is a Function, [[Set]] is a + Function, [[Enumerable]] is true, [[Configurable]] is true) is + deletable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + delete obj.prop; + + return propertyDefineCorrect && desc.configurable === true && !obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-534.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-534.js new file mode 100644 index 000000000..2ae5c6082 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-534.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.6-4-534 +description: > + ES5 Attributes - success to update [[Get]] attribute of accessor + property ([[Get]] is a Function, [[Set]] is a Function, + [[Enumerable]] is true, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + + var result1 = obj.prop === 1001; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + get: undefined + }); + + var result2 = typeof obj.prop === "undefined"; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return result1 && result2 && desc1.get === getFunc && typeof desc2.get === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-535.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-535.js new file mode 100644 index 000000000..003af03f8 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-535.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.6-4-535 +description: > + ES5 Attributes - success to update [[Set]] attribute of accessor + property ([[Get]] is a Function, [[Set]] is a Function, + [[Enumerable]] is true, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + set: undefined + }); + + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.set === setFunc && typeof desc2.set === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-536.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-536.js new file mode 100644 index 000000000..f128a0c08 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-536.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.6-4-536 +description: > + ES5 Attributes - success to update [[Enumerable]] attribute of + accessor property ([[Get]] is a Function, [[Set]] is a Function, + [[Enumerable]] is true, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + var result1 = false; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p1 in obj) { + if (p1 === "prop") { + result1 = true; + } + } + + Object.defineProperty(obj, "prop", { + enumerable: false + }); + var result2 = false; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p2 in obj) { + if (p2 === "prop") { + result2 = true; + } + } + + return result1 && !result2 && desc1.enumerable === true && desc2.enumerable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-537.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-537.js new file mode 100644 index 000000000..b76bb8588 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-537.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.6-4-537 +description: > + ES5 Attributes - success to update [[Configurable]] attribute of + accessor property ([[Get]] is a Function, [[Set]] is a Function, + [[Enumerable]] is true, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + configurable: false + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + delete obj.prop; + + return desc1.configurable === true && desc2.configurable === false && obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-538-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-538-1.js new file mode 100644 index 000000000..ce59418d5 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-538-1.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.6-4-538-1 +description: > + ES5 Attributes - Updating an indexed 'P' whose [[Configurable]] + attribute is true to a data property is successful, 'A' is an + Array object (8.12.9 - step 9.c.i) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = []; + + obj.verifySetFunc = "data"; + var getFunc = function () { + return obj.verifySetFunc; + }; + + var setFunc = function (value) { + obj.verifySetFunc = value; + }; + + Object.defineProperty(obj, "0", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "0"); + + Object.defineProperty(obj, "0", { + value: 1001 + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "0"); + + return desc1.hasOwnProperty("get") && desc2.hasOwnProperty("value") && + typeof desc2.get === "undefined" && typeof desc2.get === "undefined" && + dataPropertyAttributesAreCorrect(obj, "0", 1001, false, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-538-2.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-538-2.js new file mode 100644 index 000000000..d40aa701b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-538-2.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.6-4-538-2 +description: > + ES5 Attributes - Updating a named accessor property 'P' whose + [[Configurable]] attribute is true to a data property is + successful, 'O' is an Arguments object +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = (function () { + return arguments; + }()); + + obj.verifySetFunc = "data"; + var getFunc = function () { + return obj.verifySetFunc; + }; + + var setFunc = function (value) { + obj.verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + value: 1001 + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("get") && desc2.hasOwnProperty("value") && + typeof desc2.get === "undefined" && typeof desc2.get === "undefined" && + dataPropertyAttributesAreCorrect(obj, "prop", 1001, false, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-538-3.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-538-3.js new file mode 100644 index 000000000..5f1078e3d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-538-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.6-4-538-3 +description: > + ES5 Attributes - Updating a named accessor property 'P' whose + [[Configurable]] attribute is true to a data property is + successful, 'O' is the global object +includes: + - runTestCase.js + - fnGlobalObject.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = fnGlobalObject(); + + obj.verifySetFunc = "data"; + var getFunc = function () { + return obj.verifySetFunc; + }; + + var setFunc = function (value) { + obj.verifySetFunc = value; + }; + try { + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + value: 1001 + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("get") && desc2.hasOwnProperty("value") && + typeof desc2.get === "undefined" && typeof desc2.get === "undefined" && + dataPropertyAttributesAreCorrect(obj, "prop", 1001, false, true, true); + } finally { + delete obj.prop; + delete obj.verifySetFunc; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-538-5.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-538-5.js new file mode 100644 index 000000000..e6b8c1596 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-538-5.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.6-4-538-5 +description: > + ES5 Attributes - Updating a named accessor property 'P' whose + [[Configurable]] attribute is true to a data property is + successful, 'A' is an Array object (8.12.9 - step 9.c.i) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = []; + + obj.verifySetFunc = "data"; + var getFunc = function () { + return obj.verifySetFunc; + }; + + var setFunc = function (value) { + obj.verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + value: 1001 + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("get") && desc2.hasOwnProperty("value") && + typeof desc2.get === "undefined" && typeof desc2.get === "undefined" && + dataPropertyAttributesAreCorrect(obj, "prop", 1001, false, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-538-6.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-538-6.js new file mode 100644 index 000000000..40ce80c5f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-538-6.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.6-4-538-6 +description: > + ES5 Attributes - Updating an indexed accessor property 'P' whose + [[Configurable]] attribute is true to a data property is + successful, 'O' is an Arguments object +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = (function () { + return arguments; + }()); + + obj.verifySetFunc = "data"; + var getFunc = function () { + return obj.verifySetFunc; + }; + + var setFunc = function (value) { + obj.verifySetFunc = value; + }; + + Object.defineProperty(obj, "0", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "0"); + + Object.defineProperty(obj, "0", { + value: 1001 + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "0"); + + return desc1.hasOwnProperty("get") && desc2.hasOwnProperty("value") && + typeof desc2.get === "undefined" && typeof desc2.get === "undefined" && + dataPropertyAttributesAreCorrect(obj, "0", 1001, false, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-538-7.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-538-7.js new file mode 100644 index 000000000..1273fd5e3 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-538-7.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.6-4-538-7 +description: > + ES5 Attributes - Updating an indexed accessor property 'P' whose + [[Configurable]] attribute is true to a data property is + successful, 'O' is the global object +includes: + - runTestCase.js + - fnGlobalObject.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = fnGlobalObject(); + + obj.verifySetFunc = "data"; + var getFunc = function () { + return obj.verifySetFunc; + }; + + var setFunc = function (value) { + obj.verifySetFunc = value; + }; + try { + Object.defineProperty(obj, "0", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "0"); + + Object.defineProperty(obj, "0", { + value: 1001 + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "0"); + + return desc1.hasOwnProperty("get") && desc2.hasOwnProperty("value") && + typeof desc2.get === "undefined" && typeof desc2.get === "undefined" && + dataPropertyAttributesAreCorrect(obj, "0", 1001, false, true, true); + } finally { + delete obj[0]; + delete obj.verifySetFunc; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-538.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-538.js new file mode 100644 index 000000000..753a63d81 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-538.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.6-4-538 +description: > + ES5 Attributes - success to update the accessor property ([[Get]] + is a Function, [[Set]] is a Function, [[Enumerable]] is true, + [[Configurable]] is true) to a data property +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + value: 1001 + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("get") && desc2.hasOwnProperty("value") && + typeof desc2.get === "undefined" && typeof desc2.get === "undefined" && + dataPropertyAttributesAreCorrect(obj, "prop", 1001, false, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-539.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-539.js new file mode 100644 index 000000000..448140a80 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-539.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.6-4-539 +description: > + ES5 Attributes - [[Get]] attribute of accessor property ([[Get]] + is a Function, [[Set]] is a Function, [[Enumerable]] is true, + [[Configurable]] is false) is the expected function +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc.get === getFunc && obj.prop === 1001; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-54.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-54.js new file mode 100644 index 000000000..a7b66c03b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-54.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.6-4-54 +description: > + Object.defineProperty - 'name' property doesn't exist in 'O', test + [[Set]] of 'name' property of 'Attributes' 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 = {}; + + Object.defineProperty(obj, "property", { + get: function () { + return "property"; + }, + enumerable: false, + configurable: false + }); + + + if (obj.property !== "property") { + return false; + } + var desc = Object.getOwnPropertyDescriptor(obj, "property"); + if (typeof desc.set !== "undefined") { + return false; + } + for (var p in obj) { + if (p === "property") { + return false; + } + } + delete obj.property; + if (!obj.hasOwnProperty("property")) { + return false; + } + + return true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-540-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-540-1.js new file mode 100644 index 000000000..8017d5d92 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-540-1.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.6-4-540-1 +description: > + Object.defineProperty fails to update [[Get]] and [[Set]] + attributes of a named accessor property 'P' whose [[Configurable]] + attribute is false and throws TypeError exception, 'O' is an + Object object (8.12.9 step 11.a) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = {}; + + obj.verifySetFunction = "data"; + var getFunc = function () { + return obj.verifySetFunction; + }; + var setFunc = function (value) { + obj.verifySetFunction = value; + }; + Object.defineProperty(obj, "property", { + get: getFunc, + set: setFunc, + configurable: false + }); + + var result = false; + try { + Object.defineProperty(obj, "property", { + get: function () { + return 100; + } + }); + } catch (e) { + result = e instanceof TypeError && + accessorPropertyAttributesAreCorrect(obj, "property", getFunc, setFunc, "verifySetFunction", false, false); + } + + try { + Object.defineProperty(obj, "property", { + set: function (value) { + obj.verifySetFunction1 = value; + } + }); + } catch (e1) { + return result && e1 instanceof TypeError && + accessorPropertyAttributesAreCorrect(obj, "property", getFunc, setFunc, "verifySetFunction", false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-540-10.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-540-10.js new file mode 100644 index 000000000..624bcf53b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-540-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.6-4-540-10 +description: > + ES5 Attributes - Updating an indexed accessor property 'P' using + simple assignment is successful, 'O' is an Arguments object + (8.12.5 step 5.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = (function () { + return arguments; + }()); + + obj.verifySetFunc = "data"; + var getFunc = function () { + return obj.verifySetFunc; + }; + + var setFunc = function (value) { + obj.verifySetFunc = value; + }; + + Object.defineProperty(obj, "0", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: false + }); + + obj[0] = "overrideData"; + var propertyDefineCorrect = obj.hasOwnProperty("0"); + var desc = Object.getOwnPropertyDescriptor(obj, "0"); + + return propertyDefineCorrect && desc.set === setFunc && obj.verifySetFunc === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-540-2.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-540-2.js new file mode 100644 index 000000000..b02f2b210 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-540-2.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.6-4-540-2 +description: > + Object.defineProperty fails to update [[Get]] and [[Set]] + attributes of an indexed property 'P' whose [[Configurable]] + attribute is false and throws TypeError exception, 'A' is an Array + object (8.12.9 step 11.a) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = []; + + obj.verifySetFunction = "data"; + var getFunc = function () { + return obj.verifySetFunction; + }; + var setFunc = function (value) { + obj.verifySetFunction = value; + }; + Object.defineProperty(obj, "0", { + get: getFunc, + set: setFunc, + configurable: false + }); + + var result = false; + try { + Object.defineProperty(obj, "0", { + get: function () { + return 100; + } + }); + } catch (e) { + result = e instanceof TypeError && + accessorPropertyAttributesAreCorrect(obj, "0", getFunc, setFunc, "verifySetFunction", false, false); + } + + try { + Object.defineProperty(obj, "0", { + set: function (value) { + obj.verifySetFunction1 = value; + } + }); + } catch (e1) { + return result && e1 instanceof TypeError && + accessorPropertyAttributesAreCorrect(obj, "0", getFunc, setFunc, "verifySetFunction", false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-540-3.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-540-3.js new file mode 100644 index 000000000..af693e648 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-540-3.js @@ -0,0 +1,59 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.6-4-540-3 +description: > + Object.defineProperty fails to update [[Get]] and [[Set]] + attributes of a named accessor property 'P' whose [[Configurable]] + attribute is false, 'O' is an Arguments object (8.12.9 step 11.a) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = (function () { + return arguments; + }()); + + obj.verifySetFunction = "data"; + var getFunc = function () { + return obj.verifySetFunction; + }; + var setFunc = function (value) { + obj.verifySetFunction = value; + }; + Object.defineProperty(obj, "property", { + get: getFunc, + set: setFunc, + configurable: false + }); + + var result = false; + try { + Object.defineProperty(obj, "property", { + get: function () { + return 100; + } + }); + } catch (e) { + result = e instanceof TypeError && + accessorPropertyAttributesAreCorrect(obj, "property", getFunc, setFunc, "verifySetFunction", false, false); + } + + try { + Object.defineProperty(obj, "property", { + set: function (value) { + obj.verifySetFunction1 = value; + } + }); + } catch (e1) { + return result && e1 instanceof TypeError && + accessorPropertyAttributesAreCorrect(obj, "property", getFunc, setFunc, "verifySetFunction", false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-540-4.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-540-4.js new file mode 100644 index 000000000..cad9c57d3 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-540-4.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.6-4-540-4 +description: > + ES5 Attributes - Updating an indexed accessor property 'P' using + simple assignment is successful, 'A' is an Array object (8.12.5 + step 5.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = []; + + obj.verifySetFunc = "data"; + var getFunc = function () { + return obj.verifySetFunc; + }; + + var setFunc = function (value) { + obj.verifySetFunc = value; + }; + + Object.defineProperty(obj, "0", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: false + }); + + obj[0] = "overrideData"; + var propertyDefineCorrect = obj.hasOwnProperty("0"); + var desc = Object.getOwnPropertyDescriptor(obj, "0"); + + return propertyDefineCorrect && desc.set === setFunc && obj.verifySetFunc === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-540-5.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-540-5.js new file mode 100644 index 000000000..89d4b9281 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-540-5.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.6-4-540-5 +description: > + ES5 Attributes - Updating a named accessor property 'P' using + simple assignment is successful, 'O' is an Arguments object + (8.12.5 step 5.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = (function () { + return arguments; + }()); + + obj.verifySetFunc = "data"; + var getFunc = function () { + return obj.verifySetFunc; + }; + + var setFunc = function (value) { + obj.verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: false + }); + + obj.prop = "overrideData"; + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc.set === setFunc && obj.verifySetFunc === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-540-6.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-540-6.js new file mode 100644 index 000000000..b6cf00397 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-540-6.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.6-4-540-6 +description: > + Object.defineProperty fails to update [[Get]] and [[Set]] + attributes of an indexed accessor property 'P' whose + [[Configurable]] attribute is false and throws TypeError + exception, 'O' is an Object object (8.12.9 step 11.a) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = {}; + + obj.verifySetFunction = "data"; + var getFunc = function () { + return obj.verifySetFunction; + }; + var setFunc = function (value) { + obj.verifySetFunction = value; + }; + Object.defineProperty(obj, "0", { + get: getFunc, + set: setFunc, + configurable: false + }); + + var result = false; + try { + Object.defineProperty(obj, "0", { + get: function () { + return 100; + } + }); + } catch (e) { + result = e instanceof TypeError && + accessorPropertyAttributesAreCorrect(obj, "0", getFunc, setFunc, "verifySetFunction", false, false); + } + + try { + Object.defineProperty(obj, "0", { + set: function (value) { + obj.verifySetFunction1 = value; + } + }); + } catch (e1) { + return result && e1 instanceof TypeError && + accessorPropertyAttributesAreCorrect(obj, "0", getFunc, setFunc, "verifySetFunction", false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-540-7.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-540-7.js new file mode 100644 index 000000000..bbf262895 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-540-7.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.6-4-540-7 +description: > + Object.defineProperty fails to update [[Get]] and [[Set]] + attributes of a named property 'P' whose [[Configurable]] + attribute is false and throws TypeError exception, 'A' is an Array + object (8.12.9 step 11.a) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = []; + + obj.verifySetFunction = "data"; + var getFunc = function () { + return obj.verifySetFunction; + }; + var setFunc = function (value) { + obj.verifySetFunction = value; + }; + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + configurable: false + }); + + var result = false; + try { + Object.defineProperty(obj, "prop", { + get: function () { + return 100; + } + }); + } catch (e) { + result = e instanceof TypeError && + accessorPropertyAttributesAreCorrect(obj, "prop", getFunc, setFunc, "verifySetFunction", false, false); + } + + try { + Object.defineProperty(obj, "prop", { + set: function (value) { + obj.verifySetFunction1 = value; + } + }); + } catch (e1) { + return result && e1 instanceof TypeError && + accessorPropertyAttributesAreCorrect(obj, "prop", getFunc, setFunc, "verifySetFunction", false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-540-8.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-540-8.js new file mode 100644 index 000000000..b1851c950 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-540-8.js @@ -0,0 +1,60 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.6-4-540-8 +description: > + Object.defineProperty fails to update [[Get]] and [[Set]] + attributes of an indexed accessor property 'P' whose + [[Configurable]] attribute is false, 'O' is an Arguments object + (8.12.9 step 11.a) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = (function () { + return arguments; + }()); + + obj.verifySetFunction = "data"; + var getFunc = function () { + return obj.verifySetFunction; + }; + var setFunc = function (value) { + obj.verifySetFunction = value; + }; + Object.defineProperty(obj, "0", { + get: getFunc, + set: setFunc, + configurable: false + }); + + var result = false; + try { + Object.defineProperty(obj, "0", { + get: function () { + return 100; + } + }); + } catch (e) { + result = e instanceof TypeError && + accessorPropertyAttributesAreCorrect(obj, "0", getFunc, setFunc, "verifySetFunction", false, false); + } + + try { + Object.defineProperty(obj, "0", { + set: function (value) { + obj.verifySetFunction1 = value; + } + }); + } catch (e1) { + return result && e1 instanceof TypeError && + accessorPropertyAttributesAreCorrect(obj, "0", getFunc, setFunc, "verifySetFunction", false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-540-9.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-540-9.js new file mode 100644 index 000000000..1adf5ef49 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-540-9.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.6-4-540-9 +description: > + ES5 Attributes - Updating a named accessor property 'P' using + simple assignment is successful, 'A' is an Array object (8.12.5 + step 5.b) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = []; + + obj.verifySetFunc = "data"; + var getFunc = function () { + return obj.verifySetFunc; + }; + + var setFunc = function (value) { + obj.verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: false + }); + + obj.prop = "overrideData"; + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc.set === setFunc && obj.verifySetFunc === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-540.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-540.js new file mode 100644 index 000000000..0101f79fb --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-540.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.6-4-540 +description: > + ES5 Attributes - [[Set]] attribute of accessor property ([[Get]] + is a Function, [[Set]] is a Function, [[Enumerable]] is true, + [[Configurable]] is false) is the expected function +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: false + }); + + obj.prop = "overrideData"; + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc.set === setFunc && verifySetFunc === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-541.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-541.js new file mode 100644 index 000000000..f72c21cbc --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-541.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.6-4-541 +description: > + ES5 Attributes - property ([[Get]] is a Function, [[Set]] is a + Function, [[Enumerable]] is true, [[Configurable]] is false) is + enumerable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + for (var p in obj) { + if (p === "prop") { + return propertyDefineCorrect && desc.enumerable === true; + } + } + + return false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-542.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-542.js new file mode 100644 index 000000000..7519e3a1f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-542.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.6-4-542 +description: > + ES5 Attributes - property ([[Get]] is a Function, [[Set]] is a + Function, [[Enumerable]] is true, [[Configurable]] is false) is + undeletable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + delete obj.prop; + + return propertyDefineCorrect && desc.configurable === false && obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-543.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-543.js new file mode 100644 index 000000000..be0fd5564 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-543.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.6-4-543 +description: > + ES5 Attributes - fail to update [[Get]] attribute of accessor + property ([[Get]] is a Function, [[Set]] is a Function, + [[Enumerable]] is true, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: false + }); + + var result1 = obj.prop === 1001; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + get: undefined + }); + + return false; + } catch (e) { + var result2 = obj.prop === 1001; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return result1 && result2 && desc1.get === getFunc && desc2.get === getFunc && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-544.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-544.js new file mode 100644 index 000000000..b62cfb321 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-544.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.6-4-544 +description: > + ES5 Attributes - fail to update [[Set]] attribute of accessor + property ([[Get]] is a Function, [[Set]] is a Function, + [[Enumerable]] is true, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: false + }); + + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + set: undefined + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.set === setFunc && desc2.set === setFunc && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-545.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-545.js new file mode 100644 index 000000000..9eb04547b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-545.js @@ -0,0 +1,61 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.6-4-545 +description: > + ES5 Attributes - fail to update [[Enumerable]] attribute of + accessor property ([[Get]] is a Function, [[Set]] is a Function, + [[Enumerable]] is true, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: false + }); + var result1 = false; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p1 in obj) { + if (p1 === "prop") { + result1 = true; + } + } + + try { + Object.defineProperty(obj, "prop", { + enumerable: false + }); + + return false; + } catch (e) { + var result2 = false; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p2 in obj) { + if (p2 === "prop") { + result2 = true; + } + } + + return result1 && result2 && desc1.enumerable === true && desc2.enumerable === true && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-546.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-546.js new file mode 100644 index 000000000..ca8d002ed --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-546.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.6-4-546 +description: > + ES5 Attributes - fail to update [[Configurable]] attribute of + accessor property ([[Get]] is a Function, [[Set]] is a Function, + [[Enumerable]] is true, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: false + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + configurable: true + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + delete obj.prop; + + return desc1.configurable === false && desc2.configurable === false && obj.hasOwnProperty("prop") && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-547-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-547-1.js new file mode 100644 index 000000000..dd7ef5a03 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-547-1.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.6-4-547-1 +description: > + ES5 Attributes - Updating an indexed accessor property 'P' whose + [[Configurable]] attribute is false to a data property does not + succeed, 'A' is an Array object (8.12.9 step 9.a) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = []; + + obj.verifySetFunc = "data"; + var getFunc = function () { + return obj.verifySetFunc; + }; + + var setFunc = function (value) { + obj.verifySetFunc = value; + }; + + Object.defineProperty(obj, "0", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: false + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "0"); + + try { + Object.defineProperty(obj, "0", { + value: 1001 + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "0"); + + return desc1.hasOwnProperty("get") && !desc2.hasOwnProperty("value") && e instanceof TypeError && + accessorPropertyAttributesAreCorrect(obj, "0", getFunc, setFunc, "verifySetFunc", true, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-547-2.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-547-2.js new file mode 100644 index 000000000..a3a5b8e36 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-547-2.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.6-4-547-2 +description: > + ES5 Attributes - Updating a named accessor property 'P' whose + [[Configurable]] attribute is false to a data property does not + succeed, 'A' is an Arguments object (8.12.9 step 9.a) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = (function () { + return arguments; + }()); + + obj.verifySetFunc = "data"; + var getFunc = function () { + return obj.verifySetFunc; + }; + + var setFunc = function (value) { + obj.verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: false + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + value: 1001 + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("get") && !desc2.hasOwnProperty("value") && e instanceof TypeError && + accessorPropertyAttributesAreCorrect(obj, "prop", getFunc, setFunc, "verifySetFunc", true, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-547-3.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-547-3.js new file mode 100644 index 000000000..f0723406d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-547-3.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.6-4-547-3 +description: > + ES5 Attributes - Updating a named accessor property 'P' whose + [[Configurable]] attribute is false to a data property does not + succeed, 'A' is an Array object (8.12.9 step 9.a) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = []; + + obj.verifySetFunc = "data"; + var getFunc = function () { + return obj.verifySetFunc; + }; + + var setFunc = function (value) { + obj.verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: false + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + value: 1001 + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("get") && !desc2.hasOwnProperty("value") && e instanceof TypeError && + accessorPropertyAttributesAreCorrect(obj, "prop", getFunc, setFunc, "verifySetFunc", true, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-547-4.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-547-4.js new file mode 100644 index 000000000..0c724fb55 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-547-4.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.6-4-547-4 +description: > + ES5 Attributes - Updating an indexed accessor property 'P' whose + [[Configurable]] attribute is false to a data property does not + succeed, 'A' is an Arguments object (8.12.9 step 9.a) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = (function () { + return arguments; + }()); + + obj.verifySetFunc = "data"; + var getFunc = function () { + return obj.verifySetFunc; + }; + + var setFunc = function (value) { + obj.verifySetFunc = value; + }; + + Object.defineProperty(obj, "0", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: false + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "0"); + + try { + Object.defineProperty(obj, "0", { + value: 1001 + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "0"); + + return desc1.hasOwnProperty("get") && !desc2.hasOwnProperty("value") && e instanceof TypeError && + accessorPropertyAttributesAreCorrect(obj, "0", getFunc, setFunc, "verifySetFunc", true, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-547.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-547.js new file mode 100644 index 000000000..9a303093e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-547.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.6-4-547 +description: > + ES5 Attributes - fail to update the accessor property ([[Get]] is + a Function, [[Set]] is a Function, [[Enumerable]] is true, + [[Configurable]] is false) to a data property +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: false + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + value: 1001 + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("get") && !desc2.hasOwnProperty("value") && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-548.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-548.js new file mode 100644 index 000000000..25cb80e65 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-548.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.6-4-548 +description: > + ES5 Attributes - [[Get]] attribute of accessor property ([[Get]] + is a Function, [[Set]] is a Function, [[Enumerable]] is false, + [[Configurable]] is true) is the expected function +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: false, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc.get === getFunc && obj.prop === 1001; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-549.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-549.js new file mode 100644 index 000000000..f6df5209d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-549.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.6-4-549 +description: > + ES5 Attributes - [[Set]] attribute of accessor property ([[Get]] + is a Function, [[Set]] is a Function, [[Enumerable]] is false, + [[Configurable]] is true) is the expected function +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: false, + configurable: true + }); + + obj.prop = "overrideData"; + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc.set === setFunc && verifySetFunc === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-55.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-55.js new file mode 100644 index 000000000..50bb396b9 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-55.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.6-4-55 +description: > + Object.defineProperty - 'name' property doesn't exist in 'O', test + [[Enumerable]] of 'name' property of 'Attributes' 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 setFunc = function (value) { + obj.setVerifyHelpProp = value; + }; + var getFunc = function () { + return 10; + }; + + Object.defineProperty(obj, "property", { + set: setFunc, + get: getFunc, + configurable: true + }); + return accessorPropertyAttributesAreCorrect(obj, "property", getFunc, setFunc, "setVerifyHelpProp", false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-550.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-550.js new file mode 100644 index 000000000..e6ee700f4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-550.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.6-4-550 +description: > + ES5 Attributes - property ([[Get]] is a Function, [[Set]] is a + Function, [[Enumerable]] is false, [[Configurable]] is true) is + non-enumerable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: false, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + for (var p in obj) { + if (p === "prop") { + return false; + } + } + + return propertyDefineCorrect && desc.enumerable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-551.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-551.js new file mode 100644 index 000000000..3fc996d7a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-551.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.6-4-551 +description: > + ES5 Attributes - property ([[Get]] is a Function, [[Set]] is a + Function, [[Enumerable]] is false, [[Configurable]] is true) is + deletable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: false, + configurable: true + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + delete obj.prop; + + return propertyDefineCorrect && desc.configurable === true && !obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-552.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-552.js new file mode 100644 index 000000000..f9f1ffb6f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-552.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.6-4-552 +description: > + ES5 Attributes - success to update [[Get]] attribute of accessor + property ([[Get]] is a Function, [[Set]] is a Function, + [[Enumerable]] is false, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: false, + configurable: true + }); + + var result1 = obj.prop === 1001; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + get: undefined + }); + + var result2 = typeof obj.prop === "undefined"; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return result1 && result2 && desc1.get === getFunc && typeof desc2.get === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-553.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-553.js new file mode 100644 index 000000000..cb9e0744b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-553.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.6-4-553 +description: > + ES5 Attributes - success to update [[Set]] attribute of accessor + property ([[Get]] is a Function, [[Set]] is a Function, + [[Enumerable]] is false, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: false, + configurable: true + }); + + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + set: undefined + }); + + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.set === setFunc && typeof desc2.set === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-554.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-554.js new file mode 100644 index 000000000..04f5f19fa --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-554.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.6-4-554 +description: > + ES5 Attributes - success to update [[Enumerable]] attribute of + accessor property ([[Get]] is a Function, [[Set]] is a Function, + [[Enumerable]] is false, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: false, + configurable: true + }); + + var result1 = false; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p1 in obj) { + if (p1 === "prop") { + result1 = true; + } + } + + Object.defineProperty(obj, "prop", { + enumerable: true + }); + var result2 = false; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p2 in obj) { + if (p2 === "prop") { + result2 = true; + } + } + + return !result1 && result2 && desc1.enumerable === false && desc2.enumerable === true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-555.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-555.js new file mode 100644 index 000000000..f008a75ae --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-555.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.6-4-555 +description: > + ES5 Attributes - success to update [[Configurable]] attribute of + accessor property ([[Get]] is a Function, [[Set]] is a Function, + [[Enumerable]] is false, [[Configurable]] is true) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: false, + configurable: true + }); + + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + configurable: false + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + delete obj.prop; + + return desc1.configurable === true && desc2.configurable === false && obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-556.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-556.js new file mode 100644 index 000000000..eb0aa4856 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-556.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.6-4-556 +description: > + ES5 Attributes - success to update the accessor property ([[Get]] + is a Function, [[Set]] is a Function, [[Enumerable]] is false, + [[Configurable]] is true) to a data property +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: false, + configurable: true + }); + + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + Object.defineProperty(obj, "prop", { + value: 1001 + }); + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("get") && desc2.hasOwnProperty("value"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-557.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-557.js new file mode 100644 index 000000000..faf06bf10 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-557.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.6-4-557 +description: > + ES5 Attributes - [[Get]] attribute of accessor property ([[Get]] + is a Function, [[Set]] is a Function, [[Enumerable]] is false, + [[Configurable]] is false) is the expected function +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: false, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc.get === getFunc && obj.prop === 1001; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-558.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-558.js new file mode 100644 index 000000000..bf0ef620f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-558.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.6-4-558 +description: > + ES5 Attributes - [[Set]] attribute of accessor property ([[Get]] + is a Function, [[Set]] is a Function, [[Enumerable]] is false, + [[Configurable]] is false) is the expected function +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: false, + configurable: false + }); + + obj.prop = "overrideData"; + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return propertyDefineCorrect && desc.set === setFunc && verifySetFunc === "overrideData"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-559.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-559.js new file mode 100644 index 000000000..8076ec257 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-559.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.6-4-559 +description: > + ES5 Attributes - property ([[Get]] is a Function, [[Set]] is a + Function, [[Enumerable]] is false, [[Configurable]] is false) is + non-enumerable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: false, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + for (var p in obj) { + if (p === "prop") { + return false; + } + } + + return propertyDefineCorrect && desc.enumerable === false; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-56.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-56.js new file mode 100644 index 000000000..1b8116b42 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-56 +description: > + Object.defineProperty - 'name' property doesn't exist in 'O', test + [[Configurable]] of 'name' property is set as false if it is + absent in accessor descriptor 'desc' (8.12.9 step 4.b.i) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = {}; + var setFunc = function (value) { + obj.setVerifyHelpProp = value; + }; + var getFunc = function () { + return 10; + }; + + Object.defineProperty(obj, "property", { + set: setFunc, + get: getFunc, + enumerable: true + }); + return accessorPropertyAttributesAreCorrect(obj, "property", getFunc, setFunc, "setVerifyHelpProp", true, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-560.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-560.js new file mode 100644 index 000000000..813252e94 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-560.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.6-4-560 +description: > + ES5 Attributes - property ([[Get]] is a Function, [[Set]] is a + Function, [[Enumerable]] is false, [[Configurable]] is false) is + undeletable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: false, + configurable: false + }); + + var propertyDefineCorrect = obj.hasOwnProperty("prop"); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + delete obj.prop; + + return propertyDefineCorrect && desc.configurable === false && obj.hasOwnProperty("prop"); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-561.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-561.js new file mode 100644 index 000000000..5ae3eef61 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-561.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.6-4-561 +description: > + ES5 Attributes - fail to update [[Get]] attribute of accessor + property ([[Get]] is a Function, [[Set]] is a Function, + [[Enumerable]] is false, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: false, + configurable: false + }); + + var result1 = obj.prop === 1001; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + get: undefined + }); + + return false; + } catch (e) { + var result2 = obj.prop === 1001; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return result1 && result2 && desc1.get === getFunc && desc2.get === getFunc && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-562.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-562.js new file mode 100644 index 000000000..1f4e78050 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-562.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.6-4-562 +description: > + ES5 Attributes - fail to update [[Set]] attribute of accessor + property ([[Get]] is a Function, [[Set]] is a Function, + [[Enumerable]] is false, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: false, + configurable: false + }); + + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + set: undefined + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.set === setFunc && desc2.set === setFunc && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-563.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-563.js new file mode 100644 index 000000000..e7cd88cf9 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-563.js @@ -0,0 +1,61 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.6-4-563 +description: > + ES5 Attributes - fail to update [[Enumerable]] attribute of + accessor property ([[Get]] is a Function, [[Set]] is a Function, + [[Enumerable]] is false, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: false, + configurable: false + }); + var result1 = false; + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p1 in obj) { + if (p1 === "prop") { + result1 = true; + } + } + + try { + Object.defineProperty(obj, "prop", { + enumerable: true + }); + + return false; + } catch (e) { + var result2 = false; + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + for (var p2 in obj) { + if (p2 === "prop") { + result2 = true; + } + } + + return !result1 && !result2 && desc1.enumerable === false && desc2.enumerable === false && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-564.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-564.js new file mode 100644 index 000000000..367ef618f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-564.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.6-4-564 +description: > + ES5 Attributes - fail to update [[Configurable]] attribute of + accessor property ([[Get]] is a Function, [[Set]] is a Function, + [[Enumerable]] is false, [[Configurable]] is false) to different + value +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: false, + configurable: false + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + configurable: true + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + delete obj.prop; + + return desc1.configurable === false && desc2.configurable === false && obj.hasOwnProperty("prop") && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-565.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-565.js new file mode 100644 index 000000000..a8c115370 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-565.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.6-4-565 +description: > + ES5 Attributes - fail to update the accessor property ([[Get]] is + a Function, [[Set]] is a Function, [[Enumerable]] is false, + [[Configurable]] is false) to a data property +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var getFunc = function () { + return 1001; + }; + + var verifySetFunc = "data"; + var setFunc = function (value) { + verifySetFunc = value; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc, + set: setFunc, + enumerable: false, + configurable: false + }); + var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); + + try { + Object.defineProperty(obj, "prop", { + value: 1001 + }); + + return false; + } catch (e) { + var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); + + return desc1.hasOwnProperty("get") && !desc2.hasOwnProperty("value") && e instanceof TypeError; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-566.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-566.js new file mode 100644 index 000000000..4c64428aa --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-566.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.6-4-566 +description: > + ES5 Attributes - [[Get]] attribute is a function which has zero + argument +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var getFunc = function () { + return 2010; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.hasOwnProperty("prop") && obj.prop === 2010 && desc.get === getFunc; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-567.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-567.js new file mode 100644 index 000000000..52af0c8f5 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-567.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.6-4-567 +description: > + ES5 Attributes - [[Get]] attribute is a function which has one + argument +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var getFunc = function (arg1) { + return 2010; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.hasOwnProperty("prop") && obj.prop === 2010 && desc.get === getFunc; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-568.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-568.js new file mode 100644 index 000000000..50309a830 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-568.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.6-4-568 +description: > + ES5 Attributes - [[Get]] attribute is a function which has two + arguments +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var getFunc = function (arg1, arg2) { + return 2010; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.hasOwnProperty("prop") && obj.prop === 2010 && desc.get === getFunc; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-569.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-569.js new file mode 100644 index 000000000..05a4ac76f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-569.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.6-4-569 +description: > + ES5 Attributes - [[Get]] attribute is a function which contains + global variable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var globalVariable = 20; + var getFunc = function () { + globalVariable = 2010; + return globalVariable; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc + }); + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.hasOwnProperty("prop") && desc.get === getFunc && obj.prop === 2010 && globalVariable === 2010; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-57.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-57.js new file mode 100644 index 000000000..31a52d5c9 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-57.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.6-4-57 +description: > + Object.defineProperty - 'desc' is accessor descriptor, test + updating all attribute values of 'name' (8.12.9 step 4.b.i) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + var obj = {}; + var setFunc = function (value) { + obj.setVerifyHelpProp = value; + }; + var getFunc = function () { + return 14; + }; + + Object.defineProperty(obj, "property", { + get: function () { + return 11; + }, + set: function (value) { }, + configurable: true, + enumerable: true + }); + + Object.defineProperty(obj, "property", { + get: getFunc, + set: setFunc, + configurable: false, + enumerable: false + }); + + return accessorPropertyAttributesAreCorrect(obj, "property", getFunc, setFunc, "setVerifyHelpProp", false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-570.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-570.js new file mode 100644 index 000000000..c63ed73be --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-570.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.6-4-570 +description: > + ES5 Attributes - [[Get]] attribute is a function which doesn't + contains return statement +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var verifyExecute = false; + var getFunc = function () { + verifyExecute = true; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.hasOwnProperty("prop") && desc.get === getFunc && typeof obj.prop === "undefined" && verifyExecute; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-571.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-571.js new file mode 100644 index 000000000..8a1cb12c9 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-571.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.6-4-571 +description: > + ES5 Attributes - [[Get]] attribute is a function which involves + 'this' object into statement(s) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = { + len: 2010 + }; + var getFunc = function () { + return this; + }; + + Object.defineProperty(obj, "prop", { + get: getFunc + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.hasOwnProperty("prop") && obj.prop === obj && desc.get === getFunc; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-572.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-572.js new file mode 100644 index 000000000..203464e9c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-572.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.6-4-572 +description: > + ES5 Attributes - [[Set]] attribute is a function which has zero + argument +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var setFunc = function () { }; + + Object.defineProperty(obj, "prop", { + set: setFunc + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.hasOwnProperty("prop") && desc.set === setFunc; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-573.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-573.js new file mode 100644 index 000000000..0a163fb04 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-573.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.6-4-573 +description: > + ES5 Attributes - [[Set]] attribute is a function which has one + argument +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var verifySetFunc = 20; + var setFunc = function (value) { + verifySetFunc = value; + }; + Object.defineProperty(obj, "prop", { + set: setFunc + }); + obj.prop = 2010; + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.hasOwnProperty("prop") && desc.set === setFunc && verifySetFunc === 2010; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-574.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-574.js new file mode 100644 index 000000000..fe75f2a27 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-574.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.6-4-574 +description: > + ES5 Attributes - [[Set]] attribute is a function which has two + arguments +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var firstArg = 12; + var secondArg = 12; + + var setFunc = function (a, b) { + firstArg = a; + secondArg = b; + }; + Object.defineProperty(obj, "prop", { + set: setFunc + }); + obj.prop = 100; + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.hasOwnProperty("prop") && desc.set === setFunc && firstArg === 100 && typeof secondArg === "undefined"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-575.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-575.js new file mode 100644 index 000000000..6ba5e1a3b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-575.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.6-4-575 +description: > + ES5 Attributes - [[Set]] attribute is a function which contains + global variable +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + var globalVariable = 20; + var setFunc = function () { + globalVariable = 2010; + }; + + Object.defineProperty(obj, "prop", { + set: setFunc + }); + obj.prop = 10; + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.hasOwnProperty("prop") && desc.set === setFunc && globalVariable === 2010; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-576.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-576.js new file mode 100644 index 000000000..0755f0e2d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-576.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.6-4-576 +description: > + ES5 Attributes - [[Set]] attribute is a function which contains + return statement +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var setFunc = function () { + return 2010; + }; + + Object.defineProperty(obj, "prop", { + set: setFunc + }); + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.hasOwnProperty("prop") && desc.set === setFunc; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-577.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-577.js new file mode 100644 index 000000000..b34505910 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-577.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.6-4-577 +description: > + ES5 Attributes - [[Set]] attribute is a function which involves + 'this' object into statement(s) +includes: [runTestCase.js] +---*/ + +function testcase() { + var obj = {}; + + var setFunc = function (value) { + this.len = value; + }; + + Object.defineProperty(obj, "prop", { + set: setFunc + }); + obj.prop = 2010; + + var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + + return obj.hasOwnProperty("prop") && desc.set === setFunc && obj.len === 2010; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-578.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-578.js new file mode 100644 index 000000000..2dcb6a164 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-578.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.6-4-578 +description: > + ES5 Attributes - [[Get]] field of inherited property of + [[Prototype]] internal property is correct (String instance) +includes: [runTestCase.js] +---*/ + +function testcase() { + var data = "data"; + try { + Object.defineProperty(String.prototype, "prop", { + get: function () { + return data; + }, + set: function (value) { + data = value; + }, + enumerable: true, + configurable: true + }); + var strObj = new String(); + + return !strObj.hasOwnProperty("prop") && strObj.prop === "data"; + } finally { + delete String.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-579.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-579.js new file mode 100644 index 000000000..71b6717d8 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-579.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.6-4-579 +description: > + ES5 Attributes - Success to add property into object (Array + instance) +includes: [runTestCase.js] +---*/ + +function testcase() { + var data = "data"; + try { + Object.defineProperty(Array.prototype, "prop", { + get: function () { + return data; + }, + set: function (value) { + data = value; + }, + enumerable: true, + configurable: true + }); + var arrObj = []; + arrObj.prop = "myOwnProperty"; + + return !arrObj.hasOwnProperty("prop") && arrObj.prop === "myOwnProperty" && data === "myOwnProperty"; + } finally { + delete Array.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-58.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-58.js new file mode 100644 index 000000000..2df6ccb9c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-58.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.6-4-58 +description: > + Object.defineProperty - 'name' is data descriptor and every fields + in 'desc' is absent (8.12.9 step 5) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + obj.foo = 101; // default value of attributes: writable: true, configurable: true, enumerable: true + + Object.defineProperty(obj, "foo", {}); + return dataPropertyAttributesAreCorrect(obj, "foo", 101, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-580.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-580.js new file mode 100644 index 000000000..e9fad5a57 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-580.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.6-4-580 +description: > + ES5 Attributes - Inherited property is enumerable (Boolean + instance) +includes: [runTestCase.js] +---*/ + +function testcase() { + var data = "data"; + try { + Object.defineProperty(Boolean.prototype, "prop", { + get: function () { + return data; + }, + set: function (value) { + data = value; + }, + enumerable: true, + configurable: true + }); + var boolObj = new Boolean(); + var verifyEnumerable = false; + for (var p in boolObj) { + if(p === "prop") { + verifyEnumerable = true; + } + } + + return !boolObj.hasOwnProperty("prop") && verifyEnumerable; + } finally { + delete Boolean.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-581.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-581.js new file mode 100644 index 000000000..ee72423b6 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-581.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.6-4-581 +description: ES5 Attributes - Fail to add property into object (Number instance) +includes: [runTestCase.js] +---*/ + +function testcase() { + var data = "data"; + try { + Object.defineProperty(Number.prototype, "prop", { + get: function () { + return data; + }, + enumerable: false, + configurable: true + }); + var numObj = new Number(); + numObj.prop = "myOwnProperty"; + + return !numObj.hasOwnProperty("prop") && numObj.prop === "data" && data === "data"; + } finally { + delete Number.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-582.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-582.js new file mode 100644 index 000000000..1af5b62ce --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-582.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.6-4-582 +description: > + ES5 Attributes - Inherited property is non-enumerable (Function + instance) +includes: [runTestCase.js] +---*/ + +function testcase() { + var data = "data"; + try { + Object.defineProperty(Function.prototype, "prop", { + get: function () { + return data; + }, + enumerable: false, + configurable: true + }); + var funObj = function () { }; + var verifyEnumerable = false; + for (var p in funObj) { + if (p === "prop") { + verifyEnumerable = true; + } + } + + return !funObj.hasOwnProperty("prop") && !verifyEnumerable; + } finally { + delete Function.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-583.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-583.js new file mode 100644 index 000000000..bab9d1394 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-583.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.6-4-583 +description: > + ES5 Attributes - [[Get]] field of inherited property of + [[Prototype]] internal property is correct (Error Instance) +includes: [runTestCase.js] +---*/ + +function testcase() { + var data = "data"; + try { + Object.defineProperty(Error.prototype, "prop", { + get: function () { + return data; + }, + set: function (value) { + data = value; + }, + enumerable: true, + configurable: true + }); + var errObj = new Error(); + + return !errObj.hasOwnProperty("prop") && errObj.prop === "data"; + } finally { + delete Error.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-584.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-584.js new file mode 100644 index 000000000..a63f58747 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-584.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.6-4-584 +description: ES5 Attributes - Failed to add property into object (Date instance) +includes: [runTestCase.js] +---*/ + +function testcase() { + var data = "data"; + try { + Object.defineProperty(Date.prototype, "prop", { + get: function () { + return data; + }, + set: function (value) { + data = value; + }, + enumerable: true, + configurable: true + }); + var dateObj = new Date(); + dateObj.prop = "myOwnProperty"; + + return !dateObj.hasOwnProperty("prop") && dateObj.prop === "myOwnProperty" && data === "myOwnProperty"; + } finally { + delete Date.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-585.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-585.js new file mode 100644 index 000000000..8d33b1e58 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-585.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.6-4-585 +description: ES5 Attributes - Inherited property is enumerable (RegExp instance) +includes: [runTestCase.js] +---*/ + +function testcase() { + var data = "data"; + try { + Object.defineProperty(RegExp.prototype, "prop", { + get: function () { + return data; + }, + set: function (value) { + data = value; + }, + enumerable: true, + configurable: true + }); + var regObj = new RegExp(); + var verifyEnumerable = false; + for (var p in regObj) { + if (p === "prop") { + verifyEnumerable = true; + } + } + + return !regObj.hasOwnProperty("prop") && verifyEnumerable; + } finally { + delete RegExp.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-586.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-586.js new file mode 100644 index 000000000..9c2f6bebe --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-586.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.6-4-586 +description: > + ES5 Attributes - Fail to update value of property into of + [[Proptotype]] internal property (JSON) +includes: [runTestCase.js] +---*/ + +function testcase() { + var data = "data"; + try { + Object.defineProperty(Object.prototype, "prop", { + get: function () { + return data; + }, + enumerable: false, + configurable: true + }); + JSON.prop = "myOwnProperty"; + + return !JSON.hasOwnProperty("prop") && JSON.prop === "data" && data === "data"; + } finally { + delete Object.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-587.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-587.js new file mode 100644 index 000000000..e9f85d9b3 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-587.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.6-4-587 +description: ES5 Attributes - Inherited property is non-enumerable (Math) +includes: [runTestCase.js] +---*/ + +function testcase() { + var data = "data"; + try { + Object.defineProperty(Object.prototype, "prop", { + get: function () { + return data; + }, + enumerable: false, + configurable: true + }); + var verifyEnumerable = false; + for (var p in Math) { + if (p === "prop") { + verifyEnumerable = true; + } + } + + return !Math.hasOwnProperty("prop") && !verifyEnumerable; + } finally { + delete Object.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-588.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-588.js new file mode 100644 index 000000000..b660a5f78 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-588.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.6-4-588 +description: > + ES5 Attributes - [[Get]] field of inherited property of + [[Prototype]] internal property is correct (Object.create) +includes: [runTestCase.js] +---*/ + +function testcase() { + var appointment = {}; + + var data1 = 1001; + Object.defineProperty(appointment, "startTime", { + get: function () { + return data1; + }, + enumerable: true, + configurable: false + }); + var data2 = "NAME"; + Object.defineProperty(appointment, "name", { + get: function () { + return data2; + }, + set: function (value) { + data2 = value; + }, + enumerable: true, + configurable: true + }); + + var meeting = Object.create(appointment); + var data3 = "In-person meeting"; + Object.defineProperty(meeting, "conferenceCall", { + get: function () { + return data3; + }, + enumerable: true, + configurable: false + }); + + var teamMeeting = Object.create(meeting); + + var hasOwnProperty = !teamMeeting.hasOwnProperty("name") && + !teamMeeting.hasOwnProperty("startTime") && + !teamMeeting.hasOwnProperty('conferenceCall'); + + return hasOwnProperty && teamMeeting.name === "NAME" && + teamMeeting.startTime === 1001 && + teamMeeting.conferenceCall === "In-person meeting"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-589.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-589.js new file mode 100644 index 000000000..1ca23b7c6 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-589.js @@ -0,0 +1,68 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.6-4-589 +description: > + ES5 Attributes - Success to update value of property into of + [[Proptotype]] internal property (Object.create) +includes: [runTestCase.js] +---*/ + +function testcase() { + var appointment = {}; + + var data1 = 1001; + Object.defineProperty(appointment, "startTime", { + get: function () { + return data1; + }, + set: function (value) { + data1 = value; + }, + enumerable: true, + configurable: true + }); + var data2 = "NAME"; + Object.defineProperty(appointment, "name", { + get: function () { + return data2; + }, + set: function (value) { + data2 = value; + }, + enumerable: true, + configurable: false + }); + + var meeting = Object.create(appointment); + var data3 = "In-person meeting"; + Object.defineProperty(meeting, "conferenceCall", { + get: function () { + return data3; + }, + set: function (value) { + data3 = value; + }, + enumerable: true, + configurable: false + }); + + var teamMeeting = Object.create(meeting); + teamMeeting.name = "Team Meeting"; + var dateObj = new Date("10/31/2010 08:00"); + teamMeeting.startTime = dateObj; + teamMeeting.conferenceCall = "4255551212"; + + var hasOwnProperty = !teamMeeting.hasOwnProperty("name") && + !teamMeeting.hasOwnProperty("startTime") && + !teamMeeting.hasOwnProperty('conferenceCall'); + + return hasOwnProperty && teamMeeting.name === "Team Meeting" && + teamMeeting.startTime === dateObj && + teamMeeting.conferenceCall === "4255551212"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-59.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-59.js new file mode 100644 index 000000000..8dd4dde8f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-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.6-4-59 +description: > + Object.defineProperty - 'name' is accessor descriptor and every + fields in 'desc' is absent (8.12.9 step 5) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function getFunc() { + return 0; + } + function setFunc(value) { + obj.helpVerifySet = value; + } + + Object.defineProperty(obj, "foo", { + get: getFunc, + set: setFunc + }); + + Object.defineProperty(obj, "foo", {}); + return accessorPropertyAttributesAreCorrect(obj, "foo", getFunc, setFunc, "helpVerifySet", false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-590.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-590.js new file mode 100644 index 000000000..9369330a9 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-590.js @@ -0,0 +1,75 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.6-4-590 +description: ES5 Attributes - Inherited property is enumerable (Object.create) +includes: [runTestCase.js] +---*/ + +function testcase() { + var appointment = {}; + + var data1 = 1001; + Object.defineProperty(appointment, "startTime", { + get: function () { + return data1; + }, + set: function (value) { + data1 = value; + }, + enumerable: true, + configurable: true + }); + var data2 = "NAME"; + Object.defineProperty(appointment, "name", { + get: function () { + return data2; + }, + set: function (value) { + data2 = value; + }, + enumerable: true, + configurable: false + }); + + var meeting = Object.create(appointment); + var data3 = "In-person meeting"; + Object.defineProperty(meeting, "conferenceCall", { + get: function () { + return data3; + }, + set: function (value) { + data3 = value; + }, + enumerable: true, + configurable: false + }); + + var teamMeeting = Object.create(meeting); + + var verifyTimeProp = false; + var verifyNameProp = false; + var verifyCallProp = false; + for (var p in teamMeeting) { + if (p === "startTime") { + verifyTimeProp = true; + } + if (p === "name") { + verifyNameProp = true; + } + if (p === "conferenceCall") { + verifyCallProp = true; + } + } + + var hasOwnProperty = !teamMeeting.hasOwnProperty("name") && + !teamMeeting.hasOwnProperty("startTime") && + !teamMeeting.hasOwnProperty('conferenceCall'); + + return hasOwnProperty && verifyTimeProp && verifyNameProp && verifyCallProp; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-591.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-591.js new file mode 100644 index 000000000..c063f60b7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-591.js @@ -0,0 +1,59 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.6-4-591 +description: > + ES5 Attributes - Fail to update value of property of + [[Proptotype]] internal property (Object.create) +includes: [runTestCase.js] +---*/ + +function testcase() { + var appointment = {}; + + var data1 = 1001; + Object.defineProperty(appointment, "startTime", { + get: function () { + return data1; + }, + enumerable: false, + configurable: false + }); + var data2 = "NAME"; + Object.defineProperty(appointment, "name", { + get: function () { + return data2; + }, + enumerable: false, + configurable: true + }); + + var meeting = Object.create(appointment); + var data3 = "In-person meeting"; + Object.defineProperty(meeting, "conferenceCall", { + get: function () { + return data3; + }, + enumerable: false, + configurable: false + }); + + var teamMeeting = Object.create(meeting); + teamMeeting.name = "IE Team Meeting"; + var dateObj = new Date("10/31/2010 08:00"); + teamMeeting.startTime = dateObj; + teamMeeting.conferenceCall = "4255551212"; + + var hasOwnProperty = !teamMeeting.hasOwnProperty("name") && + !teamMeeting.hasOwnProperty("startTime") && + !teamMeeting.hasOwnProperty('conferenceCall'); + + return hasOwnProperty && teamMeeting.name === "NAME" && + teamMeeting.startTime === 1001 && + teamMeeting.conferenceCall === "In-person meeting"; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-592.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-592.js new file mode 100644 index 000000000..13131c8cc --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-592.js @@ -0,0 +1,68 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// Ecma International makes this code available under the terms and conditions set +// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +// "Use Terms"). Any redistribution of this code must retain the above +// copyright and this notice and otherwise comply with the Use Terms. + +/*--- +es5id: 15.2.3.6-4-592 +description: > + ES5 Attributes - Inherited property is non-enumerable + (Object.create) +includes: [runTestCase.js] +---*/ + +function testcase() { + var appointment = {}; + + var data1 = 1001; + Object.defineProperty(appointment, "startTime", { + get: function () { + return data1; + }, + enumerable: false, + configurable: true + }); + var data2 = "NAME"; + Object.defineProperty(appointment, "name", { + get: function () { + return data2; + }, + enumerable: false, + configurable: false + }); + + var meeting = Object.create(appointment); + var data3 = "In-person meeting"; + Object.defineProperty(meeting, "conferenceCall", { + get: function () { + return data3; + }, + enumerable: false, + configurable: true + }); + + var teamMeeting = Object.create(meeting); + + var verifyTimeProp = false; + var verifyNameProp = false; + var verifyCallProp = false; + for (var p in teamMeeting) { + if (p === "startTime") { + verifyTimeProp = true; + } + if (p === "name") { + verifyNameProp = true; + } + if (p === "conferenceCall") { + verifyCallProp = true; + } + } + + var hasOwnProperty = !teamMeeting.hasOwnProperty("name") && + !teamMeeting.hasOwnProperty("startTime") && + !teamMeeting.hasOwnProperty('conferenceCall'); + + return hasOwnProperty && !verifyTimeProp && !verifyNameProp && !verifyCallProp; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-593.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-593.js new file mode 100644 index 000000000..e1dcc0cb6 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-593.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.6-4-593 +description: > + ES5 Attributes - [[Get]] field of inherited property of + [[Prototype]] internal property is correct + (Function.prototype.bind) +includes: [runTestCase.js] +---*/ + +function testcase() { + var foo = function () { }; + var data = "data"; + try { + Object.defineProperty(Function.prototype, "prop", { + get: function () { + return data; + }, + set: function (value) { + data = value; + }, + enumerable: true, + configurable: true + }); + + var obj = foo.bind({}); + + return !obj.hasOwnProperty("prop") && obj.prop === data; + } finally { + delete Function.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-594.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-594.js new file mode 100644 index 000000000..0784e1c4c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-594.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.6-4-594 +description: > + ES5 Attributes - Success to update value of property into of + [[Proptotype]] internal property (Function.prototype.bind) +includes: [runTestCase.js] +---*/ + +function testcase() { + var foo = function () { }; + var data = "data"; + try { + Object.defineProperty(Function.prototype, "prop", { + get: function () { + return data; + }, + set: function (value) { + data = value; + }, + enumerable: true, + configurable: true + }); + + var obj = foo.bind({}); + obj.prop = "overrideData"; + + return !obj.hasOwnProperty("prop") && obj.prop === "overrideData"; + } finally { + delete Function.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-595.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-595.js new file mode 100644 index 000000000..6e67ef220 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-595.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.6-4-595 +description: > + ES5 Attributes - Inherited property is enumerable + (Function.prototype.bind) +includes: [runTestCase.js] +---*/ + +function testcase() { + var foo = function () { }; + var data = "data"; + try { + Object.defineProperty(Function.prototype, "prop", { + get: function () { + return data; + }, + set: function (value) { + data = value; + }, + enumerable: true, + configurable: true + }); + + var obj = foo.bind({}); + + var verifyEnumerable = false; + for (var p in obj) { + if (p === "prop") { + verifyEnumerable = true; + } + } + + return !obj.hasOwnProperty("prop") && verifyEnumerable; + } finally { + delete Function.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-596.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-596.js new file mode 100644 index 000000000..b0f14b119 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-596.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.6-4-596 +description: > + ES5 Attributes - Fail to update value of property into of + [[Proptotype]] internal property (Function.prototype.bind) +includes: [runTestCase.js] +---*/ + +function testcase() { + var foo = function () { }; + var data = "data"; + try { + Object.defineProperty(Function.prototype, "prop", { + get: function () { + return data; + }, + enumerable: false, + configurable: true + }); + + var obj = foo.bind({}); + obj.prop = "overrideData"; + + return !obj.hasOwnProperty("prop") && obj.prop === "data"; + } finally { + delete Function.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-597.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-597.js new file mode 100644 index 000000000..7cbde1e02 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-597.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.6-4-597 +description: > + ES5 Attributes - Inherited property is non-enumerable + (Function.prototype.bind) +includes: [runTestCase.js] +---*/ + +function testcase() { + var foo = function () { }; + var data = "data"; + try { + Object.defineProperty(Function.prototype, "prop", { + get: function () { + return data; + }, + enumerable: false, + configurable: true + }); + + var obj = foo.bind({}); + + var verifyEnumerable = false; + for (var p in obj) { + if (p === "prop") { + verifyEnumerable = true; + } + } + + return !obj.hasOwnProperty("prop") && !verifyEnumerable; + } finally { + delete Function.prototype.prop; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-598.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-598.js new file mode 100644 index 000000000..822d105d1 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-598.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.6-4-598 +description: > + ES5 Attributes - all attributes in Object.getPrototypeOf are + correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Object, "getPrototypeOf"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = Object.getPrototypeOf; + + try { + Object.getPrototypeOf = "2010"; + + var isWritable = (Object.getPrototypeOf === "2010"); + + var isEnumerable = false; + + for (var prop in Object) { + if (prop === "getPrototypeOf") { + isEnumerable = true; + } + } + + delete Object.getPrototypeOf; + + var isConfigurable = !Object.hasOwnProperty("getPrototypeOf"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(Object, "getPrototypeOf", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-599.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-599.js new file mode 100644 index 000000000..ef604a512 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-599.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.6-4-599 +description: > + ES5 Attributes - all attributes in Object.getOwnPropertyDescriptor + are correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Object, "getOwnPropertyDescriptor"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = Object.getOwnPropertyDescriptor; + + try { + Object.getOwnPropertyDescriptor = "2010"; + + var isWritable = (Object.getOwnPropertyDescriptor === "2010"); + + var isEnumerable = false; + + for (var prop in Object) { + if (prop === "getOwnPropertyDescriptor") { + isEnumerable = true; + } + } + + delete Object.getOwnPropertyDescriptor; + + var isConfigurable = !Object.hasOwnProperty("getOwnPropertyDescriptor"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(Object, "getOwnPropertyDescriptor", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-6.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-6.js new file mode 100644 index 000000000..618cb337d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-6.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. + +/*--- +info: > + Step 4 of defineProperty calls the [[DefineOwnProperty]] internal method + of O to define the property. Step 6 of [[DefineOwnProperty]] returns if + every field of desc also occurs in current and every field in desc has + the same value as current. +es5id: 15.2.3.6-4-6 +description: > + Object.defineProperty is no-op if current and desc are the same + accessor desc +includes: [runTestCase.js] +---*/ + +function testcase() { + function sameAccessorDescriptorValues(d1, d2) { + return (d1.get == d2.get && + d1.enumerable == d2.enumerable && + d1.configurable == d2.configurable); + } + + var o = {}; + + // create an accessor property with the following attributes: + // enumerable: true, configurable: true + var desc = { + get: function () {}, + enumerable: true, + configurable: true + }; + + Object.defineProperty(o, "foo", desc); + + // query for, and save, the desc. A subsequent call to defineProperty + // with the same desc should not disturb the property definition. + var d1 = Object.getOwnPropertyDescriptor(o, "foo"); + + // now, redefine the property with the same descriptor + // the property defintion should not get disturbed. + Object.defineProperty(o, "foo", desc); + + var d2 = Object.getOwnPropertyDescriptor(o, "foo"); + + if (sameAccessorDescriptorValues(d1, d2) === true) { + return true; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-60.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-60.js new file mode 100644 index 000000000..cffda3eb5 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-60.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.6-4-60 +description: > + Object.defineProperty - type of desc.value is different from type + of name.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.defineProperty(obj, "foo", { value: "abc" }); + return dataPropertyAttributesAreCorrect(obj, "foo", "abc", true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-600.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-600.js new file mode 100644 index 000000000..2b2f2f7f0 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-600.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.6-4-600 +description: > + ES5 Attributes - all attributes in Object.getOwnPropertyNames are + correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Object, "getOwnPropertyNames"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = Object.getOwnPropertyNames; + + try { + Object.getOwnPropertyNames = "2010"; + + var isWritable = (Object.getOwnPropertyNames === "2010"); + + var isEnumerable = false; + + for (var prop in Object) { + if (prop === "getOwnPropertyNames") { + isEnumerable = true; + } + } + + delete Object.getOwnPropertyNames; + + var isConfigurable = !Object.hasOwnProperty("getOwnPropertyNames"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(Object, "getOwnPropertyNames", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-601.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-601.js new file mode 100644 index 000000000..3d5f2bd61 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-601.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.6-4-601 +description: ES5 Attributes - all attributes in Object.create are correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Object, "create"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = Object.create; + + try { + Object.create = "2010"; + + var isWritable = (Object.create === "2010"); + + var isEnumerable = false; + + for (var prop in Object) { + if (prop === "create") { + isEnumerable = true; + } + } + + delete Object.create; + + var isConfigurable = !Object.hasOwnProperty("create"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(Object, "create", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-602.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-602.js new file mode 100644 index 000000000..b119e99a9 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-602.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.6-4-602 +description: > + ES5 Attributes - all attributes in Object.defineProperty are + correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Object, "defineProperty"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + var temp = Object.defineProperty; + try { + Object.defineProperty = "2010"; + + var isWritable = (Object.defineProperty === "2010"); + + var isEnumerable = false; + + for (var prop in Object) { + if (prop === "defineProperty") { + isEnumerable = true; + } + } + + delete Object.defineProperty; + + var isConfigurable = !Object.hasOwnProperty("defineProperty"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty = temp; + Object.defineProperty(Object, "defineProperty", { + enumerable: false + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-603.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-603.js new file mode 100644 index 000000000..327cb0dd6 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-603.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.6-4-603 +description: > + ES5 Attributes - all attributes in Object.defineProperties are + correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Object, "defineProperties"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = Object.defineProperties; + + try { + Object.defineProperties = "2010"; + + var isWritable = (Object.defineProperties === "2010"); + + var isEnumerable = false; + + for (var prop in Object) { + if (prop === "defineProperties") { + isEnumerable = true; + } + } + + delete Object.defineProperties; + + var isConfigurable = !Object.hasOwnProperty("defineProperties"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(Object, "defineProperties", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-604.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-604.js new file mode 100644 index 000000000..502214794 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-604.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.6-4-604 +description: ES5 Attributes - all attributes in Object.seal are correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Object, "seal"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = Object.seal; + + try { + Object.seal = "2010"; + + var isWritable = (Object.seal === "2010"); + + var isEnumerable = false; + + for (var prop in Object) { + if (prop === "seal") { + isEnumerable = true; + } + } + + delete Object.seal; + + var isConfigurable = !Object.hasOwnProperty("seal"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(Object, "seal", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-605.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-605.js new file mode 100644 index 000000000..fef986e3d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-605.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.6-4-605 +description: ES5 Attributes - all attributes in Object.freeze are correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Object, "freeze"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = Object.freeze; + + try { + Object.freeze = "2010"; + + var isWritable = (Object.freeze === "2010"); + + var isEnumerable = false; + + for (var prop in Object) { + if (prop === "freeze") { + isEnumerable = true; + } + } + + delete Object.freeze; + + var isConfigurable = !Object.hasOwnProperty("freeze"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(Object, "freeze", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-606.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-606.js new file mode 100644 index 000000000..f7d808ede --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-606.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.6-4-606 +description: > + ES5 Attributes - all attributes in Object.preventExtensions are + correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Object, "preventExtensions"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = Object.preventExtensions; + + try { + Object.preventExtensions = "2010"; + + var isWritable = (Object.preventExtensions === "2010"); + + var isEnumerable = false; + + for (var prop in Object) { + if (prop === "preventExtensions") { + isEnumerable = true; + } + } + + delete Object.preventExtensions; + + var isConfigurable = !Object.hasOwnProperty("preventExtensions"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(Object, "preventExtensions", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-607.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-607.js new file mode 100644 index 000000000..9861bfc55 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-607.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.6-4-607 +description: ES5 Attributes - all attributes in Object.isSealed are correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Object, "isSealed"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = Object.isSealed; + + try { + Object.isSealed = "2010"; + + var isWritable = (Object.isSealed === "2010"); + + var isEnumerable = false; + + for (var prop in Object) { + if (prop === "isSealed") { + isEnumerable = true; + } + } + + delete Object.isSealed; + + var isConfigurable = !Object.hasOwnProperty("isSealed"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(Object, "isSealed", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-608.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-608.js new file mode 100644 index 000000000..a247ae840 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-608.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.6-4-608 +description: ES5 Attributes - all attributes in Object.isFrozen are correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Object, "isFrozen"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = Object.isFrozen; + + try { + Object.isFrozen = "2010"; + + var isWritable = (Object.isFrozen === "2010"); + + var isEnumerable = false; + + for (var prop in Object) { + if (prop === "isFrozen") { + isEnumerable = true; + } + } + + delete Object.isFrozen; + + var isConfigurable = !Object.hasOwnProperty("isFrozen"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(Object, "isFrozen", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-609.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-609.js new file mode 100644 index 000000000..3acaae55d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-609.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.6-4-609 +description: ES5 Attributes - all attributes in Object.isExtensible are correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Object, "isExtensible"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = Object.isExtensible; + + try { + Object.isExtensible = "2010"; + + var isWritable = (Object.isExtensible === "2010"); + + var isEnumerable = false; + + for (var prop in Object) { + if (prop === "isExtensible") { + isEnumerable = true; + } + } + + delete Object.isExtensible; + + var isConfigurable = !Object.hasOwnProperty("isExtensible"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(Object, "isExtensible", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-61.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-61.js new file mode 100644 index 000000000..de032453e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-61.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.6-4-61 +description: > + Object.defineProperty - both desc.value and name.value are + undefined (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { value: undefined }); + + Object.defineProperty(obj, "foo", { value: undefined }); + return dataPropertyAttributesAreCorrect(obj, "foo", undefined, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-610.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-610.js new file mode 100644 index 000000000..bb8a1d36f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-610.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.6-4-610 +description: ES5 Attributes - all attributes in Object.keys are correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Object, "keys"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = Object.keys; + + try { + Object.keys = "2010"; + + var isWritable = (Object.keys === "2010"); + + var isEnumerable = false; + + for (var prop in Object) { + if (prop === "keys") { + isEnumerable = true; + } + } + + delete Object.keys; + + var isConfigurable = !Object.hasOwnProperty("keys"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(Object, "keys", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-611.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-611.js new file mode 100644 index 000000000..3b57df4d1 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-611.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.6-4-611 +description: > + ES5 Attributes - all attributes in Function.prototype.bind are + correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Function.prototype, "bind"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = Function.prototype.bind; + + try { + Function.prototype.bind = "2010"; + + var isWritable = (Function.prototype.bind === "2010"); + + var isEnumerable = false; + + for (var prop in Function.prototype) { + if (prop === "bind") { + isEnumerable = true; + } + } + + delete Function.prototype.bind; + + var isConfigurable = !Function.prototype.hasOwnProperty("bind"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(Function.prototype, "bind", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-612.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-612.js new file mode 100644 index 000000000..8bacb0410 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-612.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.6-4-612 +description: > + ES5 Attributes - all attributes in Array.prototype.indexOf are + correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Array.prototype, "indexOf"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = Array.prototype.indexOf; + + try { + Array.prototype.indexOf = "2010"; + + var isWritable = (Array.prototype.indexOf === "2010"); + + var isEnumerable = false; + + for (var prop in Array.prototype) { + if (prop === "indexOf") { + isEnumerable = true; + } + } + + delete Array.prototype.indexOf; + + var isConfigurable = !Array.prototype.hasOwnProperty("indexOf"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(Array.prototype, "indexOf", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-613.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-613.js new file mode 100644 index 000000000..8fa1ecfa2 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-613.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.6-4-613 +description: ES5 Attributes - all attributes in Object.lastIndexOf are correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Array.prototype, "lastIndexOf"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = Array.prototype.lastIndexOf; + + try { + Array.prototype.lastIndexOf = "2010"; + + var isWritable = (Array.prototype.lastIndexOf === "2010"); + + var isEnumerable = false; + + for (var prop in Array.prototype) { + if (prop === "lastIndexOf") { + isEnumerable = true; + } + } + + delete Array.prototype.lastIndexOf; + + var isConfigurable = !Array.prototype.hasOwnProperty("lastIndexOf"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(Array.prototype, "lastIndexOf", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-614.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-614.js new file mode 100644 index 000000000..a9f2bae48 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-614.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.6-4-614 +description: > + ES5 Attributes - all attributes in Array.prototype.every are + correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Array.prototype, "every"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = Array.prototype.every; + + try { + Array.prototype.every = "2010"; + + var isWritable = (Array.prototype.every === "2010"); + + var isEnumerable = false; + + for (var prop in Array.prototype) { + if (prop === "every") { + isEnumerable = true; + } + } + + delete Array.prototype.every; + + var isConfigurable = !Array.prototype.hasOwnProperty("every"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(Array.prototype, "every", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-615.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-615.js new file mode 100644 index 000000000..ba81a2a33 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-615.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.6-4-615 +description: ES5 Attributes - all attributes in Array.prototype.some are correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Array.prototype, "some"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = Array.prototype.some; + + try { + Array.prototype.some = "2010"; + + var isWritable = (Array.prototype.some === "2010"); + + var isEnumerable = false; + + for (var prop in Array.prototype) { + if (prop === "some") { + isEnumerable = true; + } + } + + delete Array.prototype.some; + + var isConfigurable = !Array.prototype.hasOwnProperty("some"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(Array.prototype, "some", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-616.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-616.js new file mode 100644 index 000000000..a5a27a43c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-616.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.6-4-616 +description: > + ES5 Attributes - all attributes in Array.prototype.forEach are + correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Array.prototype, "forEach"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = Array.prototype.forEach; + + try { + Array.prototype.forEach = "2010"; + + var isWritable = (Array.prototype.forEach === "2010"); + + var isEnumerable = false; + + for (var prop in Array.prototype) { + if (prop === "forEach") { + isEnumerable = true; + } + } + + delete Array.prototype.forEach; + + var isConfigurable = !Array.prototype.hasOwnProperty("forEach"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(Array.prototype, "forEach", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-617.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-617.js new file mode 100644 index 000000000..64b86a657 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-617.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.6-4-617 +description: ES5 Attributes - all attributes in Array.prototype.map are correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Array.prototype, "map"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = Array.prototype.map; + + try { + Array.prototype.map = "2010"; + + var isWritable = (Array.prototype.map === "2010"); + + var isEnumerable = false; + + for (var prop in Array.prototype) { + if (prop === "map") { + isEnumerable = true; + } + } + + delete Array.prototype.map; + + var isConfigurable = !Array.prototype.hasOwnProperty("map"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(Array.prototype, "map", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-618.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-618.js new file mode 100644 index 000000000..dacdd16af --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-618.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.6-4-618 +description: > + ES5 Attributes - all attributes in Array.prototype.filter are + correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Array.prototype, "filter"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = Array.prototype.filter; + + try { + Array.prototype.filter = "2010"; + + var isWritable = (Array.prototype.filter === "2010"); + + var isEnumerable = false; + + for (var prop in Array.prototype) { + if (prop === "filter") { + isEnumerable = true; + } + } + + delete Array.prototype.filter; + + var isConfigurable = !Array.prototype.hasOwnProperty("filter"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(Array.prototype, "filter", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-619.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-619.js new file mode 100644 index 000000000..e47dbfb2e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-619.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.6-4-619 +description: > + ES5 Attributes - all attributes in Array.prototype.reduce are + correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Array.prototype, "reduce"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = Array.prototype.reduce; + + try { + Array.prototype.reduce = "2010"; + + var isWritable = (Array.prototype.reduce === "2010"); + + var isEnumerable = false; + + for (var prop in Array.prototype) { + if (prop === "reduce") { + isEnumerable = true; + } + } + + delete Array.prototype.reduce; + + var isConfigurable = !Array.prototype.hasOwnProperty("reduce"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(Array.prototype, "reduce", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-62.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-62.js new file mode 100644 index 000000000..cba90524d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-62.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.6-4-62 +description: > + Object.defineProperty - both desc.value and name.value are null + (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { value: null }); + + Object.defineProperty(obj, "foo", { value: null }); + return dataPropertyAttributesAreCorrect(obj, "foo", null, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-620.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-620.js new file mode 100644 index 000000000..19f8972d3 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-620.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.6-4-620 +description: > + ES5 Attributes - all attributes in Array.prototype.reduceRight are + correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Array.prototype, "reduceRight"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = Array.prototype.reduceRight; + + try { + Array.prototype.reduceRight = "2010"; + + var isWritable = (Array.prototype.reduceRight === "2010"); + + var isEnumerable = false; + + for (var prop in Array.prototype) { + if (prop === "reduceRight") { + isEnumerable = true; + } + } + + delete Array.prototype.reduceRight; + + var isConfigurable = !Array.prototype.hasOwnProperty("reduceRight"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(Array.prototype, "reduceRight", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-621.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-621.js new file mode 100644 index 000000000..8280c6878 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-621.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.6-4-621 +description: > + ES5 Attributes - all attributes in String.prototype.trim are + correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(String.prototype, "trim"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = String.prototype.trim; + + try { + String.prototype.trim = "2010"; + + var isWritable = (String.prototype.trim === "2010"); + + var isEnumerable = false; + + for (var prop in String.prototype) { + if (prop === "trim") { + isEnumerable = true; + } + } + + delete String.prototype.trim; + + var isConfigurable = !String.prototype.hasOwnProperty("trim"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(String.prototype, "trim", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-622.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-622.js new file mode 100644 index 000000000..23fffd957 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-622.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.6-4-622 +description: ES5 Attributes - all attributes in Date.now are correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Date, "now"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = Date.now; + + try { + Date.now = "2010"; + + var isWritable = (Date.now === "2010"); + + var isEnumerable = false; + + for (var prop in Date) { + if (prop === "now") { + isEnumerable = true; + } + } + + delete Date.now; + + var isConfigurable = !Date.hasOwnProperty("now"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(Date, "now", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-623.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-623.js new file mode 100644 index 000000000..bb7cc9f81 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-623.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.6-4-623 +description: > + ES5 Attributes - all attributes in Date.prototype.toISOString are + correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Date.prototype, "toISOString"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = Date.prototype.toISOString; + + try { + Date.prototype.toISOString = "2010"; + + var isWritable = (Date.prototype.toISOString === "2010"); + + var isEnumerable = false; + + for (var prop in Date.prototype) { + if (prop === "toISOString") { + isEnumerable = true; + } + } + + delete Date.prototype.toISOString; + + var isConfigurable = !Date.prototype.hasOwnProperty("toISOString"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(Date.prototype, "toISOString", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-624.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-624.js new file mode 100644 index 000000000..68d0a9da5 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-624.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.6-4-624 +description: > + ES5 Attributes - all attributes in Date.prototype.toJSON are + correct +includes: [runTestCase.js] +---*/ + +function testcase() { + var desc = Object.getOwnPropertyDescriptor(Date.prototype, "toJSON"); + + var propertyAreCorrect = (desc.writable === true && desc.enumerable === false && desc.configurable === true); + + var temp = Date.prototype.toJSON; + + try { + Date.prototype.toJSON = "2010"; + + var isWritable = (Date.prototype.toJSON === "2010"); + + var isEnumerable = false; + + for (var prop in Date.prototype) { + if (prop === "toJSON") { + isEnumerable = true; + } + } + + delete Date.prototype.toJSON; + + var isConfigurable = !Date.prototype.hasOwnProperty("toJSON"); + + return propertyAreCorrect && isWritable && !isEnumerable && isConfigurable; + } finally { + Object.defineProperty(Date.prototype, "toJSON", { + value: temp, + writable: true, + enumerable: false, + configurable: true + }); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-625gs.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-625gs.js new file mode 100644 index 000000000..cabdf81e6 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-625gs.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.6-4-625gs +description: > + Globally declared variable should take precedence over + Object.prototype property of the same name +---*/ + +Object.defineProperty(Object.prototype, + "prop", + { value: 1001, writable: false, enumerable: false, configurable: false} + ); +var prop = 1002; + +if (! (this.hasOwnProperty("prop") && prop === 1002)) { + throw "this.prop should take precedence over Object.prototype.prop"; +} diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-63.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-63.js new file mode 100644 index 000000000..4d324d0f3 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-63.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.6-4-63 +description: > + Object.defineProperty - both desc.value and name.value are NaN + (8.12.9 step 6) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { value: NaN }); + + Object.defineProperty(obj, "foo", { value: NaN }); + + if (!isNaN(obj.foo)) { + return false; + } + + obj.foo = "verifyValue"; + if (obj.foo === "verifyValue") { + return false; + } + + for (var prop in obj) { + if (obj.hasOwnProperty(prop) && prop === "foo") { + return false; + } + } + + delete obj.foo; + if (!obj.hasOwnProperty("foo")) { + return false; + } + + return true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-64.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-64.js new file mode 100644 index 000000000..999ea48c5 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-64.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.6-4-64 +description: > + Object.defineProperty - desc.value = +0 and name.value = -0 + (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { value: -0 }); + + try { + Object.defineProperty(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/defineProperty/15.2.3.6-4-65.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-65.js new file mode 100644 index 000000000..3c814ee1b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-65.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.6-4-65 +description: > + Object.defineProperty - desc.value = -0 and name.value = +0 + (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { value: +0 }); + + try { + Object.defineProperty(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/defineProperty/15.2.3.6-4-66.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-66.js new file mode 100644 index 000000000..2faf1d540 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-66.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.6-4-66 +description: > + Object.defineProperty - desc.value and name.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.defineProperty(obj, "foo", { value: 102 }); + return dataPropertyAttributesAreCorrect(obj, "foo", 102, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-67.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-67.js new file mode 100644 index 000000000..8b859e124 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-67.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.6-4-67 +description: > + Object.defineProperty - both desc.value and name.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 = {}; + + Object.defineProperty(obj, "foo", { value: "abcd" }); + + Object.defineProperty(obj, "foo", { value: "abcd" }); + return dataPropertyAttributesAreCorrect(obj, "foo", "abcd", false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-68.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-68.js new file mode 100644 index 000000000..13ca0e724 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-68.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.6-4-68 +description: > + Object.defineProperty - desc.value and name.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.defineProperty(obj, "foo", { value: "fghj" }); + return dataPropertyAttributesAreCorrect(obj, "foo", "fghj", true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-69.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-69.js new file mode 100644 index 000000000..d7a79be7d --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-69.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.6-4-69 +description: > + Object.defineProperty - both desc.value and name.value 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: true }); + + Object.defineProperty(obj, "foo", { value: true }); + return dataPropertyAttributesAreCorrect(obj, "foo", true, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-7.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-7.js new file mode 100644 index 000000000..da21e20d4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-7.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. + +/*--- +info: > + Step 4 of defineProperty calls the [[DefineOwnProperty]] internal method + of O to define the property. Step 7a of [[DefineOwnProperty]] rejects if + current.[[Configurable]] is false and desc.[[Configurable]] is true. +es5id: 15.2.3.6-4-7 +description: > + Object.defineProperty throws TypeError when changing + [[Configurable]] from false to true +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // create a data valued property; all other attributes default to false. + var d1 = { value: 101, configurable: false }; + Object.defineProperty(o, "foo", d1); + + var desc = { value: 101, configurable: true }; + + try { + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError) { + // the property should remain unchanged. + var d2 = Object.getOwnPropertyDescriptor(o, "foo"); + if (d2.value === 101 && + d2.configurable === false) { + return true; + } + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-70.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-70.js new file mode 100644 index 000000000..fc8b770fb --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-70.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.6-4-70 +description: > + Object.defineProperty - desc.value and name.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.defineProperty(obj, "foo", { value: false }); + return dataPropertyAttributesAreCorrect(obj, "foo", false, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-71.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-71.js new file mode 100644 index 000000000..5d9ff1137 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-71.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.6-4-71 +description: > + Object.defineProperty - both desc.value and name.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 }; + + Object.defineProperty(obj, "foo", { value: obj1 }); + + Object.defineProperty(obj, "foo", { value: obj1 }); + return dataPropertyAttributesAreCorrect(obj, "foo", obj1, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-72.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-72.js new file mode 100644 index 000000000..8100afcb5 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-72.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.6-4-72 +description: > + Object.defineProperty - desc.value and name.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.defineProperty(obj, "foo", { value: obj2 }); + return dataPropertyAttributesAreCorrect(obj, "foo", obj2, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-73.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-73.js new file mode 100644 index 000000000..9627ae96f --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-73.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.6-4-73 +description: > + Object.defineProperty - both desc.writable and name.writable 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", { writable: false}); + + Object.defineProperty(obj, "foo", { writable: false }); + return dataPropertyAttributesAreCorrect(obj, "foo", undefined, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-74.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-74.js new file mode 100644 index 000000000..39280eaed --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-74.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.6-4-74 +description: > + Object.defineProperty - desc.writable and name.writable 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", { writable: false, configurable: true }); + + Object.defineProperty(obj, "foo", { writable: true }); + return dataPropertyAttributesAreCorrect(obj, "foo", undefined, true, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-75.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-75.js new file mode 100644 index 000000000..2cf4f2121 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-75.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.6-4-75 +description: > + Object.defineProperty - both desc.[[Get]] and name.[[Get]] are two + objects which refer to the same object (8.12.9 step 6) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function getFunc() { + return 10; + } + function setFunc(value) { + obj.helpVerifySet = value; + } + + Object.defineProperty(obj, "foo", { + get: getFunc, + set: setFunc + }); + + Object.defineProperty(obj, "foo", { get: getFunc }); + return accessorPropertyAttributesAreCorrect(obj, "foo", getFunc, setFunc, "helpVerifySet", false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-76.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-76.js new file mode 100644 index 000000000..943413aca --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-76.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.6-4-76 +description: > + Object.defineProperty - desc.[[Get]] and name.[[Get]] are two + objects which refer to the different objects (8.12.9 step 6) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function getFunc1() { + return 10; + } + function setFunc1(value) { + obj.helpVerifySet = value; + } + + Object.defineProperty(obj, "foo", { + get: getFunc1, + set: setFunc1, + configurable: true + }); + + function getFunc2() { + return 20; + } + + Object.defineProperty(obj, "foo", { get: getFunc2 }); + return accessorPropertyAttributesAreCorrect(obj, "foo", getFunc2, setFunc1, "helpVerifySet", false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-77.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-77.js new file mode 100644 index 000000000..790379319 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-77.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.6-4-77 +description: > + Object.defineProperty - both desc.[[Set]] and name.[[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 setFunc(value) { + obj.setVerifyHelpProp = value; + } + + Object.defineProperty(obj, "foo", { set: setFunc }); + + Object.defineProperty(obj, "foo", { set: setFunc }); + return accessorPropertyAttributesAreCorrect(obj, "foo", undefined, setFunc, "setVerifyHelpProp", false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-78.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-78.js new file mode 100644 index 000000000..df7d3b47a --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-78.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.6-4-78 +description: > + Object.defineProperty - desc.[[Set]] and name.[[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 setFunc1() { } + + Object.defineProperty(obj, "foo", { + set: setFunc1, + configurable: true + }); + + function setFunc2(value) { + obj.setVerifyHelpProp = value; + } + + Object.defineProperty(obj, "foo", { set: setFunc2 }); + return accessorPropertyAttributesAreCorrect(obj, "foo", undefined, setFunc2, "setVerifyHelpProp", false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-79.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-79.js new file mode 100644 index 000000000..122ec0464 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-79.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.6-4-79 +description: > + Object.defineProperty - both desc.enumerable and name.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", { enumerable: false }); + + Object.defineProperty(obj, "foo", { enumerable: false }); + return dataPropertyAttributesAreCorrect(obj, "foo", undefined, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-8.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-8.js new file mode 100644 index 000000000..3469d1cf1 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-8.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. + +/*--- +info: > + Step 4 of defineProperty calls the [[DefineOwnProperty]] internal method + of O to define the property. Step 7b of [[DefineOwnProperty]] rejects if + current.[[Enumerable]] and desc.[[Enumerable]] are the boolean negations + of each other. +es5id: 15.2.3.6-4-8 +description: > + Object.defineProperty throws TypeError when changing + [[Enumerable]] from false to true on non-configurable data + properties +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // create a data valued property; all other attributes default to false. + var d1 = { value: 101, enumerable: false, configurable: false }; + Object.defineProperty(o, "foo", d1); + + // now, setting enumerable to true should fail, since [[Configurable]] + // on the original property will be false. + var desc = { value: 101, enumerable: true }; + + try { + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError) { + // the property should remain unchanged. + var d2 = Object.getOwnPropertyDescriptor(o, "foo"); + if (d2.value === 101 && + d2.enumerable === false && + d2.configurable === false) { + return true; + } + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-80.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-80.js new file mode 100644 index 000000000..2b4cb7dcd --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-80.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.6-4-80 +description: > + Object.defineProperty - desc.enumerable and name.enumerable are + boolean negation of each other (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { enumerable: false, configurable: true }); + + Object.defineProperty(obj, "foo", { enumerable: true }); + return dataPropertyAttributesAreCorrect(obj, "foo", undefined, false, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-81.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-81.js new file mode 100644 index 000000000..f32840dfd --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-81.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.6-4-81 +description: > + Object.defineProperty - both desc.configurable and + name.configurable are booleans with the same value (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { configurable: false }); + + Object.defineProperty(obj, "foo", { configurable: false }); + return dataPropertyAttributesAreCorrect(obj, "foo", undefined, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-82-1.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-1.js new file mode 100644 index 000000000..769cd95b3 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-1.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.6-4-82-1 +description: > + Object.defineProperty - Update [[Enumerable]] attribute of 'name' + property to false successfully when [[Enumerable]] and + [[Configurable]] attributes of 'name' property are true, the + 'desc' is a generic descriptor which only contains [[Enumerable]] + attribute as false, 'name' property is a data property (8.12.9 + step 8) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + + Object.defineProperty(obj, "foo", { + enumerable: false + }); + + return dataPropertyAttributesAreCorrect(obj, "foo", 1001, true, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-82-10.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-10.js new file mode 100644 index 000000000..a05dceb4e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-10.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.6-4-82-10 +description: > + Object.defineProperty - Update [[Configurable]] attribute of + 'name' property to false successfully when [[Enumerable]] and + [[Configurable]] attributes of 'name' property are true, the + 'desc' is a generic descriptor which contains [[Enumerable]] + attribute as true and [[Configurable]] attribute is false, 'name' + property is an accessor property (8.12.9 step 8) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + obj.verifySetFunction = "data"; + var get_func = function () { + return obj.verifySetFunction; + }; + var set_func = function (value) { + obj.verifySetFunction = value; + }; + Object.defineProperty(obj, "foo", { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + }); + + Object.defineProperty(obj, "foo", { + enumerable: true, + configurable: false + }); + + return accessorPropertyAttributesAreCorrect(obj, "foo", get_func, set_func, "verifySetFunction", true, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-82-11.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-11.js new file mode 100644 index 000000000..2fac9a50e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-11.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.6-4-82-11 +description: > + Object.defineProperty - Update [[Enumerable]] and [[Configurable]] + attributes of 'name' property to false successfully when + [[Enumerable]] and [[Configurable]] attributes of 'name' property + are true, the 'desc' is a generic descriptor which contains + [[Enumerable]] and [[Configurable]] attributes as false, 'name' + property is an accessor property (8.12.9 step 8) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + obj.verifySetFunction = "data"; + var get_func = function () { + return obj.verifySetFunction; + }; + var set_func = function (value) { + obj.verifySetFunction = value; + }; + Object.defineProperty(obj, "foo", { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + }); + + Object.defineProperty(obj, "foo", { + enumerable: false, + configurable: false + }); + + return accessorPropertyAttributesAreCorrect(obj, "foo", get_func, set_func, "verifySetFunction", false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-82-12.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-12.js new file mode 100644 index 000000000..24cc41f2c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-12.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.6-4-82-12 +description: > + Object.defineProperty - Update [[Enumerable]] attributes of 'name' + property to true successfully when [[Enumerable]] attribute of + 'name' is false and [[Configurable]] attribute of 'name' is true, + the 'desc' is a generic descriptor which only contains + [[Enumerable]] attribute as true, 'name' property is an accessor + property (8.12.9 step 8) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + obj.verifySetFunction = "data"; + var get_func = function () { + return obj.verifySetFunction; + }; + var set_func = function (value) { + obj.verifySetFunction = value; + }; + Object.defineProperty(obj, "foo", { + get: get_func, + set: set_func, + enumerable: false, + configurable: true + }); + + Object.defineProperty(obj, "foo", { + enumerable: true + }); + + return accessorPropertyAttributesAreCorrect(obj, "foo", get_func, set_func, "verifySetFunction", true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-82-13.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-13.js new file mode 100644 index 000000000..ae0699c33 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-13.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.6-4-82-13 +description: > + Object.defineProperty - Update [[Enumerable]] attribute of 'name' + property to false successfully when [[Enumerable]] and + [[Configurable]] attributes of 'name' property are true, the + 'desc' is a generic descriptor which only contains [[Enumerable]] + attribute as false, 'name' property is an index data property + (8.12.9 step 8) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "0", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + + Object.defineProperty(obj, "0", { + enumerable: false + }); + + return dataPropertyAttributesAreCorrect(obj, "0", 1001, true, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-82-14.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-14.js new file mode 100644 index 000000000..ef0755d24 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-14.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.6-4-82-14 +description: > + Object.defineProperty - Update [[Enumerable]] attribute of 'name' + property to false successfully when [[Enumerable]] and + [[Configurable]] attributes of 'name' property are true, the + 'desc' is a generic descriptor which contains [[Enumerable]] + attribute as false and [[Configurable]] attribute as true, 'name' + property is an index data property (8.12.9 step 8) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "0", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + + Object.defineProperty(obj, "0", { + enumerable: false, + configurable: true + }); + + return dataPropertyAttributesAreCorrect(obj, "0", 1001, true, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-82-15.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-15.js new file mode 100644 index 000000000..b3189647c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-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.6-4-82-15 +description: > + Object.defineProperty - Update [[Configurable]] attribute of + 'name' property to false successfully when [[Configurable]] + attribute of 'name' property is true, the 'desc' is a generic + descriptor which contains [[Configurable]] attribute as false, + 'name' property is an index data property (8.12.9 step 8) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "0", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + + Object.defineProperty(obj, "0", { + configurable: false + }); + + return dataPropertyAttributesAreCorrect(obj, "0", 1001, true, true, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-82-16.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-16.js new file mode 100644 index 000000000..b4ed23d8c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-16.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.6-4-82-16 +description: > + Object.defineProperty - Update [[Configurable]] attribute of + 'name' property to false successfully when [[Enumerable]] and + [[Configurable]] attributes of 'name' property are true, the + 'desc' is a generic descriptor which contains [[Enumerable]] + attribute as true and [[Configurable]] attribute as false, 'name' + property is an index data property (8.12.9 step 8) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "0", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + + Object.defineProperty(obj, "0", { + enumerable: true, + configurable: false + }); + + return dataPropertyAttributesAreCorrect(obj, "0", 1001, true, true, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-82-17.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-17.js new file mode 100644 index 000000000..448d8c775 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-17.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.6-4-82-17 +description: > + Object.defineProperty - Update [[Enumerable]] and [[Configurable]] + attributes of 'name' property to false successfully when + [[Enumerable]] and [[Configurable]] attributes of 'name' property + are true, the 'desc' is a generic descriptor which contains + [[Enumerable]] and [[Configurable]] attributes as false, 'name' + property is an index data property (8.12.9 step 8) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "0", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + + Object.defineProperty(obj, "0", { + enumerable: false, + configurable: false + }); + + return dataPropertyAttributesAreCorrect(obj, "0", 1001, true, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-82-18.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-18.js new file mode 100644 index 000000000..614ad6039 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-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.6-4-82-18 +description: > + Object.defineProperty - Update [[Enumerable]] attribute of 'name' + property to true successfully when [[Enumerable]] attribute of + 'name' is false and [[Configurable]] attribute of 'name' is true, + the 'desc' is a generic descriptor which only contains + [[Enumerable]] attribute as true, 'name' property is an index data + property (8.12.9 step 8) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "0", { + value: 1001, + writable: true, + enumerable: false, + configurable: true + }); + + Object.defineProperty(obj, "0", { + enumerable: true + }); + + return dataPropertyAttributesAreCorrect(obj, "0", 1001, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-82-19.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-19.js new file mode 100644 index 000000000..939fd49d1 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-19.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.6-4-82-19 +description: > + Object.defineProperty - Update [[Enumerable]] attribute of 'name' + property to false successfully when [[Enumerable]] and + [[Configurable]] attributes of 'name' property are true, the + 'desc' is a generic descriptor which only contains [Enumerable]] + attribute as false and 'name' property is an index accessor + property (8.12.9 step 8) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + obj.verifySetFunction = "data"; + var get_func = function () { + return obj.verifySetFunction; + }; + var set_func = function (value) { + obj.verifySetFunction = value; + }; + Object.defineProperty(obj, "0", { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + }); + + Object.defineProperty(obj, "0", { + enumerable: false + }); + + return accessorPropertyAttributesAreCorrect(obj, "0", get_func, set_func, "verifySetFunction", false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-82-2.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-2.js new file mode 100644 index 000000000..87966dcce --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-2.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.6-4-82-2 +description: > + Object.defineProperty - Update [[Enumerable]] attribute of 'name' + property to false successfully when [[Enumerable]] and + [[Configurable]] attributes of 'name' property are true, the + 'desc' is a generic descriptor which contains [[Enumerable]] + attribute as false and [[Configurable]] attribute as true, 'name' + property is a data property (8.12.9 step 8) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + + Object.defineProperty(obj, "foo", { + enumerable: false, + configurable: true + }); + + return dataPropertyAttributesAreCorrect(obj, "foo", 1001, true, false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-82-20.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-20.js new file mode 100644 index 000000000..386f5cf2b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-20.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.6-4-82-20 +description: > + Object.defineProperty - Update [[Enumerable]] attribute of 'name' + property to false successfully when [[Enumerable]] and + [[Configurable]] attributes of 'name' property are true, the + 'desc' is a generic descriptor which contains [Enumerable]] + attribute as false and [[Configurable]] property is true, 'name' + property is an index accessor property (8.12.9 step 8) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + obj.verifySetFunction = "data"; + var get_func = function () { + return obj.verifySetFunction; + }; + var set_func = function (value) { + obj.verifySetFunction = value; + }; + Object.defineProperty(obj, "0", { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + }); + + Object.defineProperty(obj, "0", { + enumerable: false, + configurable: true + }); + + return accessorPropertyAttributesAreCorrect(obj, "0", get_func, set_func, "verifySetFunction", false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-82-21.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-21.js new file mode 100644 index 000000000..4a6e5e620 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-21.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.6-4-82-21 +description: > + Object.defineProperty - Update [[Configurable]] attribute of + 'name' property to false successfully when [[Enumerable]] and + [[Configurable]] attributes of 'name' property are true, the + 'desc' is a generic descriptor which only contains + [[Configurable]] attribute as false, 'name' property is an index + accessor property (8.12.9 step 8) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + obj.verifySetFunction = "data"; + var get_func = function () { + return obj.verifySetFunction; + }; + var set_func = function (value) { + obj.verifySetFunction = value; + }; + Object.defineProperty(obj, "0", { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + }); + + Object.defineProperty(obj, "0", { + configurable: false + }); + + return accessorPropertyAttributesAreCorrect(obj, "0", get_func, set_func, "verifySetFunction", true, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-82-22.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-22.js new file mode 100644 index 000000000..fceaa5941 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-22.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.6-4-82-22 +description: > + Object.defineProperty - Update [[Configurable]] attribute of + 'name' property to false successfully when [[Enumerable]] and + [[Configurable]] attributes of 'name' property are true, the + 'desc' is a generic descriptor which contains [[Enumerable]] + attribute as true and [[Configurable]] attribute is false, 'name' + property is an index accessor property (8.12.9 step 8) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + obj.verifySetFunction = "data"; + var get_func = function () { + return obj.verifySetFunction; + }; + var set_func = function (value) { + obj.verifySetFunction = value; + }; + Object.defineProperty(obj, "0", { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + }); + + Object.defineProperty(obj, "0", { + enumerable: true, + configurable: false + }); + + return accessorPropertyAttributesAreCorrect(obj, "0", get_func, set_func, "verifySetFunction", true, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-82-23.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-23.js new file mode 100644 index 000000000..29a637a45 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-23.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.6-4-82-23 +description: > + Object.defineProperty - Update [[Enumerable]] and [[Configurable]] + attributes of 'name' property to false successfully when + [[Enumerable]] and [[Configurable]] attributes of 'name' property + are true, the 'desc' is a generic descriptor which contains + [[Enumerable]] and [[Configurable]] attributes as false, 'name' + property is an index accessor property (8.12.9 step 8) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + obj.verifySetFunction = "data"; + var get_func = function () { + return obj.verifySetFunction; + }; + var set_func = function (value) { + obj.verifySetFunction = value; + }; + Object.defineProperty(obj, "0", { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + }); + + Object.defineProperty(obj, "0", { + enumerable: false, + configurable: false + }); + + return accessorPropertyAttributesAreCorrect(obj, "0", get_func, set_func, "verifySetFunction", false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-82-24.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-24.js new file mode 100644 index 000000000..ea8c8f96b --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-24.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.6-4-82-24 +description: > + Object.defineProperty - Update [[Enumerable]] attributes of 'name' + property to true successfully when [[Enumerable]] attribute of + 'name' is false and [[Configurable]] attribute of 'name' is true, + the 'desc' is a generic descriptor which only contains + [[Enumerable]] attribute as true, 'name' property is an index + accessor property (8.12.9 step 8) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + obj.verifySetFunction = "data"; + var get_func = function () { + return obj.verifySetFunction; + }; + var set_func = function (value) { + obj.verifySetFunction = value; + }; + Object.defineProperty(obj, "0", { + get: get_func, + set: set_func, + enumerable: false, + configurable: true + }); + + Object.defineProperty(obj, "0", { + enumerable: true + }); + + return accessorPropertyAttributesAreCorrect(obj, "0", get_func, set_func, "verifySetFunction", true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-82-3.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-3.js new file mode 100644 index 000000000..c7feb4307 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-3.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.6-4-82-3 +description: > + Object.defineProperty - Update [[Configurable]] attribute of + 'name' property to false successfully when [[Configurable]] + attribute of 'name' property is true, the 'desc' is a generic + descriptor which contains [[Configurable]] attribute as false, + 'name' property is a data property (8.12.9 step 8) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + + Object.defineProperty(obj, "foo", { + configurable: false + }); + + return dataPropertyAttributesAreCorrect(obj, "foo", 1001, true, true, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-82-4.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-4.js new file mode 100644 index 000000000..9a0acc052 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-4.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.6-4-82-4 +description: > + Object.defineProperty - Update [[Configurable]] attribute of + 'name' property to false successfully when [[Enumerable]] and + [[Configurable]] attributes of 'name' property are true, the + 'desc' is a generic descriptor which contains [[Enumerable]] + attribute as true and [[Configurable]] attribute as false, 'name' + property is a data property (8.12.9 step 8) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + + Object.defineProperty(obj, "foo", { + enumerable: true, + configurable: false + }); + + return dataPropertyAttributesAreCorrect(obj, "foo", 1001, true, true, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-82-5.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-5.js new file mode 100644 index 000000000..78a4d8594 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-5.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.6-4-82-5 +description: > + Object.defineProperty - Update [[Enumerable]] and [[Configurable]] + attributes of 'name' property to false successfully when + [[Enumerable]] and [[Configurable]] attributes of 'name' property + are true, the 'desc' is a generic descriptor which contains + [[Enumerable]] and [[Configurable]] attributes as false, 'name' + property is a data property (8.12.9 step 8) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: 1001, + writable: true, + enumerable: true, + configurable: true + }); + + Object.defineProperty(obj, "foo", { + enumerable: false, + configurable: false + }); + + return dataPropertyAttributesAreCorrect(obj, "foo", 1001, true, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-82-6.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-6.js new file mode 100644 index 000000000..1367232c3 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-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.6-4-82-6 +description: > + Object.defineProperty - Update [[Enumerable]] attribute of 'name' + property to true successfully when [[Enumerable]] attribute of + 'name' is false and [[Configurable]] attribute of 'name' is true, + the 'desc' is a generic descriptor which only contains + [[Enumerable]] attribute as true, 'name' property is a data + property (8.12.9 step 8) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: 1001, + writable: true, + enumerable: false, + configurable: true + }); + + Object.defineProperty(obj, "foo", { + enumerable: true + }); + + return dataPropertyAttributesAreCorrect(obj, "foo", 1001, true, true, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-82-7.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-7.js new file mode 100644 index 000000000..d49a50b5e --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-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.6-4-82-7 +description: > + Object.defineProperty - Update [[Enumerable]] attribute of 'name' + property to false successfully when [[Enumerable]] and + [[Configurable]] attributes of 'name' property are true, the + 'desc' is a generic descriptor which only contains [Enumerable]] + attribute as false and 'name' property is an accessor property + (8.12.9 step 8) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + obj.verifySetFunction = "data"; + var get_func = function () { + return obj.verifySetFunction; + }; + var set_func = function (value) { + obj.verifySetFunction = value; + }; + Object.defineProperty(obj, "foo", { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + }); + + Object.defineProperty(obj, "foo", { + enumerable: false + }); + + return accessorPropertyAttributesAreCorrect(obj, "foo", get_func, set_func, "verifySetFunction", false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-82-8.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-8.js new file mode 100644 index 000000000..3cad3541c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-8.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.6-4-82-8 +description: > + Object.defineProperty - Update [[Enumerable]] attribute of 'name' + property to false successfully when [[Enumerable]] and + [[Configurable]] attributes of 'name' property are true, the + 'desc' is a generic descriptor which contains [Enumerable]] + attribute as false and [[Configurable]] property is true, 'name' + property is an accessor property (8.12.9 step 8) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + obj.verifySetFunction = "data"; + var get_func = function () { + return obj.verifySetFunction; + }; + var set_func = function (value) { + obj.verifySetFunction = value; + }; + Object.defineProperty(obj, "foo", { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + }); + + Object.defineProperty(obj, "foo", { + enumerable: false, + configurable: true + }); + + return accessorPropertyAttributesAreCorrect(obj, "foo", get_func, set_func, "verifySetFunction", false, true); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-82-9.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-9.js new file mode 100644 index 000000000..a8b2def02 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-82-9.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.6-4-82-9 +description: > + Object.defineProperty - Update [[Configurable]] attribute of + 'name' property to false successfully when [[Enumerable]] and + [[Configurable]] attributes of 'name' property are true, the + 'desc' is a generic descriptor which only contains + [[Configurable]] attribute as false, 'name' property is an + accessor property (8.12.9 step 8) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + obj.verifySetFunction = "data"; + var get_func = function () { + return obj.verifySetFunction; + }; + var set_func = function (value) { + obj.verifySetFunction = value; + }; + Object.defineProperty(obj, "foo", { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + }); + + Object.defineProperty(obj, "foo", { + configurable: false + }); + + return accessorPropertyAttributesAreCorrect(obj, "foo", get_func, set_func, "verifySetFunction", true, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-82.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-82.js new file mode 100644 index 000000000..22f8911a7 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-82.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.6-4-82 +description: > + Object.defineProperty - desc.configurable and name.configurable + are boolean negation of each other (8.12.9 step 6) +includes: + - runTestCase.js + - dataPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { configurable: true }); + + Object.defineProperty(obj, "foo", { configurable: false }); + return dataPropertyAttributesAreCorrect(obj, "foo", undefined, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-83.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-83.js new file mode 100644 index 000000000..0516f9521 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-83.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.6-4-83 +description: > + Object.defineProperty will not throw TypeError if + name.configurable = false, name.writable = false, name.value = + undefined and desc.value = 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.defineProperty(obj, "foo", { + value: undefined, + writable: false, + configurable: false + }); + return dataPropertyAttributesAreCorrect(obj, "foo", undefined, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-84.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-84.js new file mode 100644 index 000000000..732f8f3d8 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-84.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.6-4-84 +description: > + Object.defineProperty will not throw TypeError if + name.configurable = false, name.writable = false, name.value = + null and desc.value = 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.defineProperty(obj, "foo", { + value: null, + writable: false, + configurable: false + }); + return dataPropertyAttributesAreCorrect(obj, "foo", null, false, false, false); + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-85.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-85.js new file mode 100644 index 000000000..fae677cac --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-85.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.6-4-85 +description: > + Object.defineProperty will not throw TypeError if + name.configurable = false, name.writable = false, name.value = NaN + and desc.value = NaN (8.12.9 step 10.a.ii.1) +includes: [runTestCase.js] +---*/ + +function testcase() { + + var obj = {}; + + Object.defineProperty(obj, "foo", { + value: NaN, + writable: false, + configurable: false + }); + + Object.defineProperty(obj, "foo", { + value: NaN, + writable: false, + configurable: false + }); + + if (!isNaN(obj.foo)) { + return false; + } + + obj.foo = "verifyValue"; + if (obj.foo === "verifyValue") { + return false; + } + + for (var prop in obj) { + if (obj.hasOwnProperty(prop) && prop === "foo") { + return false; + } + } + + delete obj.foo; + if (!obj.hasOwnProperty("foo")) { + return false; + } + + return true; + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-86.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-86.js new file mode 100644 index 000000000..70df96be6 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-86.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.6-4-86 +description: > + Object.defineProperty will throw TypeError when name.configurable + = false, name.writable = false, desc.value = +0 and name.value = + -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.defineProperty(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/defineProperty/15.2.3.6-4-87.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-87.js new file mode 100644 index 000000000..18c7b2fec --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-87.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.6-4-87 +description: > + Object.defineProperty will throw TypeError when name.configurable + = false, name.writable = false, desc.value = -0 and name.value = + +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.defineProperty(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/defineProperty/15.2.3.6-4-88.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-88.js new file mode 100644 index 000000000..de86c82c1 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-88.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.6-4-88 +description: > + Object.defineProperty will not throw TypeError when + name.configurable = false, name.writable = false, desc.value and + name.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 + }); + + try { + Object.defineProperty(obj, "foo", { value: 100 }); + return dataPropertyAttributesAreCorrect(obj, "foo", 100, false, false, false); + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-89.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-89.js new file mode 100644 index 000000000..340f34baa --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-89.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.6-4-89 +description: > + Object.defineProperty will throw TypeError when name.configurable + = false, name.writable = false, desc.value and name.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.defineProperty(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/defineProperty/15.2.3.6-4-9.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-9.js new file mode 100644 index 000000000..9e2335b11 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-9.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. + +/*--- +info: > + Step 4 of defineProperty calls the [[DefineOwnProperty]] internal method + of O to define the property. Step 7b of [[DefineOwnProperty]] rejects if + current.[[Enumerable]] and desc.[[Enumerable]] are the boolean negations + of each other. +es5id: 15.2.3.6-4-9 +description: > + Object.defineProperty throws TypeError when changing + [[Enumerable]] from true to false on non-configurable data + properties +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + + // create a data valued property with [[Enumerable]] explicitly set to true; + // all other attributes default to false. + var d1 = { value: 101, enumerable: true, configurable: false }; + Object.defineProperty(o, "foo", d1); + + // now, setting enumerable to false should fail, since [[Configurable]] + // on the original property will be false. + var desc = { value: 101, enumerable: false }; + + try { + Object.defineProperty(o, "foo", desc); + } + catch (e) { + if (e instanceof TypeError) { + // the property should remain unchanged. + var d2 = Object.getOwnPropertyDescriptor(o, "foo"); + if (d2.value === 101 && + d2.enumerable === true && + d2.configurable === false) { + return true; + } + } + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-90.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-90.js new file mode 100644 index 000000000..3557a0de8 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-90.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.6-4-90 +description: > + Object.defineProperty will not throw TypeError when + name.configurable = false, name.writable = false, desc.value and + name.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 + }); + + try { + Object.defineProperty(obj, "foo", { value: "abcd" }); + return dataPropertyAttributesAreCorrect(obj, "foo", "abcd", false, false, false); + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-91.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-91.js new file mode 100644 index 000000000..eb7d259f3 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-91.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.6-4-91 +description: > + Object.defineProperty will throw TypeError when name.configurable + = false, name.writable = false, desc.value and name.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.defineProperty(obj, "foo", { value: "fghj" }); + return false; + } catch (e) { + return e instanceof TypeError && dataPropertyAttributesAreCorrect(obj, "foo", "abcd", false, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-92.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-92.js new file mode 100644 index 000000000..fe298d2a6 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-92.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.6-4-92 +description: > + Object.defineProperty will not throw TypeError when + name.configurable = false, name.writable = false, desc.value and + name.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 + }); + + try { + Object.defineProperty(obj, "foo", { value: false }); + return dataPropertyAttributesAreCorrect(obj, "foo", false, false, false, false); + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-93.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-93.js new file mode 100644 index 000000000..4d58ee2ea --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-93.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.6-4-93 +description: > + Object.defineProperty will throw TypeError when name.configurable + = false, name.writable = false, desc.value and name.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.defineProperty(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/defineProperty/15.2.3.6-4-94.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-94.js new file mode 100644 index 000000000..c12367ddb --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-94.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.6-4-94 +description: > + Object.defineProperty will not throw TypeError when + name.configurable = false, name.writable = false, desc.value and + name.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 + }); + + try { + Object.defineProperty(obj, "foo", { value: obj1 }); + return dataPropertyAttributesAreCorrect(obj, "foo", obj1, false, false, false); + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-95.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-95.js new file mode 100644 index 000000000..a41f68314 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-95.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.6-4-95 +description: > + Object.defineProperty will throw TypeError when name.configurable + = false, name.writable = false, desc.value and name.value are two + objects which refer to the different objects (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.defineProperty(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/defineProperty/15.2.3.6-4-96.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-96.js new file mode 100644 index 000000000..ba8ab66ea --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-96.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.6-4-96 +description: > + Object.defineProperty will not throw TypeError when + name.configurable = false, both desc.[[Set]] and name.[[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 setFunc(value) { + obj.setVerifyHelpProp = value; + } + + Object.defineProperty(obj, "foo", { + set: setFunc, + configurable: false + }); + + try { + Object.defineProperty(obj, "foo", { set: setFunc }); + return accessorPropertyAttributesAreCorrect(obj, "foo", undefined, setFunc, "setVerifyHelpProp", false, false); + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-97.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-97.js new file mode 100644 index 000000000..93ec84c6c --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-97.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.6-4-97 +description: > + Object.defineProperty will throw TypeError when name.configurable + = false, name.[[Set]] is undefined, desc.[[Set]] refers to an + object (8.12.9 step 11.a.i) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function getFunc() { + return "property"; + } + + Object.defineProperty(obj, "property", { + get: getFunc, + configurable: false + }); + + try { + Object.defineProperty(obj, "property", { + get: getFunc, + set: function () { }, + configurable: false + }); + + return false; + } catch (e) { + return e instanceof TypeError && + accessorPropertyAttributesAreCorrect(obj, "property", getFunc, undefined, undefined, false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-98.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-98.js new file mode 100644 index 000000000..9b788e481 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-98.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.6-4-98 +description: > + Object.defineProperty will not throw TypeError when + name.configurable = false, both desc.[[Get]] and name.[[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 getFunc() { + return 10; + } + function setFunc(value) { + obj.verifyGetHelpMethod = value; + } + + Object.defineProperty(obj, "foo", { + get: getFunc, + set: setFunc, + configurable: false + }); + + try { + Object.defineProperty(obj, "foo", { get: getFunc }); + return accessorPropertyAttributesAreCorrect(obj, "foo", getFunc, setFunc, "verifyGetHelpMethod", false, false); + } catch (e) { + return false; + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/15.2.3.6-4-99.js b/test/built-ins/Object/defineProperty/15.2.3.6-4-99.js new file mode 100644 index 000000000..5c62c6f91 --- /dev/null +++ b/test/built-ins/Object/defineProperty/15.2.3.6-4-99.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.6-4-99 +description: > + Object.defineProperty will throw TypeError when name.configurable + = false, name.[[Get]] is undefined, desc.[[Get]] refers to an + object (8.12.9 step 11.a.ii) +includes: + - runTestCase.js + - accessorPropertyAttributesAreCorrect.js +---*/ + +function testcase() { + + var obj = {}; + + function setFunc(value) { + obj.setVerifyHelpProp = value; + } + + Object.defineProperty(obj, "foo", { + set: setFunc, + configurable: false + }); + + function getFunc() { + return 10; + } + + try { + Object.defineProperty(obj, "foo", { + get: getFunc, + set: setFunc + }); + return false; + } catch (e) { + return e instanceof TypeError && accessorPropertyAttributesAreCorrect(obj, "foo", undefined, setFunc, "setVerifyHelpProp", false, false); + } + } +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/8.12.9-9-b-i_1.js b/test/built-ins/Object/defineProperty/8.12.9-9-b-i_1.js new file mode 100644 index 000000000..f857f76c6 --- /dev/null +++ b/test/built-ins/Object/defineProperty/8.12.9-9-b-i_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: 8.12.9-9-b-i_1 +description: > + Redefine a configurable data property to be an accessor property + on a newly non-extensible object +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + Object.defineProperty(o, "foo", + { value: "hello", + configurable: true}); + Object.preventExtensions(o); + Object.defineProperty(o, "foo", { get: function() { return 5;} }); + + var fooDescrip = Object.getOwnPropertyDescriptor(o, "foo"); + return o.foo===5 && fooDescrip.get!==undefined && fooDescrip.set===undefined && fooDescrip.value===undefined && fooDescrip.configurable===true && fooDescrip.enumerable===false && fooDescrip.writable===undefined; +} +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/8.12.9-9-b-i_2.js b/test/built-ins/Object/defineProperty/8.12.9-9-b-i_2.js new file mode 100644 index 000000000..e0c90bc8b --- /dev/null +++ b/test/built-ins/Object/defineProperty/8.12.9-9-b-i_2.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: 8.12.9-9-b-i_2 +description: > + Redefine a configurable data property to be an accessor property + on a newly non-extensible object +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + Object.defineProperty(o, "foo", + { value: "hello", + configurable: true, + enumerable: true, + writable: true}); + Object.preventExtensions(o); + Object.defineProperty(o, "foo", { get: function() { return 5;} }); + + var fooDescrip = Object.getOwnPropertyDescriptor(o, "foo"); + return o.foo===5 && fooDescrip.get!==undefined && fooDescrip.set===undefined && fooDescrip.value===undefined && fooDescrip.configurable===true && fooDescrip.enumerable===true && fooDescrip.writable===undefined; +} +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/8.12.9-9-c-i_1.js b/test/built-ins/Object/defineProperty/8.12.9-9-c-i_1.js new file mode 100644 index 000000000..d314ec77a --- /dev/null +++ b/test/built-ins/Object/defineProperty/8.12.9-9-c-i_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: 8.12.9-9-c-i_1 +description: > + Redefine a configurable accessor property to be a data property on + a non-extensible object +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + Object.defineProperty(o, "foo", + { get: function() { return 5;}, + configurable: true}); + Object.preventExtensions(o); + Object.defineProperty(o, "foo", { value: "hello"}); + + var fooDescrip = Object.getOwnPropertyDescriptor(o, "foo"); + return o.foo==="hello" && fooDescrip.get===undefined && fooDescrip.set===undefined && fooDescrip.value==="hello" && fooDescrip.configurable===true && fooDescrip.enumerable===false && fooDescrip.writable===false; +} +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/8.12.9-9-c-i_2.js b/test/built-ins/Object/defineProperty/8.12.9-9-c-i_2.js new file mode 100644 index 000000000..9d8ead4d4 --- /dev/null +++ b/test/built-ins/Object/defineProperty/8.12.9-9-c-i_2.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: 8.12.9-9-c-i_2 +description: > + Redefine a configurable accessor property to be a data property on + a non-extensible object +includes: [runTestCase.js] +---*/ + +function testcase() { + var o = {}; + Object.defineProperty(o, "foo", + { get: function() { return 5;}, + configurable: true}); + Object.preventExtensions(o); + Object.defineProperty(o, "foo", + { value: "hello", + writable: true}); + + var fooDescrip = Object.getOwnPropertyDescriptor(o, "foo"); + return o.foo==="hello" && fooDescrip.get===undefined && fooDescrip.set===undefined && fooDescrip.value==="hello" && fooDescrip.configurable===true && fooDescrip.enumerable===false && fooDescrip.writable===true; +} +runTestCase(testcase); diff --git a/test/built-ins/Object/defineProperty/S15.2.3.6_A1.js b/test/built-ins/Object/defineProperty/S15.2.3.6_A1.js new file mode 100644 index 000000000..ea25f202b --- /dev/null +++ b/test/built-ins/Object/defineProperty/S15.2.3.6_A1.js @@ -0,0 +1,36 @@ +// Copyright 2011 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: > + If a particular API exists (document.createElement, as happens to + exist in a browser environment), check if the form objects it makes + obey the constraints that even host objects must obey. In this + case, that if defineProperty seems to have successfully installed a + non-configurable getter, that it is still there. +es5id: 15.2.3.6_A1 +description: Do getters on HTMLFormElements disappear? +---*/ + +function getter() { return 'gotten'; } + +if (typeof document !== 'undefined' && + typeof document.createElement === 'function') { + var f = document.createElement("form"); + var refused = false; + try { + Object.defineProperty(f, 'foo', { + get: getter, + set: void 0 + }); + } catch (err) { + // A host object may refuse to install the getter + refused = true; + } + if (!refused) { + var desc = Object.getOwnPropertyDescriptor(f, 'foo'); + if (desc.get !== getter) { + $ERROR('Getter on HTMLFormElement disappears'); + } + } +} diff --git a/test/built-ins/Object/defineProperty/S15.2.3.6_A2.js b/test/built-ins/Object/defineProperty/S15.2.3.6_A2.js new file mode 100644 index 000000000..b672f9b85 --- /dev/null +++ b/test/built-ins/Object/defineProperty/S15.2.3.6_A2.js @@ -0,0 +1,17 @@ +// Copyright 2011 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.6_A2 +description: > + Checks if an inherited accessor property appears to be an own + property. +---*/ + +var base = {}; +var derived = Object.create(base); +function getter() { return 'gotten'; } +Object.defineProperty(base, 'foo', {get: getter}); +if (derived.hasOwnProperty('foo')) { + $ERROR('Accessor properties inherit as own properties'); +} |