diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Object/defineProperties')
633 files changed, 20327 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-0-1.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-0-1.js new file mode 100644 index 0000000000..595fd74e6c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-0-1.js @@ -0,0 +1,13 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-0-1 +description: Object.defineProperties must exist as a function +---*/ + +var f = Object.defineProperties; + +assert.sameValue(typeof(f), "function", 'typeof(f)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-0-2.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-0-2.js new file mode 100644 index 0000000000..9ead28aaa7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-0-2.js @@ -0,0 +1,13 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-0-2 +description: > + Object.defineProperties must exist as a function taking 2 + parameters +---*/ + +assert.sameValue(Object.defineProperties.length, 2, 'Object.defineProperties.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-1-1.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-1-1.js new file mode 100644 index 0000000000..b1cd857ba9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-1-1.js @@ -0,0 +1,13 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-1-1 +description: Object.defineProperties throws TypeError if 'O' is undefined +---*/ + +assert.throws(TypeError, function() { + Object.defineProperties(undefined, {}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-1-2.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-1-2.js new file mode 100644 index 0000000000..480c0b3557 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-1-2.js @@ -0,0 +1,13 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-1-2 +description: Object.defineProperties throws TypeError if 'O' is null +---*/ + +assert.throws(TypeError, function() { + Object.defineProperties(null, {}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-1-3.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-1-3.js new file mode 100644 index 0000000000..f4a796deb3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-1-3.js @@ -0,0 +1,13 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-1-3 +description: Object.defineProperties throws TypeError if 'O' is a boolean +---*/ + +assert.throws(TypeError, function() { + Object.defineProperties(true, {}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-1-4.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-1-4.js new file mode 100644 index 0000000000..8bafdbc5a6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-1-4.js @@ -0,0 +1,13 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-1-4 +description: Object.defineProperties throws TypeError if 'O' is a string +---*/ + +assert.throws(TypeError, function() { + Object.defineProperties("abc", {}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-1.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-1.js new file mode 100644 index 0000000000..becbf6b9d5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-1.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-1 +description: > + Object.defineProperties throws TypeError if type of first param is + not Object +---*/ + +assert.throws(TypeError, function() { + Object.defineProperties(0, {}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-1.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-1.js new file mode 100644 index 0000000000..5be8aab224 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-1.js @@ -0,0 +1,13 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-2-1 +description: Object.defineProperties throws TypeError if 'Properties' is null +---*/ + +assert.throws(TypeError, function() { + Object.defineProperties({}, null); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-10.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-10.js new file mode 100644 index 0000000000..1e1cc79de8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-10.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-2-10 +description: Object.defineProperties - argument 'Properties' is an Array object +---*/ + +var obj = {}; +var props = []; +var result = false; + +Object.defineProperty(props, "prop", { + get: function() { + result = this instanceof Array; + return {}; + }, + enumerable: true +}); + +Object.defineProperties(obj, props); + +assert(result, 'result !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-11.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-11.js new file mode 100644 index 0000000000..abb00e902a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-11.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-2-11 +description: Object.defineProperties - argument 'Properties' is the Math object +---*/ + +var obj = {}; +var result = false; + +Object.defineProperty(Math, "prop", { + get: function() { + result = (this === Math); + return {}; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperties(obj, Math); + +assert(result, 'result !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-12.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-12.js new file mode 100644 index 0000000000..21c2512753 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-12.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-2-12 +description: Object.defineProperties - argument 'Properties' is a Date object +---*/ + +var obj = {}; +var props = new Date(); +var result = false; + +Object.defineProperty(props, "prop", { + get: function() { + result = this instanceof Date; + return {}; + }, + enumerable: true +}); + +Object.defineProperties(obj, props); + +assert(result, 'result !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-13.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-13.js new file mode 100644 index 0000000000..4bdc4bf6f9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-13.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-2-13 +description: Object.defineProperties - argument 'Properties' is a RegExp object +---*/ + +var obj = {}; +var props = new RegExp(); +var result = false; + +Object.defineProperty(props, "prop", { + get: function() { + result = this instanceof RegExp; + return {}; + }, + enumerable: true +}); + +Object.defineProperties(obj, props); + +assert(result, 'result !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-14.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-14.js new file mode 100644 index 0000000000..6fc73324d9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-14.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-2-14 +description: Object.defineProperties - argument 'Properties' is the JSON object +---*/ + +var obj = {}; +var result = false; + +Object.defineProperty(JSON, "prop", { + get: function() { + result = (this === JSON); + return {}; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperties(obj, JSON); + +assert(result, 'result !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-15.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-15.js new file mode 100644 index 0000000000..4194e960dc --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-15.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-2-15 +description: Object.defineProperties - argument 'Properties' is an Error object +---*/ + +var obj = {}; +var props = new Error("test"); +var obj1 = { + value: 11 +}; +props.description = obj1; +props.message = obj1; +props.name = obj1; + +var result = false; + +Object.defineProperty(props, "prop", { + get: function() { + result = this instanceof Error; + return {}; + }, + enumerable: true +}); + +Object.defineProperties(obj, props); + +assert(result, 'result !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-16.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-16.js new file mode 100644 index 0000000000..30757abf77 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-16.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-2-16 +description: > + Object.defineProperties - argument 'Properties' is the Arguments + object +---*/ + +var obj = {}; +var result = false; + +var Fun = function() { + return arguments; +}; +var props = new Fun(); + +Object.defineProperty(props, "prop", { + get: function() { + result = ('[object Arguments]' === Object.prototype.toString.call(this)); + return {}; + }, + enumerable: true +}); + +Object.defineProperties(obj, props); + +assert(result, 'result !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-18.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-18.js new file mode 100644 index 0000000000..f8c164658e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-18.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-2-18 +description: > + Object.defineProperties - argument 'Properties' is the global + object +---*/ + +var global = this; +var obj = {}; +var result = false; + +try { + Object.defineProperty(this, "prop", { + get: function() { + result = (this === global); + return {}; + }, + enumerable: true, + configurable: true + }); + + Object.defineProperties(obj, this); +} catch (e) { + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + result = true; +} finally { + delete this.prop; +} + +assert(result, 'result !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-2.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-2.js new file mode 100644 index 0000000000..9ae21dcdf8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-2.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-2-2 +description: > + Object.defineProperties throws TypeError if 'Properties' is + undefined +---*/ + +assert.throws(TypeError, function() { + Object.defineProperties({}, undefined); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-3.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-3.js new file mode 100644 index 0000000000..22fa8571eb --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-3.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-2-3 +description: > + Object.defineProperties - argument 'Properties' is a boolean whose + value is false +---*/ + +var obj = {}; +var obj1 = Object.defineProperties(obj, false); + +assert.sameValue(obj, obj1, 'obj'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-4.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-4.js new file mode 100644 index 0000000000..52e89e0a3f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-4.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-2-4 +description: > + Object.defineProperties - argument 'Properties' is a Boolean + object whose primitive value is true +---*/ + +var obj = {}; +var props = new Boolean(true); +var result = false; + +Object.defineProperty(props, "prop", { + get: function() { + result = this instanceof Boolean; + return {}; + }, + enumerable: true +}); + +Object.defineProperties(obj, props); + +assert(result, 'result !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-5.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-5.js new file mode 100644 index 0000000000..366f029e78 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-5.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-2-5 +description: > + Object.defineProperties - argument 'Properties' is any interesting + number +---*/ + +var obj = { + "123": 100 +}; +var obj1 = Object.defineProperties(obj, -12); + +assert.sameValue(obj, obj1, 'obj'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-6.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-6.js new file mode 100644 index 0000000000..3febcd0054 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-6.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-2-6 +description: > + Object.defineProperties - argument 'Properties' is a Number object + whose primitive value is any interesting number +---*/ + +var obj = {}; +var props = new Number(-12); +var result = false; + +Object.defineProperty(props, "prop", { + get: function() { + result = this instanceof Number; + return {}; + }, + enumerable: true +}); + +Object.defineProperties(obj, props); + +assert(result, 'result !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-7.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-7.js new file mode 100644 index 0000000000..6de1ce0196 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-7.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-2-7 +description: > + Object.defineProperties - argument 'Properties' is a string whose + value is any interesting string +---*/ + +var obj = { + "123": 100 +}; +var obj1 = Object.defineProperties(obj, ""); + +assert.sameValue(obj, obj1, 'obj'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-8.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-8.js new file mode 100644 index 0000000000..31b178f961 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-8.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-2-8 +description: > + Object.defineProperties - argument 'Properties' is a String object + whose primitive value is any interesting string +---*/ + +var obj = {}; +var props = new String(); +var result = false; + +Object.defineProperty(props, "prop", { + get: function() { + result = this instanceof String; + return {}; + }, + enumerable: true +}); + +Object.defineProperties(obj, props); + +assert(result, 'result !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-9.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-9.js new file mode 100644 index 0000000000..400144e9f8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-2-9.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-2-9 +description: > + Object.defineProperties - argument 'Properties' is a Function + object +---*/ + +var obj = {}; +var props = function() {}; +var result = false; + +Object.defineProperty(props, "prop", { + get: function() { + result = this instanceof Function; + return {}; + }, + enumerable: true +}); + +Object.defineProperties(obj, props); + +assert(result, 'result !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-3-1.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-3-1.js new file mode 100644 index 0000000000..8b723f4950 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-3-1.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-3-1 +description: > + Object.defineProperties - enumerable own data property of + 'Properties' is defined in 'O' +---*/ + +var obj = {}; +var props = {}; +Object.defineProperty(props, "prop", { + value: {}, + enumerable: true +}); + +Object.defineProperties(obj, props); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-3-2.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-3-2.js new file mode 100644 index 0000000000..058262bed0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-3-2.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-3-2 +description: > + Object.defineProperties - own data property of 'Properties' which + is not enumerable is not defined in 'O' +---*/ + +var obj = {}; +var props = {}; + +Object.defineProperty(props, "prop", { + value: {}, + enumerable: false +}); + +Object.defineProperties(obj, props); + +assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-3-3.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-3-3.js new file mode 100644 index 0000000000..b62f7b74e4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-3-3.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-3-3 +description: > + Object.defineProperties - enumerable inherited data property of + 'Properties' is not defined in 'O' +---*/ + +var obj = {}; + +var proto = {}; + +Object.defineProperty(proto, "prop", { + value: {}, + enumerable: true +}); + +var Con = function() {}; +Con.prototype = proto; +var child = new Con(); + +Object.defineProperties(obj, child); + +assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-3-4.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-3-4.js new file mode 100644 index 0000000000..8411c337bb --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-3-4.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-3-4 +description: > + Object.defineProperties - enumerable own accessor property of + 'Properties' is defined in 'O' +---*/ + +var obj = {}; + +var props = {}; + +Object.defineProperty(props, "prop", { + get: function() { + return {}; + }, + enumerable: true +}); + +Object.defineProperties(obj, props); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-3-5.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-3-5.js new file mode 100644 index 0000000000..bbe7365972 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-3-5.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-3-5 +description: > + Object.defineProperties - own accessor property of 'Properties' + which is not enumerable is not defined in 'O' +---*/ + +var obj = {}; + +var props = {}; + +Object.defineProperty(props, "prop", { + get: function() { + return {}; + }, + enumerable: false +}); + +Object.defineProperties(obj, props); + +assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-3-6.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-3-6.js new file mode 100644 index 0000000000..a55436d67e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-3-6.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-3-6 +description: > + Object.defineProperties - enumerable inherited accessor property + of 'Properties' is not defined in 'O' +---*/ + +var obj = {}; +var proto = {}; + +Object.defineProperty(proto, "prop", { + get: function() { + return {}; + }, + enumerable: true +}); + +var Con = function() {}; +Con.prototype = proto; +var child = new Con(); + +Object.defineProperties(obj, child); + +assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-3-7.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-3-7.js new file mode 100644 index 0000000000..6ca1b56f97 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-3-7.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-3-7 +description: > + Object.defineProperties - no additional property is defined in 'O' + when 'Properties' doesn't contain enumerable own property +---*/ + +var obj = {}; + +var props = {}; + +Object.defineProperty(props, "prop1", { + value: {}, + enumerable: false +}); + +Object.defineProperty(props, "prop2", { + get: function() { + return {}; + }, + enumerable: false +}); + +Object.defineProperties(obj, props); + +assert.sameValue(obj.hasOwnProperty("prop1"), false, 'obj.hasOwnProperty("prop1")'); +assert.sameValue(obj.hasOwnProperty("prop2"), false, 'obj.hasOwnProperty("prop2")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-3-8.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-3-8.js new file mode 100644 index 0000000000..152ef72746 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-3-8.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-3-8 +description: > + Object.defineProperties - no additional property is defined in 'O' + when 'Properties' doesn't contain enumerable own property +---*/ + +var obj = {}; + +var props = {}; + +Object.defineProperty(props, "prop1", { + value: {}, + enumerable: false +}); + +Object.defineProperty(props, "prop2", { + get: function() { + return {}; + }, + enumerable: true +}); + +Object.defineProperties(obj, props); + +assert.sameValue(obj.hasOwnProperty("prop1"), false, 'obj.hasOwnProperty("prop1")'); +assert(obj.hasOwnProperty("prop2"), 'obj.hasOwnProperty("prop2") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-1.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-1.js new file mode 100644 index 0000000000..b24df11a88 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-1.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-a-1 +description: > + Object.defineProperties - 'P' is own data property that overrides + enumerable inherited data property of 'Properties' is defined in + 'O' +---*/ + +var obj = {}; + +var proto = {}; + +Object.defineProperty(proto, "prop", { + value: { + value: 9 + }, + enumerable: true +}); + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); +Object.defineProperty(child, "prop", { + value: { + value: 12 + }, + enumerable: true +}); + +Object.defineProperties(obj, child); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(obj.prop, 12, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-10.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-10.js new file mode 100644 index 0000000000..8dee81ecfe --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-10.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-a-10 +description: > + Object.defineProperties - 'Properties' is a Boolean object which + implements its own [[Get]] method to get enumerable own property +---*/ + +var obj = {}; +var props = new Boolean(false); + +Object.defineProperty(props, "prop", { + value: { + value: 10 + }, + enumerable: true +}); +Object.defineProperties(obj, props); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-11.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-11.js new file mode 100644 index 0000000000..7431267848 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-11.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-a-11 +description: > + Object.defineProperties - 'Properties' is a Number object which + implements its own [[Get]] method to get enumerable own property +---*/ + +var obj = {}; +var props = new Number(-9); + +Object.defineProperty(props, "prop", { + value: { + value: 12 + }, + enumerable: true +}); +Object.defineProperties(obj, props); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(obj.prop, 12, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-12.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-12.js new file mode 100644 index 0000000000..71018a560c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-12.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-a-12 +description: > + Object.defineProperties - 'Properties' is the Math object which + implements its own [[Get]] method to get enumerable own property +---*/ + +var obj = {}; + +Math.prop = { + value: 12 +}; +Object.defineProperties(obj, Math); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(obj.prop, 12, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-13.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-13.js new file mode 100644 index 0000000000..f68b5f2eba --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-13.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-a-13 +description: > + Object.defineProperties - 'Properties' is a Date object which + implements its own [[Get]] method to get enumerable own property +---*/ + +var obj = {}; +var props = new Date(); + +Object.defineProperty(props, "prop", { + value: { + value: 13 + }, + enumerable: true +}); +Object.defineProperties(obj, props); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(obj.prop, 13, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-14.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-14.js new file mode 100644 index 0000000000..6487ef92ee --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-14.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-a-14 +description: > + Object.defineProperties - 'Properties' is a RegExp object which + implements its own [[Get]] method to get enumerable own property +---*/ + +var obj = {}; +var props = new RegExp(); + +Object.defineProperty(props, "prop", { + value: { + value: 14 + }, + enumerable: true +}); +Object.defineProperties(obj, props); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(obj.prop, 14, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-15.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-15.js new file mode 100644 index 0000000000..b50667065a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-15.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-a-15 +description: > + Object.defineProperties - 'Properties' is the JSON object which + implements its own [[Get]] method to get enumerable own property +---*/ + +var obj = {}; + +JSON.prop = { + value: 15 +}; +Object.defineProperties(obj, JSON); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(obj.prop, 15, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-16.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-16.js new file mode 100644 index 0000000000..94ece91f0d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-16.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-a-16 +description: > + Object.defineProperties - 'Properties' is an Error object which + implements its own [[Get]] method to get enumerable own property +---*/ + +var obj = {}; +var props = new Error("test"); +var obj1 = { + value: 11 +}; +props.message = obj1; +props.name = obj1; +props.description = obj1; + +props.prop = { + value: 16 +}; +Object.defineProperties(obj, props); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(obj.prop, 16, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-17.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-17.js new file mode 100644 index 0000000000..e829c3973c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-17.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-a-17 +description: > + Object.defineProperties - 'Properties' is the Arguments object + which implements its own [[Get]] method to get enumerable own + property +---*/ + +var obj = {}; +var arg; + +(function fun() { + arg = arguments; +}()); + +Object.defineProperty(arg, "prop", { + value: { + value: 17 + }, + enumerable: true +}); + +Object.defineProperties(obj, arg); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(obj.prop, 17, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-2.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-2.js new file mode 100644 index 0000000000..1c1c5f0ae0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-2.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-a-2 +description: > + Object.defineProperties - 'P' is own data property that overrides + enumerable inherited accessor property of 'Properties' is defined + in 'O' +---*/ + +var obj = {}; +var proto = {}; + +Object.defineProperty(proto, "prop", { + get: function() { + return { + value: 9 + }; + }, + enumerable: true +}); + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); +Object.defineProperty(child, "prop", { + value: { + value: 12 + }, + enumerable: true +}); +Object.defineProperties(obj, child); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(obj.prop, 12, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-3.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-3.js new file mode 100644 index 0000000000..60760a291d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-3.js @@ -0,0 +1,40 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-a-3 +description: > + Object.defineProperties - enumerable own accessor property of + 'Properties' that overrides enumerable inherited data property of + 'Properties' is defined in 'O' +---*/ + +var obj = {}; + +var proto = {}; + +Object.defineProperty(proto, "prop", { + value: { + value: 9 + }, + enumerable: true +}); + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); +Object.defineProperty(child, "prop", { + get: function() { + return { + value: 12 + }; + }, + enumerable: true +}); +Object.defineProperties(obj, child); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(obj.prop, 12, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-4.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-4.js new file mode 100644 index 0000000000..d7ab97d9d4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-4.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-a-4 +description: > + Object.defineProperties - enumerable own accessor property of + 'Properties' that overrides enumerable inherited accessor property + of 'Properties' is defined in 'O' +---*/ + +var obj = {}; + +var proto = {}; + +Object.defineProperty(proto, "prop", { + get: function() { + return { + value: 9 + }; + }, + enumerable: false +}); + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); +Object.defineProperty(child, "prop", { + get: function() { + return { + value: 12 + }; + }, + enumerable: true +}); +Object.defineProperties(obj, child); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(obj.prop, 12, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-5.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-5.js new file mode 100644 index 0000000000..1e0fe892c6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-5.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-a-5 +description: > + Object.defineProperties - enumerable own accessor property of + 'Properties' without a get function is defined in 'O' +---*/ + +var obj = {}; + +var props = {}; +Object.defineProperty(props, "prop", { + get: function() { + return { + set: function() {} + }; + }, + enumerable: true +}); + +Object.defineProperties(obj, props); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(typeof obj.prop, "undefined", 'typeof obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-6.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-6.js new file mode 100644 index 0000000000..059c12551d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-6.js @@ -0,0 +1,40 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-a-6 +description: > + Object.defineProperties - enumerable own accessor property of + 'Properties' without a get function that overrides enumerable + inherited accessor property of 'Properties' is defined in 'O' +---*/ + +var obj = {}; + +var proto = {}; + +Object.defineProperty(proto, "prop", { + get: function() { + return 12; + }, + enumerable: true +}); + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); +Object.defineProperty(child, "prop", { + get: function() { + return { + set: function() {} + }; + }, + enumerable: true +}); +Object.defineProperties(obj, child); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(typeof obj.prop, "undefined", 'typeof obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-7.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-7.js new file mode 100644 index 0000000000..4144378377 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-7.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-a-7 +description: > + Object.defineProperties - 'Properties' is a Function object which + implements its own [[Get]] method to get enumerable own property +---*/ + +var obj = {}; +var props = function() {}; + +Object.defineProperty(props, "prop", { + value: { + value: 7 + }, + enumerable: true +}); + +Object.defineProperties(obj, props); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(obj.prop, 7, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-8.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-8.js new file mode 100644 index 0000000000..a471a82b71 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-8.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-a-8 +description: > + Object.defineProperties - 'Properties' is an Array object which + implements its own [[Get]] method to get enumerable own property +---*/ + +var obj = {}; +var props = []; +var descObj = { + value: 8 +}; + +Object.defineProperty(props, "prop", { + value: descObj, + enumerable: true +}); +Object.defineProperties(obj, props); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(obj.prop, 8, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-9.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-9.js new file mode 100644 index 0000000000..e392935c71 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-a-9.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-a-9 +description: > + Object.defineProperties - 'Properties' is a String object which + implements its own [[Get]] method to get enumerable own property +---*/ + +var obj = {}; +var props = new String(); + +Object.defineProperty(props, "prop", { + value: { + value: 9 + }, + enumerable: true +}); +Object.defineProperties(obj, props); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(obj.prop, 9, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-1.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-1.js new file mode 100644 index 0000000000..7077d83271 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-1.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-1 +description: Object.defineProperties - 'descObj' is undefined (8.10.5 step 1) +---*/ + +var obj = {}; +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + prop: undefined + }); +}); +assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-10.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-10.js new file mode 100644 index 0000000000..ae1e61601b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-10.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-10 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + own data property that overrides an inherited data property + (8.10.5 step 3.a) +---*/ + +var obj = {}; +var accessed = false; + +var proto = { + enumerable: true +}; + +var Con = function() {}; +Con.prototype = proto; +var descObj = new Con(); + +Object.defineProperty(descObj, "enumerable", { + value: false +}); + +Object.defineProperties(obj, { + prop: descObj +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-100.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-100.js new file mode 100644 index 0000000000..7eaf8533f8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-100.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-100 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is Boolean object (8.10.5 step 4.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + configurable: new Boolean(true) + } +}); + +var preCheck = obj.hasOwnProperty("property"); +delete obj.property; + +assert(preCheck, 'preCheck !== true'); +assert.sameValue(obj.hasOwnProperty("property"), false, 'obj.hasOwnProperty("property")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-101.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-101.js new file mode 100644 index 0000000000..aa3c92a5a4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-101.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-101 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is Number object (8.10.5 step 4.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + configurable: new Number(-123) + } +}); +var preCheck = obj.hasOwnProperty("property"); +delete obj.property; + +assert(preCheck, 'preCheck !== true'); +assert.sameValue(obj.hasOwnProperty("property"), false, 'obj.hasOwnProperty("property")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-102.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-102.js new file mode 100644 index 0000000000..531c90f8b7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-102.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-102 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is the Math object (8.10.5 step 4.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + configurable: Math + } +}); +var preCheck = obj.hasOwnProperty("property"); +delete obj.property; + +assert(preCheck, 'preCheck !== true'); +assert.sameValue(obj.hasOwnProperty("property"), false, 'obj.hasOwnProperty("property")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-103.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-103.js new file mode 100644 index 0000000000..886e4d0551 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-103.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-103 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is Date object (8.10.5 step 4.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + configurable: new Date() + } +}); +var preCheck = obj.hasOwnProperty("property"); +delete obj.property; + +assert(preCheck, 'preCheck !== true'); +assert.sameValue(obj.hasOwnProperty("property"), false, 'obj.hasOwnProperty("property")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-104.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-104.js new file mode 100644 index 0000000000..529b0f887b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-104.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-104 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is RegExp object (8.10.5 step 4.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + configurable: new RegExp() + } +}); +var preCheck = obj.hasOwnProperty("property"); +delete obj.property; + +assert(preCheck, 'preCheck !== true'); +assert.sameValue(obj.hasOwnProperty("property"), false, 'obj.hasOwnProperty("property")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-105.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-105.js new file mode 100644 index 0000000000..a8e9e5f083 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-105.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-105 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is the JSON object (8.10.5 step 4.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + configurable: JSON + } +}); +var preCheck = obj.hasOwnProperty("property"); +delete obj.property; + +assert(preCheck, 'preCheck !== true'); +assert.sameValue(obj.hasOwnProperty("property"), false, 'obj.hasOwnProperty("property")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-106.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-106.js new file mode 100644 index 0000000000..7df020decc --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-106.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-106 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is Error object (8.10.5 step 4.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + configurable: new SyntaxError() + } +}); +var preCheck = obj.hasOwnProperty("property"); +delete obj.property; + +assert(preCheck, 'preCheck !== true'); +assert.sameValue(obj.hasOwnProperty("property"), false, 'obj.hasOwnProperty("property")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-107.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-107.js new file mode 100644 index 0000000000..62b7b65fc3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-107.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-107 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is the Argument object (8.10.5 step 4.b) +---*/ + +var obj = {}; + +var func = function(a, b, c) { + return arguments; +}; + +var args = func(1, true, "a"); + +Object.defineProperties(obj, { + property: { + configurable: args + } +}); +var preCheck = obj.hasOwnProperty("property"); +delete obj.property; + +assert(preCheck, 'preCheck !== true'); +assert.sameValue(obj.hasOwnProperty("property"), false, 'obj.hasOwnProperty("property")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-109.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-109.js new file mode 100644 index 0000000000..fcb4b1f703 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-109.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-109 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is the global object (8.10.5 step 4.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + configurable: this + } +}); +var preCheck = obj.hasOwnProperty("property"); +delete obj.property; + +assert(preCheck, 'preCheck !== true'); +assert.sameValue(obj.hasOwnProperty("property"), false, 'obj.hasOwnProperty("property")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-11.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-11.js new file mode 100644 index 0000000000..14fd972ccb --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-11.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-11 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + own data property that overrides an inherited accessor property + (8.10.5 step 3.a) +---*/ + +var obj = {}; +var proto = {}; +var accessed = false; + +Object.defineProperty(proto, "enumerable", { + get: function() { + return true; + } +}); + +var Con = function() {}; +Con.prototype = proto; +var descObj = new Con(); + +Object.defineProperty(descObj, "enumerable", { + value: false +}); + +Object.defineProperties(obj, { + prop: descObj +}); + +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-110.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-110.js new file mode 100644 index 0000000000..9725984d18 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-110.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-110 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is a string (value is 'false') which is treated as true + value (8.10.5 step 4.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + configurable: "false" + } +}); +var preCheck = obj.hasOwnProperty("property"); +delete obj.property; + +assert(preCheck, 'preCheck !== true'); +assert.sameValue(obj.hasOwnProperty("property"), false, 'obj.hasOwnProperty("property")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-111.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-111.js new file mode 100644 index 0000000000..8ae8b98916 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-111.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-111 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is new Boolean(false) which is treated as true value + (8.10.5 step 4.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + configurable: new Boolean(false) + } +}); +var preCheck = obj.hasOwnProperty("property"); +delete obj.property; + +assert(preCheck, 'preCheck !== true'); +assert.sameValue(obj.hasOwnProperty("property"), false, 'obj.hasOwnProperty("property")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-112.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-112.js new file mode 100644 index 0000000000..da4194aec2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-112.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-112 +description: > + Object.defineProperties - 'value' property of 'descObj' is present + (8.10.5 step 5) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + value: 300 + } +}); + +assert.sameValue(obj.property, 300, 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-113.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-113.js new file mode 100644 index 0000000000..f0664ba959 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-113.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-113 +description: > + Object.defineProperties - 'value' property of 'descObj' is not + present (8.10.5 step 5) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: true + } +}); + +assert(obj.hasOwnProperty("property"), 'obj.hasOwnProperty("property") !== true'); +assert.sameValue(typeof(obj.property), "undefined", 'typeof (obj.property)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-114.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-114.js new file mode 100644 index 0000000000..1d7b790ee5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-114.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-114 +description: > + Object.defineProperties - 'value' property of 'descObj' is own + data property (8.10.5 step 5.a) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + value: "ownDataProperty" + } +}); + +assert.sameValue(obj.property, "ownDataProperty", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-115.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-115.js new file mode 100644 index 0000000000..d9c437ce75 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-115.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-115 +description: > + Object.defineProperties - 'value' property of 'descObj' is + inherited data property (8.10.5 step 5.a) +---*/ + +var obj = {}; + +var proto = { + value: "inheritedDataProperty" +}; + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(obj.property, "inheritedDataProperty", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-116.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-116.js new file mode 100644 index 0000000000..7e2c075c5e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-116.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-116 +description: > + Object.defineProperties - 'value' property of 'descObj' is own + data property that overrides an inherited data property (8.10.5 + step 5.a) +---*/ + +var obj = {}; + +var proto = { + value: "inheritedDataProperty" +}; + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); + +descObj.value = "ownDataProperty"; + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(obj.property, "ownDataProperty", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-117.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-117.js new file mode 100644 index 0000000000..b58a976807 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-117.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-117 +description: > + Object.defineProperties - 'value' property of 'descObj' is own + data property that overrides an inherited accessor property + (8.10.5 step 5.a) +---*/ + +var obj = {}; + +var proto = {}; + +Object.defineProperty(proto, "value", { + get: function() { + return "inheritedAccessorProperty"; + } +}); + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); + +Object.defineProperty(descObj, "value", { + value: "ownDataProperty" +}); + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(obj.property, "ownDataProperty", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-118.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-118.js new file mode 100644 index 0000000000..ee66064b52 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-118.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-118 +description: > + Object.defineProperties - 'value' property of 'descObj' is own + accessor property (8.10.5 step 5.a) +---*/ + +var obj = {}; + +var descObj = {}; + +Object.defineProperty(descObj, "value", { + get: function() { + return "ownAccessorProperty"; + } +}); + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(obj.property, "ownAccessorProperty", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-119.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-119.js new file mode 100644 index 0000000000..f5946fc393 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-119.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-119 +description: > + Object.defineProperties - 'value' property of 'descObj' is + inherited accessor property (8.10.5 step 5.a) +---*/ + +var obj = {}; + +var proto = {}; + +Object.defineProperty(proto, "value", { + get: function() { + return "inheritedAccessorProperty"; + } +}); + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(obj.property, "inheritedAccessorProperty", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-12.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-12.js new file mode 100644 index 0000000000..f0b95e0855 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-12.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-12 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + own accessor property (8.10.5 step 3.a) +---*/ + +var obj = {}; +var accessed = false; +var descObj = {}; + +Object.defineProperty(descObj, "enumerable", { + get: function() { + return true; + } +}); + +Object.defineProperties(obj, { + prop: descObj +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-120.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-120.js new file mode 100644 index 0000000000..01189b991e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-120.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-120 +description: > + Object.defineProperties - 'value' property of 'descObj' is own + accessor property that overrides an inherited data property + (8.10.5 step 5.a) +---*/ + +var obj = {}; + +var proto = { + value: "inheritedDataProperty" +}; + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); + +Object.defineProperty(descObj, "value", { + get: function() { + return "ownAccessorProperty"; + } +}); + + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(obj.property, "ownAccessorProperty", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-121.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-121.js new file mode 100644 index 0000000000..5c0238b707 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-121.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-121 +description: > + Object.defineProperties - 'value' property of 'descObj' is own + accessor property that overrides an inherited accessor property + (8.10.5 step 5.a) +---*/ + +var obj = {}; + +var proto = {}; + +Object.defineProperty(proto, "value", { + get: function() { + return "inheritedAccessorProperty"; + } +}); + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); + +Object.defineProperty(descObj, "value", { + get: function() { + return "ownAccessorProperty"; + } +}); + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(obj.property, "ownAccessorProperty", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-122.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-122.js new file mode 100644 index 0000000000..1257d3438e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-122.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-122 +description: > + Object.defineProperties - 'value' property of 'descObj' is own + accessor property without a get function (8.10.5 step 5.a) +---*/ + +var obj = {}; + +var descObj = {}; + +Object.defineProperty(descObj, "value", { + set: function() {} +}); + +Object.defineProperties(obj, { + property: descObj +}); + +assert(obj.hasOwnProperty("property"), 'obj.hasOwnProperty("property") !== true'); +assert.sameValue(typeof(obj.property), "undefined", 'typeof (obj.property)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-123.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-123.js new file mode 100644 index 0000000000..9f95a0b1be --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-123.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-123 +description: > + Object.defineProperties - 'value' property of 'descObj' is own + accessor property without a get function that overrides an + inherited accessor property (8.10.5 step 5.a) +---*/ + +var obj = {}; + +var proto = {}; + +Object.defineProperty(proto, "value", { + get: function() { + return "inheritedAccessorProperty"; + } +}); + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); + +Object.defineProperty(descObj, "value", { + set: function() {} +}); + +Object.defineProperties(obj, { + property: descObj +}); + +assert(obj.hasOwnProperty("property"), 'obj.hasOwnProperty("property") !== true'); +assert.sameValue(typeof(obj.property), "undefined", 'typeof (obj.property)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-124.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-124.js new file mode 100644 index 0000000000..2c7bf4947b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-124.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-124 +description: > + Object.defineProperties - 'value' property of 'descObj' is + inherited accessor property without a get function (8.10.5 step + 5.a) +---*/ + +var obj = {}; + +var proto = {}; + +Object.defineProperty(proto, "value", { + set: function() {} +}); + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); + +Object.defineProperties(obj, { + property: descObj +}); + +assert(obj.hasOwnProperty("property"), 'obj.hasOwnProperty("property") !== true'); +assert.sameValue(typeof(obj.property), "undefined", 'typeof (obj.property)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-125.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-125.js new file mode 100644 index 0000000000..4253bcf633 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-125.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-125 +description: > + Object.defineProperties - 'descObj' is a Function object which + implements its own [[Get]] method to get 'value' property (8.10.5 + step 5.a) +---*/ + +var obj = {}; + +var func = function(a, b) { + return a + b; +}; + +func.value = "Function"; + +Object.defineProperties(obj, { + property: func +}); + +assert.sameValue(obj.property, "Function", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-126.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-126.js new file mode 100644 index 0000000000..a2836b72d1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-126.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-126 +description: > + Object.defineProperties - 'descObj' is an Array object which + implements its own [[Get]] method to get 'value' property (8.10.5 + step 5.a) +---*/ + +var obj = {}; + +var arr = [1, 2, 3]; + +arr.value = "Array"; + +Object.defineProperties(obj, { + property: arr +}); + +assert.sameValue(obj.property, "Array", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-127.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-127.js new file mode 100644 index 0000000000..17b87d21ef --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-127.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-127 +description: > + Object.defineProperties - 'descObj' is a String object which + implements its own [[Get]] method to get 'value' property (8.10.5 + step 5.a) +---*/ + +var obj = {}; + +var str = new String("abc"); + +str.value = "String"; + +Object.defineProperties(obj, { + property: str +}); + +assert.sameValue(obj.property, "String", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-128.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-128.js new file mode 100644 index 0000000000..831f88eabe --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-128.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-128 +description: > + Object.defineProperties - 'descObj' is a Boolean object which + implements its own [[Get]] method to get 'value' property (8.10.5 + step 5.a) +---*/ + +var obj = {}; + +var descObj = new Boolean(false); + +descObj.value = "Boolean"; + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(obj.property, "Boolean", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-129.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-129.js new file mode 100644 index 0000000000..dc8692e551 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-129.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-129 +description: > + Object.defineProperties - 'descObj' is a Number object which + implements its own [[Get]] method to get 'value' property (8.10.5 + step 5.a) +---*/ + +var obj = {}; + +var descObj = new Number(-9); + +descObj.value = "Number"; + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(obj.property, "Number", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-13.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-13.js new file mode 100644 index 0000000000..0de93ef110 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-13.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-13 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + inherited accessor property (8.10.5 step 3.a) +---*/ + +var obj = {}; +var proto = {}; +var accessed = false; + +Object.defineProperty(proto, "enumerable", { + get: function() { + return true; + } +}); + +var Con = function() {}; +Con.prototype = proto; +var descObj = new Con(); + +Object.defineProperties(obj, { + prop: descObj +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-130.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-130.js new file mode 100644 index 0000000000..42bc63e895 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-130.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-130 +description: > + Object.defineProperties - 'descObj' is the Math object which + implements its own [[Get]] method to get 'value' property (8.10.5 + step 5.a) +---*/ + +var obj = {}; + +Math.value = "Math"; + +Object.defineProperties(obj, { + property: Math +}); + +assert.sameValue(obj.property, "Math", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-131.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-131.js new file mode 100644 index 0000000000..fcf70c330b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-131.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-131 +description: > + Object.defineProperties - 'descObj' is a Date object which + implements its own [[Get]] method to get 'value' property (8.10.5 + step 5.a) +---*/ + +var obj = {}; + +var descObj = new Date(); + +descObj.value = "Date"; + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(obj.property, "Date", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-132.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-132.js new file mode 100644 index 0000000000..adc4c774af --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-132.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-132 +description: > + Object.defineProperties - 'descObj' is a RegExp object which + implements its own [[Get]] method to get 'value' property (8.10.5 + step 5.a) +---*/ + +var obj = {}; + +var descObj = new RegExp(); + +descObj.value = "RegExp"; + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(obj.property, "RegExp", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-133.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-133.js new file mode 100644 index 0000000000..8432683d13 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-133.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-133 +description: > + Object.defineProperties - 'descObj' is the JSON object which + implements its own [[Get]] method to get 'value' property (8.10.5 + step 5.a) +---*/ + +var obj = {}; + +JSON.value = "JSON"; + +Object.defineProperties(obj, { + property: JSON +}); + +assert.sameValue(obj.property, "JSON", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-134.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-134.js new file mode 100644 index 0000000000..f580540a92 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-134.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-134 +description: > + Object.defineProperties - 'descObj' is an Error object which + implements its own [[Get]] method to get 'value' property (8.10.5 + step 5.a) +---*/ + +var obj = {}; + +var descObj = new Error(); + +descObj.value = "Error"; + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(obj.property, "Error", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-135.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-135.js new file mode 100644 index 0000000000..cc20f07502 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-135.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-135 +description: > + Object.defineProperties - 'descObj' is the Arguments object which + implements its own [[Get]] method to get 'value' property (8.10.5 + step 5.a) +---*/ + +var obj = {}; + +var func = function(a, b) { + arguments.value = "arguments"; + + Object.defineProperties(obj, { + property: arguments + }); + + return obj.property === "arguments"; +}; + +assert(func(), 'func() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-137.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-137.js new file mode 100644 index 0000000000..f59becd3ce --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-137.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-137 +description: > + Object.defineProperties - 'descObj' is the global object which + implements its own [[Get]] method to get 'value' property (8.10.5 + step 5.a) +---*/ + +var obj = {}; + +this.value = "global"; + +Object.defineProperties(obj, { + property: this +}); + +assert.sameValue(obj.property, "global", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-138.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-138.js new file mode 100644 index 0000000000..1ca3793d7b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-138.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-138 +description: > + Object.defineProperties - 'writable' property of 'descObj' is + present (8.10.5 step 6) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: false + } +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-139.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-139.js new file mode 100644 index 0000000000..f73e256111 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-139.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-139 +description: > + Object.defineProperties - 'writable' property of 'descObj' is not + present (8.10.5 step 6) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + value: "abc" + } +}); + +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-14.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-14.js new file mode 100644 index 0000000000..e259f7527b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-14.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-14 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + own accessor property that overrides an inherited data property + (8.10.5 step 3.a) +---*/ + +var obj = {}; +var accessed = false; +var proto = { + enumerable: true +}; + +var Con = function() {}; +Con.prototype = proto; +var descObj = new Con(); + +Object.defineProperty(descObj, "enumerable", { + get: function() { + return false; + } +}); + +Object.defineProperties(obj, { + prop: descObj +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-140.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-140.js new file mode 100644 index 0000000000..5e059a4a76 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-140.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-140 +description: > + Object.defineProperties - 'writable' property of 'descObj' is own + data property (8.10.5 step 6.a) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: false + } +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-141.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-141.js new file mode 100644 index 0000000000..da71de2a5e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-141.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-141 +description: > + Object.defineProperties - 'writable' property of 'descObj' is + inherited data property (8.10.5 step 6.a) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +var proto = { + writable: false +}; + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); + +Object.defineProperties(obj, { + property: descObj +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-142.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-142.js new file mode 100644 index 0000000000..226a32e614 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-142.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-142 +description: > + Object.defineProperties - 'writable' property of 'descObj' is own + data property that overrides an inherited data property (8.10.5 + step 6.a) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +var proto = { + writable: true +}; + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); + +descObj.writable = false; + +Object.defineProperties(obj, { + property: descObj +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-143.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-143.js new file mode 100644 index 0000000000..0336ed473b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-143.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-143 +description: > + Object.defineProperties - 'writable' property of 'descObj' is own + data property that overrides an inherited accessor property + (8.10.5 step 6.a) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +var proto = { + value: 120 +}; + +Object.defineProperty(proto, "writable", { + get: function() { + return true; + } +}); + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); + +Object.defineProperty(descObj, "writable", { + value: false +}); + +Object.defineProperties(obj, { + property: descObj +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-144.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-144.js new file mode 100644 index 0000000000..1fc7a18431 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-144.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-144 +description: > + Object.defineProperties - 'writable' property of 'descObj' is own + accessor property (8.10.5 step 6.a) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +var descObj = {}; + +Object.defineProperty(descObj, "writable", { + get: function() { + return false; + } +}); + +Object.defineProperties(obj, { + property: descObj +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-145.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-145.js new file mode 100644 index 0000000000..9d688d232c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-145.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-145 +description: > + Object.defineProperties - 'writable' property of 'descObj' is + inherited accessor property (8.10.5 step 6.a) +---*/ + +var obj = {}; + +var proto = {}; + +Object.defineProperty(proto, "writable", { + get: function() { + return true; + } +}); + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); + +Object.defineProperties(obj, { + property: descObj +}); + +obj.property = "isWritable"; + +assert(obj.hasOwnProperty("property"), 'obj.hasOwnProperty("property") !== true'); +assert.sameValue(obj.property, "isWritable", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-146.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-146.js new file mode 100644 index 0000000000..4cd423d4aa --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-146.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-146 +description: > + Object.defineProperties - 'writable' property of 'descObj' is own + accessor property that overrides an inherited data property + (8.10.5 step 6.a) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +var proto = { + writable: true +}; + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); + +Object.defineProperty(descObj, "writable", { + get: function() { + return false; + } +}); + +Object.defineProperties(obj, { + property: descObj +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-147.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-147.js new file mode 100644 index 0000000000..8d1b4a1b50 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-147.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-147 +description: > + Object.defineProperties - 'writable' property of 'descObj' is own + accessor property that overrides an inherited accessor property + (8.10.5 step 6.a) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +var proto = {}; + +Object.defineProperty(proto, "writable", { + get: function() { + return true; + } +}); + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); + +Object.defineProperty(descObj, "writable", { + get: function() { + return false; + } +}); + +Object.defineProperties(obj, { + property: descObj +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-148.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-148.js new file mode 100644 index 0000000000..63cb98e814 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-148.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-148 +description: > + Object.defineProperties - 'writable' property of 'descObj' is own + accessor property without a get function (8.10.5 step 6.a) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +var descObj = {}; + +Object.defineProperty(descObj, "writable", { + set: function() {} +}); + +Object.defineProperties(obj, { + property: descObj +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-149.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-149.js new file mode 100644 index 0000000000..1c2556cbc8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-149.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-149 +description: > + Object.defineProperties - 'writable' property of 'descObj' is own + accessor property without a get function that overrides an + inherited accessor property (8.10.5 step 6.a) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +var proto = {}; + +Object.defineProperty(proto, "writable", { + get: function() { + return true; + } +}); + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); + +Object.defineProperty(descObj, "writable", { + set: function() {} +}); + +Object.defineProperties(obj, { + property: descObj +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-15.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-15.js new file mode 100644 index 0000000000..36a066918e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-15.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-15 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + own accessor property that overrides an inherited accessor + property (8.10.5 step 3.a) +---*/ + +var obj = {}; +var proto = {}; +var accessed = false; +Object.defineProperty(proto, "enumerable", { + get: function() { + return true; + } +}); + +var Con = function() {}; +Con.prototype = proto; +var descObj = new Con(); + +Object.defineProperty(descObj, "enumerable", { + get: function() { + return false; + } +}); + +Object.defineProperties(obj, { + prop: descObj +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-150.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-150.js new file mode 100644 index 0000000000..4c4b1717dc --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-150.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-150 +description: > + Object.defineProperties - 'writable' property of 'descObj' is + inherited accessor property without a get function (8.10.5 step + 6.a) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +var proto = {}; + +Object.defineProperty(proto, "writable", { + set: function() {} +}); + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); + +Object.defineProperties(obj, { + property: descObj +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-151.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-151.js new file mode 100644 index 0000000000..65c386d29e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-151.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-151 +description: > + Object.defineProperties - 'descObj' is a Function object which + implements its own [[Get]] method to get 'writable' property + (8.10.5 step 6.a) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +var func = function(a, b) { + return a + b; +}; + +func.writable = false; + +Object.defineProperties(obj, { + property: func +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-152.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-152.js new file mode 100644 index 0000000000..8c48fb76e7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-152.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-152 +description: > + Object.defineProperties - 'descObj' is an Array object which + implements its own [[Get]] method to get 'writable' property + (8.10.5 step 6.a) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +var arr = [1, 2, 3]; + +arr.writable = false; + +Object.defineProperties(obj, { + property: arr +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-153.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-153.js new file mode 100644 index 0000000000..bb53c4479c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-153.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-153 +description: > + Object.defineProperties - 'descObj' is a String object which + implements its own [[Get]] method to get 'writable' property + (8.10.5 step 6.a) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +var str = new String("abc"); + +str.writable = false; + +Object.defineProperties(obj, { + property: str +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-154.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-154.js new file mode 100644 index 0000000000..9169fecaa5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-154.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-154 +description: > + Object.defineProperties - 'descObj' is a Boolean object which + implements its own [[Get]] method to get 'writable' property + (8.10.5 step 6.a) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +var descObj = new Boolean(false); + +descObj.writable = false; + +Object.defineProperties(obj, { + property: descObj +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-155.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-155.js new file mode 100644 index 0000000000..9e00beb444 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-155.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-155 +description: > + Object.defineProperties - 'descObj' is a Number object which + implements its own [[Get]] method to get 'writable' property + (8.10.5 step 6.a) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +var descObj = new Number(-9); + +descObj.writable = false; + +Object.defineProperties(obj, { + property: descObj +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-156.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-156.js new file mode 100644 index 0000000000..2ecb58c0ff --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-156.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-156 +description: > + Object.defineProperties - 'descObj' is the Math object which + implements its own [[Get]] method to get 'writable' property + (8.10.5 step 6.a) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Math.writable = false; + +Object.defineProperties(obj, { + property: Math +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-157.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-157.js new file mode 100644 index 0000000000..f59bf901cf --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-157.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-157 +description: > + Object.defineProperties - 'descObj' is a Date object which + implements its own [[Get]] method to get 'writable' property + (8.10.5 step 6.a) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +var descObj = new Date(); + +descObj.writable = false; + +Object.defineProperties(obj, { + property: descObj +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-158.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-158.js new file mode 100644 index 0000000000..3dfaede9c5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-158.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-158 +description: > + Object.defineProperties - 'descObj' is a RegExp object which + implements its own [[Get]] method to get 'writable' property + (8.10.5 step 6.a) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +var descObj = new RegExp(); + +descObj.writable = false; + +Object.defineProperties(obj, { + property: descObj +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-159.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-159.js new file mode 100644 index 0000000000..8aa6779cc4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-159.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-159 +description: > + Object.defineProperties - 'descObj' is the JSON object which + implements its own [[Get]] method to get 'writable' property + (8.10.5 step 6.a) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +JSON.writable = false; + +Object.defineProperties(obj, { + property: JSON +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-16.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-16.js new file mode 100644 index 0000000000..de78e32694 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-16.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-16 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + own accessor property without a get function (8.10.5 step 3.a) +---*/ + +var obj = {}; +var accessed = false; +var descObj = {}; + +Object.defineProperty(descObj, "enumerable", { + set: function() {} +}); + +Object.defineProperties(obj, { + prop: descObj +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-160.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-160.js new file mode 100644 index 0000000000..5b32ddb731 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-160.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-160 +description: > + Object.defineProperties - 'descObj' is an Error object which + implements its own [[Get]] method to get 'writable' property + (8.10.5 step 6.a) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +var descObj = new Error(); + +descObj.writable = false; + +Object.defineProperties(obj, { + property: descObj +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-161.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-161.js new file mode 100644 index 0000000000..1b952cf469 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-161.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-161 +description: > + Object.defineProperties - 'descObj' is the Arguments object which + implements its own [[Get]] method to get 'writable' property + (8.10.5 step 6.a) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +var func = function(a, b) { + arguments.writable = false; + + Object.defineProperties(obj, { + property: arguments + }); + + assert(obj.hasOwnProperty("property")); + verifyNotWritable(obj, "property"); +}; + +func(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-163.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-163.js new file mode 100644 index 0000000000..16940fe042 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-163.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-163 +description: > + Object.defineProperties - 'descObj' is the global object which + implements its own [[Get]] method to get 'writable' property + (8.10.5 step 6.a) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +this.writable = false; + +Object.defineProperties(obj, { + property: this +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-164.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-164.js new file mode 100644 index 0000000000..46ee75a0b4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-164.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-164 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is undefined (8.10.5 step 6.b) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: undefined + } +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-165.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-165.js new file mode 100644 index 0000000000..4c84d6a35f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-165.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-165 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is null (8.10.5 step 6.b) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: null + } +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-166.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-166.js new file mode 100644 index 0000000000..d1c7d672d4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-166.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-166 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is true (8.10.5 step 6.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: true + } +}); + +obj.property = "isWritable"; + +assert.sameValue(obj.property, "isWritable", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-167.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-167.js new file mode 100644 index 0000000000..93001e24f6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-167.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-167 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is false (8.10.5 step 6.b) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: false + } +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-168.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-168.js new file mode 100644 index 0000000000..59e2d01fe4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-168.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-168 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is 0 (8.10.5 step 6.b) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: 0 + } +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-169.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-169.js new file mode 100644 index 0000000000..1482e22d29 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-169.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-169 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is +0 (8.10.5 step 6.b) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: +0 + } +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-17.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-17.js new file mode 100644 index 0000000000..52600bb9b5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-17.js @@ -0,0 +1,40 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-17 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + own accessor property without a get function that overrides an + inherited accessor property (8.10.5 step 3.a) +---*/ + +var obj = {}; +var proto = {}; +var accessed = false; +Object.defineProperty(proto, "enumerable", { + get: function() { + return false; + } +}); + +var Con = function() {}; +Con.prototype = proto; +var descObj = new Con(); + +Object.defineProperty(descObj, "enumerable", { + set: function() {} +}); + +Object.defineProperties(obj, { + prop: descObj +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-170.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-170.js new file mode 100644 index 0000000000..44fcd2d56f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-170.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-170 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is -0 (8.10.5 step 6.b) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: -0 + } +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-171.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-171.js new file mode 100644 index 0000000000..5a4d2a2dda --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-171.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-171 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is NaN (8.10.5 step 6.b) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: NaN + } +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-172.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-172.js new file mode 100644 index 0000000000..d0d034cd00 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-172.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-172 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is positive number (8.10.5 step 6.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: 123 + } +}); + +obj.property = "isWritable"; + +assert.sameValue(obj.property, "isWritable", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-173.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-173.js new file mode 100644 index 0000000000..fc091a0eb5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-173.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-173 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is negative number (8.10.5 step 6.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: -123 + } +}); + +obj.property = "isWritable"; + +assert.sameValue(obj.property, "isWritable", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-174.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-174.js new file mode 100644 index 0000000000..d018248861 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-174.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-174 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is empty string (8.10.5 step 6.b) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: "" + } +}); + +assert(obj.hasOwnProperty("property")); +verifyNotWritable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-175.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-175.js new file mode 100644 index 0000000000..61d33767cc --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-175.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-175 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is non-empty string (8.10.5 step 6.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: "abc" + } +}); + +obj.property = "isWritable"; + +assert.sameValue(obj.property, "isWritable", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-176.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-176.js new file mode 100644 index 0000000000..9a022d7ae2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-176.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-176 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is Function object (8.10.5 step 6.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: function() {} + } +}); + +obj.property = "isWritable"; + +assert.sameValue(obj.property, "isWritable", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-177.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-177.js new file mode 100644 index 0000000000..76d32801ee --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-177.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-177 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is Array object (8.10.5 step 6.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: [] + } +}); + +obj.property = "isWritable"; + +assert.sameValue(obj.property, "isWritable", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-178.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-178.js new file mode 100644 index 0000000000..456bd594cc --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-178.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-178 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is String object (8.10.5 step 6.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: new String("abc") + } +}); + +obj.property = "isWritable"; + +assert.sameValue(obj.property, "isWritable", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-179.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-179.js new file mode 100644 index 0000000000..902dae0048 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-179.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-179 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is Boolean object (8.10.5 step 6.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: new Boolean(true) + } +}); + +obj.property = "isWritable"; + +assert.sameValue(obj.property, "isWritable", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-18.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-18.js new file mode 100644 index 0000000000..115d59f7c7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-18.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-18 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + inherited accessor property without a get function (8.10.5 step + 3.a) +---*/ + +var obj = {}; +var proto = {}; +var accessed = false; + +Object.defineProperty(proto, "enumerable", { + set: function() {} +}); + +var Con = function() {}; +Con.prototype = proto; +var descObj = new Con(); + +Object.defineProperties(obj, { + prop: descObj +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-180.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-180.js new file mode 100644 index 0000000000..d4b8293b6d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-180.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-180 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is Number object (8.10.5 step 6.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: new Number(123) + } +}); + +obj.property = "isWritable"; + +assert.sameValue(obj.property, "isWritable", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-181.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-181.js new file mode 100644 index 0000000000..58cdff2505 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-181.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-181 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is the Math object (8.10.5 step 6.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: Math + } +}); + +obj.property = "isWritable"; + +assert.sameValue(obj.property, "isWritable", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-182.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-182.js new file mode 100644 index 0000000000..3dc3662583 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-182.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-182 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is Date object (8.10.5 step 6.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: new Date() + } +}); + +obj.property = "isWritable"; + +assert.sameValue(obj.property, "isWritable", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-183.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-183.js new file mode 100644 index 0000000000..7c70cd4a50 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-183.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-183 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is RegExp object (8.10.5 step 6.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: new RegExp() + } +}); + +obj.property = "isWritable"; + +assert.sameValue(obj.property, "isWritable", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-184.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-184.js new file mode 100644 index 0000000000..63848ba168 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-184.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-184 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is the JSON object (8.10.5 step 6.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: JSON + } +}); + +obj.property = "isWritable"; + +assert.sameValue(obj.property, "isWritable", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-185.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-185.js new file mode 100644 index 0000000000..487554fccb --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-185.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-185 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is Error object (8.10.5 step 6.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: new SyntaxError() + } +}); + +obj.property = "isWritable"; + +assert.sameValue(obj.property, "isWritable", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-186.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-186.js new file mode 100644 index 0000000000..eafc90c61e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-186.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-186 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is the Argument object (8.10.5 step 6.b) +---*/ + +var obj = {}; + +var func = function(a, b, c) { + return arguments; +}; + +Object.defineProperties(obj, { + property: { + writable: func(1, true, "a") + } +}); + +obj.property = "isWritable"; + +assert.sameValue(obj.property, "isWritable", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-188.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-188.js new file mode 100644 index 0000000000..fa1781ff2e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-188.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-188 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is the global object (8.10.5 step 6.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: this + } +}); + +obj.property = "isWritable"; + +assert.sameValue(obj.property, "isWritable", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-189.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-189.js new file mode 100644 index 0000000000..b0c12c9ce0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-189.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-189 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is a string (value is 'false') which is treated as true + value (8.10.5 step 6.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: "false" + } +}); + +obj.property = "isWritable"; + +assert.sameValue(obj.property, "isWritable", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-19.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-19.js new file mode 100644 index 0000000000..ca695c17fc --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-19.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-19 +description: > + Object.defineProperties - 'descObj' is a Function object which + implements its own [[Get]] method to get 'enumerable' property + (8.10.5 step 3.a) +---*/ + +var obj = {}; +var descObj = function() {}; +var accessed = false; + +descObj.enumerable = true; + +Object.defineProperties(obj, { + prop: descObj +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-190.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-190.js new file mode 100644 index 0000000000..845386a41a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-190.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-190 +description: > + Object.defineProperties - value of 'writable' property of + 'descObj' is new Boolean(false) which is treated as true value + (8.10.5 step 6.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + writable: new Boolean(false) + } +}); + +obj.property = "isWritable"; + +assert.sameValue(obj.property, "isWritable", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-191.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-191.js new file mode 100644 index 0000000000..5cb05680e8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-191.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-191 +description: > + Object.defineProperties - 'get' property of 'descObj' is present + (8.10.5 step 7) +---*/ + +var obj = {}; + +var getter = function() { + return "present"; +}; + +Object.defineProperties(obj, { + property: { + get: getter + } +}); + +assert.sameValue(obj.property, "present", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-192.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-192.js new file mode 100644 index 0000000000..419ca5a692 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-192.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-192 +description: > + Object.defineProperties - 'get' property of 'descObj' is not + present (8.10.5 step 7) +---*/ + +var obj = {}; + +var setter = function() {}; + +Object.defineProperties(obj, { + property: { + set: setter + } +}); + +assert(obj.hasOwnProperty("property"), 'obj.hasOwnProperty("property") !== true'); +assert.sameValue(typeof(obj.property), "undefined", 'typeof (obj.property)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-193.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-193.js new file mode 100644 index 0000000000..34d38293aa --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-193.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-193 +description: > + Object.defineProperties - 'get' property of 'descObj' is own data + property (8.10.5 step 7.a) +---*/ + +var obj = {}; + +var getter = function() { + return "ownDataProperty"; +}; + +Object.defineProperties(obj, { + property: { + get: getter + } +}); + +assert.sameValue(obj.property, "ownDataProperty", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-194.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-194.js new file mode 100644 index 0000000000..476c6c3001 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-194.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-194 +description: > + Object.defineProperties - 'get' property of 'descObj' is inherited + data property (8.10.5 step 7.a) +---*/ + +var obj = {}; + +var getter = function() { + return "inheritedDataProperty"; +}; + +var proto = { + get: getter +}; + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(obj.property, "inheritedDataProperty", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-195.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-195.js new file mode 100644 index 0000000000..ba7f87bf24 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-195.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-195 +description: > + Object.defineProperties - 'get' property of 'descObj' is own data + property that overrides an inherited data property (8.10.5 step + 7.a) +---*/ + +var obj = {}; + +var getter = function() { + return "inheritedDataProperty"; +}; + +var proto = { + get: getter +}; + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); + +descObj.get = function() { + return "ownDataProperty"; +}; + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(obj.property, "ownDataProperty", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-196.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-196.js new file mode 100644 index 0000000000..16800c518b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-196.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-196 +description: > + Object.defineProperties - 'get' property of 'descObj' is own data + property that overrides an inherited accessor property (8.10.5 + step 7.a) +---*/ + +var obj = {}; + +var proto = {}; + +Object.defineProperty(proto, "get", { + get: function() { + return function() { + return "inheritedAccessorProperty"; + }; + } +}); + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); + +Object.defineProperty(descObj, "get", { + value: function() { + return "ownDataProperty"; + } +}); + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(obj.property, "ownDataProperty", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-197.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-197.js new file mode 100644 index 0000000000..1181aa6841 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-197.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-197 +description: > + Object.defineProperties - 'get' property of 'descObj' is own + accessor property (8.10.5 step 7.a) +---*/ + +var obj = {}; + +var descObj = {}; + +Object.defineProperty(descObj, "get", { + get: function() { + return function() { + return "ownAccessorProperty"; + }; + } +}); + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(obj.property, "ownAccessorProperty", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-198.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-198.js new file mode 100644 index 0000000000..ab64b330bb --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-198.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-198 +description: > + Object.defineProperties - 'get' property of 'descObj' is inherited + accessor property (8.10.5 step 7.a) +---*/ + +var obj = {}; + +var proto = {}; + +Object.defineProperty(proto, "get", { + get: function() { + return function() { + return "inheritedAccessorProperty"; + }; + } +}); + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(obj.property, "inheritedAccessorProperty", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-199.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-199.js new file mode 100644 index 0000000000..691dba1f9d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-199.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-199 +description: > + Object.defineProperties - 'get' property of 'descObj' is own + accessor property that overrides an inherited data property + (8.10.5 step 7.a) +---*/ + +var obj = {}; + +var proto = { + get: function() { + return "inheritedDataProperty"; + } +}; + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); + +Object.defineProperty(descObj, "get", { + get: function() { + return function() { + return "ownAccessorProperty"; + }; + } +}); + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(obj.property, "ownAccessorProperty", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-2.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-2.js new file mode 100644 index 0000000000..a342f5215d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-2.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-2 +description: Object.defineProperties - 'descObj' is null (8.10.5 step 1) +---*/ + +var obj = {}; +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + prop: null + }); +}); +assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-20.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-20.js new file mode 100644 index 0000000000..5c20de6c89 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-20.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-20 +description: > + Object.defineProperties - 'descObj' is an Array object which + implements its own [[Get]] method to get 'enumerable' property + (8.10.5 step 3.a) +---*/ + +var obj = {}; +var accessed = false; +var descObj = []; + +descObj.enumerable = true; + +Object.defineProperties(obj, { + prop: descObj +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-200.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-200.js new file mode 100644 index 0000000000..8c502804c8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-200.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-200 +description: > + Object.defineProperties - 'get' property of 'descObj' is own + accessor property that overrides an inherited accessor property + (8.10.5 step 7.a) +---*/ + +var obj = {}; + +var proto = {}; + +Object.defineProperty(proto, "get", { + get: function() { + return function() { + return "inheritedAccessorProperty"; + }; + } +}); + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); + +Object.defineProperty(descObj, "get", { + get: function() { + return function() { + return "ownAccessorProperty"; + }; + } +}); + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(obj.property, "ownAccessorProperty", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-201.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-201.js new file mode 100644 index 0000000000..8ad2bd8560 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-201.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-201 +description: > + Object.defineProperties - 'get' property of 'descObj' is own + accessor property without a get function (8.10.5 step 7.a) +---*/ + +var obj = {}; + +var descObj = {}; + +Object.defineProperty(descObj, "get", { + set: function() {} +}); + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(typeof(obj.property), "undefined", 'typeof (obj.property)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-202.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-202.js new file mode 100644 index 0000000000..14521ab9fd --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-202.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-202 +description: > + Object.defineProperties - 'get' property of 'descObj' is own + accessor property without a get function that overrides an + inherited accessor property (8.10.5 step 7.a) +---*/ + +var obj = {}; + +var proto = {}; + +Object.defineProperty(proto, "get", { + get: function() { + return function() { + return "inheritedAccessorProperty"; + }; + } +}); + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); + +Object.defineProperty(descObj, "get", { + set: function() {} +}); + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(typeof(obj.property), "undefined", 'typeof (obj.property)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-203.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-203.js new file mode 100644 index 0000000000..dd24e3a1f2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-203.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-203 +description: > + Object.defineProperties - 'get' property of 'descObj' is inherited + accessor property without a get function (8.10.5 step 7.a) +---*/ + +var obj = {}; + +var proto = {}; + +Object.defineProperty(proto, "get", { + set: function() {} +}); + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(typeof(obj.property), "undefined", 'typeof (obj.property)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-204.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-204.js new file mode 100644 index 0000000000..1ea7b5dc75 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-204.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-204 +description: > + Object.defineProperties - 'descObj' is a Function object which + implements its own [[Get]] method to get 'get' property (8.10.5 + step 7.a) +---*/ + +var obj = {}; + +var func = function(a, b) { + return a + b; +}; + +func.get = function() { + return "Function"; +}; + +Object.defineProperties(obj, { + property: func +}); + +assert.sameValue(obj.property, "Function", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-205.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-205.js new file mode 100644 index 0000000000..4db155a5ed --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-205.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-205 +description: > + Object.defineProperties - 'descObj' is an Array object which + implements its own [[Get]] method to get 'get' property (8.10.5 + step 7.a) +---*/ + +var obj = {}; + +var arr = []; + +arr.get = function() { + return "Array"; +}; + +Object.defineProperties(obj, { + property: arr +}); + +assert.sameValue(obj.property, "Array", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-206.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-206.js new file mode 100644 index 0000000000..1a3c06e5af --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-206.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-206 +description: > + Object.defineProperties - 'descObj' is a String object which + implements its own [[Get]] method to get 'get' property (8.10.5 + step 7.a) +---*/ + +var obj = {}; + +var str = new String("abc"); + +str.get = function() { + return "string Object"; +}; + +Object.defineProperties(obj, { + property: str +}); + +assert.sameValue(obj.property, "string Object", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-207.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-207.js new file mode 100644 index 0000000000..dbc20ddf1a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-207.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-207 +description: > + Object.defineProperties - 'descObj' is a Boolean object which + implements its own [[Get]] method to get 'get' property (8.10.5 + step 7.a) +---*/ + +var obj = {}; + +var descObj = new Boolean(false); + +descObj.get = function() { + return "Boolean"; +}; + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(obj.property, "Boolean", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-208.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-208.js new file mode 100644 index 0000000000..0a7f2536c1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-208.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-208 +description: > + Object.defineProperties - 'descObj' is a Number object which + implements its own [[Get]] method to get 'get' property (8.10.5 + step 7.a) +---*/ + +var obj = {}; + +var descObj = new Number(-9); + +descObj.get = function() { + return "Number"; +}; + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(obj.property, "Number", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-209.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-209.js new file mode 100644 index 0000000000..b23b1b3584 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-209.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-209 +description: > + Object.defineProperties - 'descObj' is the Math object which + implements its own [[Get]] method to get 'get' property (8.10.5 + step 7.a) +---*/ + +var obj = {}; + +Math.get = function() { + return "Math"; +}; + +Object.defineProperties(obj, { + property: Math +}); + +assert.sameValue(obj.property, "Math", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-21.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-21.js new file mode 100644 index 0000000000..189ad3d1d3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-21.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-21 +description: > + Object.defineProperties - 'descObj' is a String object which + implements its own [[Get]] method to get 'enumerable' property + (8.10.5 step 3.a) +---*/ + +var obj = {}; +var descObj = new String(); +var accessed = false; +descObj.enumerable = true; + +Object.defineProperties(obj, { + prop: descObj +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-210.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-210.js new file mode 100644 index 0000000000..be235f6122 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-210.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-210 +description: > + Object.defineProperties - 'descObj' is a Date object which + implements its own [[Get]] method to get 'get' property (8.10.5 + step 7.a) +---*/ + +var obj = {}; + +var descObj = new Date(); + +descObj.get = function() { + return "Date"; +}; + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(obj.property, "Date", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-211.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-211.js new file mode 100644 index 0000000000..be2df2f77b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-211.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-211 +description: > + Object.defineProperties - 'descObj' is a RegExp object which + implements its own [[Get]] method to get 'get' property (8.10.5 + step 7.a) +---*/ + +var obj = {}; + +var descObj = new RegExp(); + +descObj.get = function() { + return "RegExp"; +}; + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(obj.property, "RegExp", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-212.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-212.js new file mode 100644 index 0000000000..8f78bf4501 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-212.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-212 +description: > + Object.defineProperties - 'descObj' is the JSON object which + implements its own [[Get]] method to get 'get' property (8.10.5 + step 7.a) +---*/ + +var obj = {}; + +JSON.get = function() { + return "JSON"; +}; + +Object.defineProperties(obj, { + property: JSON +}); + +assert.sameValue(obj.property, "JSON", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-213.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-213.js new file mode 100644 index 0000000000..2588a68615 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-213.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-213 +description: > + Object.defineProperties - 'descObj' is an Error object which + implements its own [[Get]] method to get 'get' property (8.10.5 + step 7.a) +---*/ + +var obj = {}; + +var descObj = new Error(); + +descObj.get = function() { + return "Error"; +}; + +Object.defineProperties(obj, { + property: descObj +}); + +assert.sameValue(obj.property, "Error", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-214.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-214.js new file mode 100644 index 0000000000..f09ced4e40 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-214.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-214 +description: > + Object.defineProperties - 'descObj' is the Arguments object which + implements its own [[Get]] method to get 'get' property (8.10.5 + step 7.a) +---*/ + +var obj = {}; + +var func = function(a, b) { + arguments.get = function() { + return "arguments"; + }; + + Object.defineProperties(obj, { + property: arguments + }); + + return obj.property === "arguments"; +}; + +assert(func(), 'func() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-216.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-216.js new file mode 100644 index 0000000000..7cea255115 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-216.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-216 +description: > + Object.defineProperties - 'descObj' is the global object which + implements its own [[Get]] method to get 'get' property (8.10.5 + step 7.a) +---*/ + +var obj = {}; + +this.get = function() { + return "global"; +}; + +Object.defineProperties(obj, { + property: this +}); + +assert.sameValue(obj.property, "global", 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-217.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-217.js new file mode 100644 index 0000000000..8457359cce --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-217.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-217 +description: > + Object.defineProperties - value of 'get' property of 'descObj' is + undefined (8.10.5 step 7.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + get: undefined + } +}); + +assert(obj.hasOwnProperty("property"), 'obj.hasOwnProperty("property") !== true'); +assert.sameValue(typeof obj.property, "undefined", 'typeof obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-218.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-218.js new file mode 100644 index 0000000000..c261269a99 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-218.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-218 +description: > + Object.defineProperties - value of 'get' property of 'descObj' is + primitive values( value is null) (8.10.5 step 7.b) +---*/ + +var obj = {}; +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + property: { + get: null + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-219.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-219.js new file mode 100644 index 0000000000..3a4af2efaf --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-219.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-219 +description: > + Object.defineProperties - value of 'get' property of 'descObj' is + primitive values( value is boolean) (8.10.5 step 7.b) +---*/ + +var obj = {}; +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + property: { + get: false + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-22.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-22.js new file mode 100644 index 0000000000..3dd47387ef --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-22.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-22 +description: > + Object.defineProperties - 'descObj' is a Boolean object which + implements its own [[Get]] method to get 'enumerable' property + (8.10.5 step 3.a) +---*/ + +var obj = {}; +var descObj = new Boolean(false); +var accessed = false; + +descObj.enumerable = true; + +Object.defineProperties(obj, { + prop: descObj +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-220.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-220.js new file mode 100644 index 0000000000..b4c90b2ba2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-220.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-220 +description: > + Object.defineProperties - value of 'get' property of 'descObj' is + primitive values( value is number) (8.10.5 step 7.b) +---*/ + +var obj = {}; +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + property: { + get: 123 + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-221.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-221.js new file mode 100644 index 0000000000..2db92b11ca --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-221.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-221 +description: > + Object.defineProperties - value of 'get' property of 'descObj' is + primitive values( value is string) (8.10.5 step 7.b) +---*/ + +var obj = {}; +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + property: { + get: "string" + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-222.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-222.js new file mode 100644 index 0000000000..6025954049 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-222.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-222 +description: > + Object.defineProperties - value of 'get' property of 'descObj' is + applied to Array object (8.10.5 step 7.b) +---*/ + +var obj = {}; +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + property: { + get: [] + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-223.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-223.js new file mode 100644 index 0000000000..79b3aa2aac --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-223.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-223 +description: > + Object.defineProperties - value of 'get' property of 'descObj' is + a function (8.10.5 step 7.b) +---*/ + +var obj = {}; + +var getter = function() { + return 100; +}; + +Object.defineProperties(obj, { + property: { + get: getter + } +}); + +assert.sameValue(obj.property, 100, 'obj.property'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-226.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-226.js new file mode 100644 index 0000000000..b4511e2ed8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-226.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-226 +description: > + Object.defineProperties - 'set' property of 'descObj' is present + (8.10.5 step 8) +---*/ + +var data = "data"; +var obj = {}; + +Object.defineProperties(obj, { + "prop": { + set: function(value) { + data = value; + } + } +}); + +obj.prop = "overrideData"; + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(data, "overrideData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-227.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-227.js new file mode 100644 index 0000000000..eddbbdac73 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-227.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-227 +description: > + Object.defineProperties - 'set' property of 'descObj' is not + present (8.10.5 step 8) +includes: [propertyHelper.js] +---*/ + +var data = "data"; +var obj = {}; + +Object.defineProperties(obj, { + descObj: { + get: function() { + return data; + } + } +}); + + +assert(obj.hasOwnProperty("descObj")); +verifyNotWritable(obj, "descObj"); + +var desc = Object.getOwnPropertyDescriptor(obj, "descObj"); +assert.sameValue(typeof(desc.set), "undefined") + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-228.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-228.js new file mode 100644 index 0000000000..4111e74b87 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-228.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-228 +description: > + Object.defineProperties - 'set' property of 'descObj' is own data + property (8.10.5 step 8.a) +---*/ + +var data = "data"; +var obj = {}; + +Object.defineProperties(obj, { + descObj: { + set: function(value) { + data = value; + } + } +}); + +obj.descObj = "overrideData"; + +assert(obj.hasOwnProperty("descObj"), 'obj.hasOwnProperty("descObj") !== true'); +assert.sameValue(data, "overrideData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-229.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-229.js new file mode 100644 index 0000000000..8c7c40e2b8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-229.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-229 +description: > + Object.defineProperties - 'set' property of 'descObj' is inherited + data property (8.10.5 step 8.a) +---*/ + +var data = "data"; +var proto = { + set: function(value) { + data = value; + } +}; + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); +var obj = {}; + +Object.defineProperties(obj, { + prop: child +}); + +obj.prop = "overrideData"; + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(data, "overrideData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-23.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-23.js new file mode 100644 index 0000000000..656d907e1e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-23.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-23 +description: > + Object.defineProperties - 'descObj' is a Number object which + implements its own [[Get]] method to get 'enumerable' property + (8.10.5 step 3.a) +---*/ + +var obj = {}; +var descObj = new Number(-9); +var accessed = false; + +descObj.enumerable = true; + +Object.defineProperties(obj, { + prop: descObj +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-230.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-230.js new file mode 100644 index 0000000000..6ca2f7259f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-230.js @@ -0,0 +1,40 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-230 +description: > + Object.defineProperties - 'set' property of 'descObj' is own data + property that overrides an inherited data property (8.10.5 step + 8.a) +---*/ + +var data1 = "data"; +var data2 = "data"; +var proto = { + set: function(value) { + data2 = value; + } +}; + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); +child.set = function(value) { + data1 = value; +}; + +var obj = {}; + +Object.defineProperties(obj, { + prop: child +}); + +obj.prop = "overrideData"; + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(data1, "overrideData", 'data1'); +assert.sameValue(data2, "data", 'data2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-231.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-231.js new file mode 100644 index 0000000000..06ddc808a3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-231.js @@ -0,0 +1,47 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-231 +description: > + Object.defineProperties - 'set' property of 'descObj' is own data + property that overrides an inherited accessor property (8.10.5 + step 8.a) +---*/ + +var data1 = "data"; +var data2 = "data"; +var fun = function(value) { + data2 = value; +}; +var proto = {}; +Object.defineProperty(proto, "set", { + get: function() { + return fun; + }, + set: function(value) { + fun = value; + } +}); + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); +child.set = function(value) { + data1 = value; +}; + +var obj = {}; + +Object.defineProperties(obj, { + prop: child +}); + +obj.prop = "overrideData"; + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(data1, "overrideData", 'data1'); +assert.sameValue(data2, "data", 'data2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-232.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-232.js new file mode 100644 index 0000000000..8afd0edd25 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-232.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-232 +description: > + Object.defineProperties - 'set' property of 'descObj' is own + accessor property (8.10.5 step 8.a) +---*/ + +var data = "data"; +var setFun = function(value) { + data = value; +}; +var descObj = {}; +Object.defineProperty(descObj, "set", { + get: function() { + return setFun; + } +}); + +var obj = {}; + +Object.defineProperties(obj, { + prop: descObj +}); + +obj.prop = "overrideData"; + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(data, "overrideData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-233.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-233.js new file mode 100644 index 0000000000..b115be1937 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-233.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-233 +description: > + Object.defineProperties - 'set' property of 'descObj' is inherited + accessor property (8.10.5 step 8.a) +---*/ + +var data = "data"; +var setFun = function(value) { + data = value; +}; +var proto = {}; +Object.defineProperty(proto, "set", { + get: function() { + return setFun; + } +}); + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); +var obj = {}; + +Object.defineProperties(obj, { + prop: child +}); +obj.prop = "overrideData"; + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(data, "overrideData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-234.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-234.js new file mode 100644 index 0000000000..7f73c1207a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-234.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-234 +description: > + Object.defineProperties - 'set' property of 'descObj' is own + accessor property that overrides an inherited data property + (8.10.5 step 8.a) +---*/ + +var data1 = "data"; +var data2 = "data"; + +var proto = {}; +proto.set = function(value) { + data1 = value; +}; + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); +Object.defineProperty(child, "set", { + get: function() { + return function(value) { + data2 = value; + }; + } +}); + +var obj = {}; + +Object.defineProperties(obj, { + prop: child +}); +obj.prop = "overrideData"; + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(data2, "overrideData", 'data2'); +assert.sameValue(data1, "data", 'data1'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-235.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-235.js new file mode 100644 index 0000000000..d7d8568ea3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-235.js @@ -0,0 +1,48 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-235 +description: > + Object.defineProperties - 'set' property of 'descObj' is own + accessor property that overrides an inherited accessor property + (8.10.5 step 8.a) +---*/ + +var data1 = "data"; +var data2 = "data"; + +var proto = {}; +Object.defineProperty(proto, "set", { + get: function() { + return function(value) { + data1 = value; + }; + } +}); + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); +Object.defineProperty(child, "set", { + get: function() { + return function(value) { + data2 = value; + }; + } +}); + +var obj = {}; + +Object.defineProperties(obj, { + prop: child +}); + +obj.prop = "overrideData"; + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(data2, "overrideData", 'data2'); +assert.sameValue(data1, "data", 'data1'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-236.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-236.js new file mode 100644 index 0000000000..4c6a3b500e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-236.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-236 +description: > + Object.defineProperties - 'set' property of 'descObj' is own + accessor property without a get function (8.10.5 step 8.a) +---*/ + +var fun = function() { + return 10; +}; +var descObj = { + get: fun +}; +Object.defineProperty(descObj, "set", { + set: function() {} +}); + +var obj = {}; + +Object.defineProperties(obj, { + prop: descObj +}); + +var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(typeof desc.set, "undefined", 'typeof desc.set'); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-237.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-237.js new file mode 100644 index 0000000000..febc572439 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-237.js @@ -0,0 +1,46 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-237 +description: > + Object.defineProperties - 'set' property of 'descObj' is own + accessor property without a get function that overrides an + inherited accessor property (8.10.5 step 8.a) +---*/ + +var fun = function() { + return 10; +}; +var proto = {}; +Object.defineProperty(proto, "set", { + get: function() { + return function() { + return arguments; + }; + } +}); + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); +Object.defineProperty(descObj, "set", { + set: function() {} +}); + +descObj.get = fun; + +var obj = {}; + +Object.defineProperties(obj, { + prop: descObj +}); + +var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(typeof(desc.set), "undefined", 'typeof (desc.set)'); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-238.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-238.js new file mode 100644 index 0000000000..11b9b18294 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-238.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-238 +description: > + Object.defineProperties - 'set' property of 'descObj' is inherited + accessor property without a get function (8.10.5 step 8.a) +---*/ + +var fun = function() { + return 10; +}; +var proto = {}; +Object.defineProperty(proto, "set", { + set: function() {} +}); + +var Con = function() {}; +Con.prototype = proto; + +var descObj = new Con(); +descObj.get = fun; + +var obj = {}; + +Object.defineProperties(obj, { + prop: descObj +}); + +var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(typeof(desc.set), "undefined", 'typeof (desc.set)'); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-239.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-239.js new file mode 100644 index 0000000000..8742d41c6c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-239.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-239 +description: > + Object.defineProperties - 'descObj' is a Function object which + implements its own [[Get]] method to get 'set' property (8.10.5 + step 8.a) +---*/ + +var data = "data"; +var descFun = function() {}; +var setFun = function(value) { + data = value; +}; + +descFun.prop = { + set: setFun +}; + +var obj = {}; +Object.defineProperties(obj, descFun); +obj.prop = "funData"; + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(data, "funData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-24.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-24.js new file mode 100644 index 0000000000..4b0ecb83ee --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-24.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-24 +description: > + Object.defineProperties - 'descObj' is the Math object which + implements its own [[Get]] method to get 'enumerable' property + (8.10.5 step 3.a) +---*/ + +var obj = {}; +var accessed = false; + +Math.enumerable = true; + +Object.defineProperties(obj, { + prop: Math +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-240.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-240.js new file mode 100644 index 0000000000..9fa71cecb1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-240.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-240 +description: > + Object.defineProperties - 'descObj' is an Array object which + implements its own [[Get]] method to get 'set' property (8.10.5 + step 8.a) +---*/ + +var data = "data"; +var arr = []; +var setFun = function(value) { + data = value; +}; +arr.prop = { + set: setFun +}; + +var obj = {}; +Object.defineProperties(obj, arr); +obj.prop = "arrData"; + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(data, "arrData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-241.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-241.js new file mode 100644 index 0000000000..1dc5a1e31c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-241.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-241 +description: > + Object.defineProperties - 'descObj' is a String object which + implements its own [[Get]] method to get 'set' property (8.10.5 + step 8.a) +---*/ + +var data = "data"; +var descStr = new String(); +var setFun = function(value) { + data = value; +}; + +descStr.prop = { + set: setFun +}; + +var obj = {}; +Object.defineProperties(obj, descStr); +obj.prop = "strData"; + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(data, "strData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-242.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-242.js new file mode 100644 index 0000000000..f00bcf0f80 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-242.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-242 +description: > + Object.defineProperties - 'descObj' is a Boolean object which + implements its own [[Get]] method to get 'set' property (8.10.5 + step 8.a) +---*/ + +var data = "data"; +var descObj = new Boolean(false); +var setFun = function(value) { + data = value; +}; +descObj.prop = { + set: setFun +}; + +var obj = {}; +Object.defineProperties(obj, descObj); +obj.prop = "booleanData"; + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(data, "booleanData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-243.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-243.js new file mode 100644 index 0000000000..fcf220983a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-243.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-243 +description: > + Object.defineProperties - 'descObj' is a Number object which + implements its own [[Get]] method to get 'set' property (8.10.5 + step 8.a) +---*/ + +var data = "data"; +var descObj = new Number(-9); +var setFun = function(value) { + data = value; +}; +descObj.prop = { + set: setFun +}; + +var obj = {}; +Object.defineProperties(obj, descObj); +obj.prop = "numberData"; + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(data, "numberData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-244.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-244.js new file mode 100644 index 0000000000..327e9d8ee2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-244.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-244 +description: > + Object.defineProperties - 'descObj' is the Math object which + implements its own [[Get]] method to get 'set' property (8.10.5 + step 8.a) +---*/ + +var data = "data"; +var setFun = function(value) { + data = value; +}; + +Math.prop = { + set: setFun +}; + +var obj = {}; +Object.defineProperties(obj, Math); +obj.prop = "mathData"; + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(data, "mathData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-245.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-245.js new file mode 100644 index 0000000000..1c4d2476c7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-245.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-245 +description: > + Object.defineProperties - 'descObj' is a Date object which + implements its own [[Get]] method to get 'set' property (8.10.5 + step 8.a) +---*/ + +var data = "data"; +var descObj = new Date(); +var setFun = function(value) { + data = value; +}; +descObj.prop = { + set: setFun +}; + +var obj = {}; +Object.defineProperties(obj, descObj); +obj.prop = "dateData"; + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(data, "dateData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-246.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-246.js new file mode 100644 index 0000000000..89d1caff61 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-246.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-246 +description: > + Object.defineProperties - 'descObj' is a RegExp object which + implements its own [[Get]] method to get 'set' property (8.10.5 + step 8.a) +---*/ + +var data = "data"; +var descObj = new RegExp(); +var setFun = function(value) { + data = value; +}; +descObj.prop = { + set: setFun +}; + +var obj = {}; +Object.defineProperties(obj, descObj); +obj.prop = "regExpData"; + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(data, "regExpData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-247.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-247.js new file mode 100644 index 0000000000..e905ba4555 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-247.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-247 +description: > + Object.defineProperties - 'descObj' is the JSON object which + implements its own [[Get]] method to get 'set' property (8.10.5 + step 8.a) +---*/ + +var data = "data"; +var setFun = function(value) { + data = value; +}; + +JSON.prop = { + set: setFun +}; + +var obj = {}; +Object.defineProperties(obj, JSON); +obj.prop = "JSONData"; + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(data, "JSONData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-248.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-248.js new file mode 100644 index 0000000000..f148f8bf0d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-248.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-248 +description: > + Object.defineProperties - 'descObj' is an Error object which + implements its own [[Get]] method to get 'set' property (8.10.5 + step 8.a) +---*/ + +var data = "data"; +var descObj = new Error("test"); +descObj.description = { + value: 11 +}; +descObj.message = { + value: 11 +}; +descObj.name = { + value: 11 +}; + +var setFun = function(value) { + data = value; +}; +descObj.prop = { + set: setFun +}; + +var obj = {}; +Object.defineProperties(obj, descObj); +obj.prop = "errorData"; + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(data, "errorData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-249.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-249.js new file mode 100644 index 0000000000..a538202cb8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-249.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-249 +description: > + Object.defineProperties - 'descObj' is the Arguments object which + implements its own [[Get]] method to get 'set' property (8.10.5 + step 8.a) +---*/ + +var data = "data"; +var fun = function() { + return arguments; +}; +var arg = fun(); +var setFun = function(value) { + data = value; +}; + +arg.prop = { + set: setFun +}; + +var obj = {}; +Object.defineProperties(obj, arg); +obj.prop = "argData"; + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(data, "argData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-25.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-25.js new file mode 100644 index 0000000000..69bbbabb6c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-25.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-25 +description: > + Object.defineProperties - 'descObj' is a Date object which + implements its own [[Get]] method to get 'enumerable' property + (8.10.5 step 3.a) +---*/ + +var obj = {}; +var descObj = new Date(); +var accessed = false; + +descObj.enumerable = true; + +Object.defineProperties(obj, { + prop: descObj +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-252.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-252.js new file mode 100644 index 0000000000..e3c6ac6bb7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-252.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-252 +description: > + Object.defineProperties - value of 'set' property of 'descObj' is + undefined (8.10.5 step 8.b) +---*/ + +var getFun = function() { + return 11; +}; + +var obj = {}; +Object.defineProperties(obj, { + prop: { + get: getFun, + set: undefined + } +}); + +var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(typeof(desc.set), "undefined", 'typeof (desc.set)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-253.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-253.js new file mode 100644 index 0000000000..1afccd2bdf --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-253.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-253 +description: > + Object.defineProperties - value of 'set' property of 'descObj' is + primitive values null (8.10.5 step 8.b) +---*/ + +var obj = {}; +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + prop: { + set: null + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-254.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-254.js new file mode 100644 index 0000000000..01a10d02d3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-254.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-254 +description: > + Object.defineProperties - value of 'set' property of 'descObj' is + primitive values boolean (8.10.5 step 8.b) +---*/ + +var obj = {}; +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + prop: { + set: true + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-255.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-255.js new file mode 100644 index 0000000000..2463fbfb16 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-255.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-255 +description: > + Object.defineProperties - value of 'set' property of 'descObj' is + primitive values number (8.10.5 step 8.b) +---*/ + +var obj = {}; +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + prop: { + set: 100 + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-256.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-256.js new file mode 100644 index 0000000000..efbcd429aa --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-256.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-256 +description: > + Object.defineProperties - value of 'set' property of 'descObj' is + primitive values string (8.10.5 step 8.b) +---*/ + +var obj = {}; +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + prop: { + set: "abcdef" + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-257.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-257.js new file mode 100644 index 0000000000..dc97184e33 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-257.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-257 +description: > + Object.defineProperties - value of 'set' property of 'descObj' is + an interesting object other than a function (8.10.5 step 8.b) +---*/ + +var obj = {}; +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + prop: { + set: [] + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-258.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-258.js new file mode 100644 index 0000000000..75b3ce485e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-258.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-258 +description: > + Object.defineProperties - value of 'set' property of 'descObj' is + a function (8.10.5 step 8.b) +---*/ + +var data = "data"; +var setFun = function(value) { + data = value; +}; +var obj = {}; + + +Object.defineProperties(obj, { + prop: { + set: setFun + } +}); +obj.prop = "funData"; + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(data, "funData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-26.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-26.js new file mode 100644 index 0000000000..d249bc60bc --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-26.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-26 +description: > + Object.defineProperties - 'descObj' is a RegExp object which + implements its own [[Get]] method to get 'enumerable' property + (8.10.5 step 3.a) +---*/ + +var obj = {}; +var descObj = new RegExp(); +var accessed = false; + +descObj.enumerable = true; + +Object.defineProperties(obj, { + prop: descObj +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-261.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-261.js new file mode 100644 index 0000000000..e01bb48eaa --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-261.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-261 +description: > + Object.defineProperties - TypeError is thrown if both 'set' + property and 'value' property of 'descObj' are present (8.10.5 + step 9.a) +---*/ + +var setFun = function() {}; +var obj = {}; +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + prop: { + value: 12, + set: setFun + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-262.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-262.js new file mode 100644 index 0000000000..267c132f13 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-262.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-262 +description: > + Object.defineProperties - TypeError is thrown if both 'set' + property and 'writable' property of 'descObj' are present (8.10.5 + step 9.a) +---*/ + +var setFun = function() {}; +var obj = {}; +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + prop: { + writable: true, + set: setFun + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-263.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-263.js new file mode 100644 index 0000000000..e360ad47e6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-263.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-263 +description: > + Object.defineProperties - TypeError is thrown if both 'get' + property and 'value' property of 'descObj' are present (8.10.5 + step 9.a) +---*/ + +var getFun = function() {}; +var obj = {}; +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + prop: { + value: 12, + get: getFun + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-264.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-264.js new file mode 100644 index 0000000000..0e6b5a5331 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-264.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-264 +description: > + Object.defineProperties - TypeError is thrown if both 'get' + property and 'writable' property of 'descObj' are present (8.10.5 + step 9.a) +---*/ + +var getFun = function() {}; + +var obj = {}; +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + "prop": { + writable: true, + get: getFun + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-27.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-27.js new file mode 100644 index 0000000000..f24832449d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-27.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-27 +description: > + Object.defineProperties - 'descObj' is the JSON object which + implements its own [[Get]] method to get 'enumerable' property + (8.10.5 step 3.a) +---*/ + +var obj = {}; +var accessed = false; + +JSON.enumerable = true; + +Object.defineProperties(obj, { + prop: JSON +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-28.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-28.js new file mode 100644 index 0000000000..d80e71072f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-28.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-28 +description: > + Object.defineProperties - 'descObj' is an Error object which + implements its own [[Get]] method to get 'enumerable' property + (8.10.5 step 3.a) +---*/ + +var obj = {}; +var descObj = new Error(); +var accessed = false; + +descObj.enumerable = true; + +Object.defineProperties(obj, { + prop: descObj +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-29.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-29.js new file mode 100644 index 0000000000..6f924b9a93 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-29.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-29 +description: > + Object.defineProperties - 'descObj' is the Arguments object which + implements its own [[Get]] method to get 'enumerable' property + (8.10.5 step 3.a) +---*/ + +var obj = {}; +var arg; +var accessed = false; + +(function fun() { + arg = arguments; +}()); + +arg.enumerable = true; + +Object.defineProperties(obj, { + prop: arg +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-3.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-3.js new file mode 100644 index 0000000000..25fb51a627 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-3.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-3 +description: Object.defineProperties - 'descObj' is a boolean (8.10.5 step 1) +---*/ + +var obj = {}; +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + prop: true + }); +}); +assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-31.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-31.js new file mode 100644 index 0000000000..68711adb0f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-31.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-31 +description: > + Object.defineProperties - 'descObj' is the global object which + implements its own [[Get]] method to get 'enumerable' property + (8.10.5 step 3.a) +---*/ + +var obj = {}; +var accessed = false; + +this.enumerable = true; + +Object.defineProperties(obj, { + prop: this +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-32.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-32.js new file mode 100644 index 0000000000..c9f0da8d20 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-32.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-32 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is undefined (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: undefined + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-33.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-33.js new file mode 100644 index 0000000000..27a920d0d7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-33.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-33 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is null (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: null + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-34.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-34.js new file mode 100644 index 0000000000..16d02558c9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-34.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-34 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is true (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: true + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-35.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-35.js new file mode 100644 index 0000000000..e8b2fa34a5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-35.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-35 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is false (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: false + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-36.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-36.js new file mode 100644 index 0000000000..64aa8c9808 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-36.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-36 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is 0 (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: 0 + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-37.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-37.js new file mode 100644 index 0000000000..c811b1295b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-37.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-37 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is +0 (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: +0 + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-38.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-38.js new file mode 100644 index 0000000000..c89c80ba9c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-38.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-38 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is -0 (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: -0 + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-39.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-39.js new file mode 100644 index 0000000000..019ec74945 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-39.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-39 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is NaN (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: NaN + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-4.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-4.js new file mode 100644 index 0000000000..daeb655b3f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-4.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-4 +description: Object.defineProperties - 'descObj' is a number (8.10.5 step 1) +---*/ + +var obj = {}; +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + prop: 12 + }); +}); +assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-40.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-40.js new file mode 100644 index 0000000000..f40b207bf0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-40.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-40 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is positive number (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: 12 + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-41.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-41.js new file mode 100644 index 0000000000..e8bfd08048 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-41.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-41 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is negative number (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: -9 + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-42.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-42.js new file mode 100644 index 0000000000..4f4af207ad --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-42.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-42 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is empty string (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: "" + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-43.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-43.js new file mode 100644 index 0000000000..0582790863 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-43.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-43 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is non-empty string (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: "AB\n\\cd" + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-44.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-44.js new file mode 100644 index 0000000000..b10a661da9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-44.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-44 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is a Function object (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: function() {} + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-45.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-45.js new file mode 100644 index 0000000000..ef624a3279 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-45.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-45 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is an Array object (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: [] + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-46.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-46.js new file mode 100644 index 0000000000..348320e76c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-46.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-46 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is a String object (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: new String() + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-47.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-47.js new file mode 100644 index 0000000000..908edfd5f0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-47.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-47 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is a Boolean object (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: new Boolean(true) + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-48.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-48.js new file mode 100644 index 0000000000..8290255db1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-48.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-48 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is a Number object (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: new Number(-9) + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-49.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-49.js new file mode 100644 index 0000000000..b04858770f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-49.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-49 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is the Math object (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: Math + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-5.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-5.js new file mode 100644 index 0000000000..942f2a9885 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-5.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-5 +description: Object.defineProperties - 'descObj' is a string (8.10.5 step 1) +---*/ + +var obj = {}; +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + prop: "abc" + }); +}); +assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-50.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-50.js new file mode 100644 index 0000000000..bc61dbff2e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-50.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-50 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is a Date object (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: new Date() + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-51.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-51.js new file mode 100644 index 0000000000..338177931a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-51.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-51 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is a RegExp object (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: new RegExp() + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-52.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-52.js new file mode 100644 index 0000000000..5c24c79140 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-52.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-52 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is the JSON object (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: JSON + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-53.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-53.js new file mode 100644 index 0000000000..a2693a5f30 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-53.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-53 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is an Error object (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: new Error() + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-54.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-54.js new file mode 100644 index 0000000000..5d006430c5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-54.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-54 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is the Arguments object (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; +var arg; + +(function fun() { + arg = arguments; +}(1, 2, 3)); + +Object.defineProperties(obj, { + prop: { + enumerable: arg + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-56.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-56.js new file mode 100644 index 0000000000..765bc19c94 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-56.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-56 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is the global object (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: this + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-57.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-57.js new file mode 100644 index 0000000000..4dbae75feb --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-57.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-57 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is a string (value is 'false') which is treated as true + value (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: "false" + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-58.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-58.js new file mode 100644 index 0000000000..585f6d8278 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-58.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-58 +description: > + Object.defineProperties - value of 'enumerable' property of + 'descObj' is new Boolean(false) which is treated as true value + (8.10.5 step 3.b) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: new Boolean(false) + } +}); +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-59.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-59.js new file mode 100644 index 0000000000..0d85551f9d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-59.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-59 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + present (8.10.5 step 4) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + prop: { + configurable: true + } +}); + +var result1 = obj.hasOwnProperty("prop"); +delete obj.prop; +var result2 = obj.hasOwnProperty("prop"); + +assert.sameValue(result1, true, 'result1'); +assert.sameValue(result2, false, 'result2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-6.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-6.js new file mode 100644 index 0000000000..acebbef9d5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-6.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-6 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + present (8.10.5 step 3) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: { + enumerable: true + } +}); + +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-60.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-60.js new file mode 100644 index 0000000000..a213b737e8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-60.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-60 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + not present (8.10.5 step 4) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperties(obj, { + prop: {} +}); + +assert(obj.hasOwnProperty("prop")); +verifyNotConfigurable(obj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-61.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-61.js new file mode 100644 index 0000000000..52f0a23515 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-61.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-61 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + own data property (8.10.5 step 4.a) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + prop: { + configurable: true + } +}); + +var result1 = obj.hasOwnProperty("prop"); +delete obj.prop; +var result2 = obj.hasOwnProperty("prop"); + +assert.sameValue(result1, true, 'result1'); +assert.sameValue(result2, false, 'result2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-62.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-62.js new file mode 100644 index 0000000000..c056e9f0cb --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-62.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-62 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + inherited data property (8.10.5 step 4.a) +---*/ + +var obj = {}; +var proto = { + configurable: true +}; +var Con = function() {}; +Con.prototype = proto; +var descObj = new Con(); + +Object.defineProperties(obj, { + prop: descObj +}); + +var result1 = obj.hasOwnProperty("prop"); +delete obj.prop; +var result2 = obj.hasOwnProperty("prop"); + +assert.sameValue(result1, true, 'result1'); +assert.sameValue(result2, false, 'result2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-63.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-63.js new file mode 100644 index 0000000000..3564a3c259 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-63.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-63 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + own data property that overrides an inherited data property + (8.10.5 step 4.a) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; +var proto = { + configurable: true +}; + +var Con = function() {}; +Con.prototype = proto; +var descObj = new Con(); + +Object.defineProperty(descObj, "configurable", { + value: false +}); + +Object.defineProperties(obj, { + prop: descObj +}); + +assert(obj.hasOwnProperty("prop")); +verifyNotConfigurable(obj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-64.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-64.js new file mode 100644 index 0000000000..895a3897ef --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-64.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-64 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + own data property that overrides an inherited accessor property + (8.10.5 step 4.a) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; +var proto = {}; +Object.defineProperty(proto, "configurable", { + get: function() { + return true; + } +}); + +var Con = function() {}; +Con.prototype = proto; +var descObj = new Con(); + +Object.defineProperty(descObj, "configurable", { + value: false +}); + +Object.defineProperties(obj, { + prop: descObj +}); + +assert(obj.hasOwnProperty("prop")); +verifyNotConfigurable(obj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-65.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-65.js new file mode 100644 index 0000000000..1d011d9b67 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-65.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-65 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + own accessor property (8.10.5 step 4.a) +---*/ + +var obj = {}; + +var descObj = {}; +Object.defineProperty(descObj, "configurable", { + get: function() { + return true; + } +}); + +Object.defineProperties(obj, { + prop: descObj +}); +var result1 = obj.hasOwnProperty("prop"); +delete obj.prop; +var result2 = obj.hasOwnProperty("prop"); + +assert.sameValue(result1, true, 'result1'); +assert.sameValue(result2, false, 'result2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-66.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-66.js new file mode 100644 index 0000000000..ebbb6972d9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-66.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-66 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + inherited accessor property (8.10.5 step 4.a) +---*/ + +var obj = {}; +var proto = {}; + +Object.defineProperty(proto, "configurable", { + get: function() { + return true; + } +}); + +var Con = function() {}; +Con.prototype = proto; +var descObj = new Con(); + +Object.defineProperties(obj, { + prop: descObj +}); + +var result1 = obj.hasOwnProperty("prop"); +delete obj.prop; +var result2 = obj.hasOwnProperty("prop"); + +assert.sameValue(result1, true, 'result1'); +assert.sameValue(result2, false, 'result2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-67.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-67.js new file mode 100644 index 0000000000..b9abacb080 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-67.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-67 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + own accessor property that overrides an inherited data property + (8.10.5 step 4.a) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; +var proto = { + configurable: true +}; + +var Con = function() {}; +Con.prototype = proto; +var descObj = new Con(); + +Object.defineProperty(descObj, "configurable", { + get: function() { + return false; + } +}); + +Object.defineProperties(obj, { + prop: descObj +}); + +assert(obj.hasOwnProperty("prop")); +verifyNotConfigurable(obj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-68.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-68.js new file mode 100644 index 0000000000..bc74560e09 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-68.js @@ -0,0 +1,40 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-68 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + own accessor property that overrides an inherited accessor + property (8.10.5 step 4.a) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; +var proto = {}; +Object.defineProperty(proto, "configurable", { + get: function() { + return true; + } +}); + +var Con = function() {}; +Con.prototype = proto; +var descObj = new Con(); + +Object.defineProperty(descObj, "configurable", { + get: function() { + return false; + } +}); + +Object.defineProperties(obj, { + prop: descObj +}); + +assert(obj.hasOwnProperty("prop")); +verifyNotConfigurable(obj, "prop"); +assert(obj.hasOwnProperty("prop")); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-69.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-69.js new file mode 100644 index 0000000000..baa2e16a9c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-69.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-69 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + own accessor property without a get function (8.10.5 step 4.a) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +var descObj = {}; +Object.defineProperty(descObj, "configurable", { + set: function() {} +}); + +Object.defineProperties(obj, { + prop: descObj +}); + +assert(obj.hasOwnProperty("prop")); +verifyNotConfigurable(obj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-7.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-7.js new file mode 100644 index 0000000000..ee78a793f7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-7.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-7 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + not present (8.10.5 step 3) +---*/ + +var obj = {}; +var accessed = false; + +Object.defineProperties(obj, { + prop: {} +}); + +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-70.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-70.js new file mode 100644 index 0000000000..ef2e2468f2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-70.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-70 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + own accessor property without a get function that overrides an + inherited accessor property (8.10.5 step 4.a) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; +var proto = {}; +Object.defineProperty(proto, "configurable", { + get: function() { + return true; + } +}); + +var Con = function() {}; +Con.prototype = proto; +var descObj = new Con(); + +Object.defineProperty(descObj, "configurable", { + set: function() {} +}); + +Object.defineProperties(obj, { + prop: descObj +}); + +assert(obj.hasOwnProperty("prop")); +verifyNotConfigurable(obj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-71.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-71.js new file mode 100644 index 0000000000..b0915952d0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-71.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-71 +description: > + Object.defineProperties - 'configurable' property of 'descObj' is + inherited accessor property without a get function (8.10.5 step + 4.a) +includes: [propertyHelper.js] +---*/ + +var obj = {}; +var proto = {}; + +Object.defineProperty(proto, "configurable", { + set: function() {} +}); + +var Con = function() {}; +Con.prototype = proto; +var descObj = new Con(); + +Object.defineProperties(obj, { + prop: descObj +}); + +assert(obj.hasOwnProperty("prop")); +verifyNotConfigurable(obj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-72.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-72.js new file mode 100644 index 0000000000..709823b001 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-72.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-72 +description: > + Object.defineProperties - 'descObj' is a Function object which + implements its own [[Get]] method to get 'configurable' property + (8.10.5 step 4.a) +---*/ + +var obj = {}; + +var descObj = function() {}; +descObj.configurable = true; + +Object.defineProperties(obj, { + prop: descObj +}); + +var result1 = obj.hasOwnProperty("prop"); +delete obj.prop; +var result2 = obj.hasOwnProperty("prop"); + +assert.sameValue(result1, true, 'result1'); +assert.sameValue(result2, false, 'result2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-73.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-73.js new file mode 100644 index 0000000000..bb49f1c868 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-73.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-73 +description: > + Object.defineProperties - 'descObj' is an Array object which + implements its own [[Get]] method to get 'configurable' property + (8.10.5 step 4.a) +---*/ + +var obj = {}; + +var descObj = []; +descObj.configurable = true; + +Object.defineProperties(obj, { + prop: descObj +}); + +var result1 = obj.hasOwnProperty("prop"); +delete obj.prop; +var result2 = obj.hasOwnProperty("prop"); + +assert.sameValue(result1, true, 'result1'); +assert.sameValue(result2, false, 'result2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-74.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-74.js new file mode 100644 index 0000000000..aae2ffd3ec --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-74.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-74 +description: > + Object.defineProperties - 'descObj' is a String object which + implements its own [[Get]] method to get 'configurable' property + (8.10.5 step 4.a) +---*/ + +var obj = {}; + +var descObj = new String(); +descObj.configurable = true; + +Object.defineProperties(obj, { + prop: descObj +}); +var result1 = obj.hasOwnProperty("prop"); +delete obj.prop; +var result2 = obj.hasOwnProperty("prop"); + +assert.sameValue(result1, true, 'result1'); +assert.sameValue(result2, false, 'result2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-75.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-75.js new file mode 100644 index 0000000000..c4a53060be --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-75.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-75 +description: > + Object.defineProperties - 'descObj' is a Boolean object which + implements its own [[Get]] method to get 'configurable' property + (8.10.5 step 4.a) +---*/ + +var obj = {}; + +var descObj = new Boolean(false); +descObj.configurable = true; + +Object.defineProperties(obj, { + prop: descObj +}); + +var result1 = obj.hasOwnProperty("prop"); +delete obj.prop; +var result2 = obj.hasOwnProperty("prop"); + +assert.sameValue(result1, true, 'result1'); +assert.sameValue(result2, false, 'result2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-76.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-76.js new file mode 100644 index 0000000000..20bffbec8b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-76.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-76 +description: > + Object.defineProperties - 'descObj' is a Number object which + implements its own [[Get]] method to get 'configurable' property + (8.10.5 step 4.a) +---*/ + +var obj = {}; + +var descObj = new Number(-9); +descObj.configurable = true; + +Object.defineProperties(obj, { + prop: descObj +}); + +var result1 = obj.hasOwnProperty("prop"); +delete obj.prop; +var result2 = obj.hasOwnProperty("prop"); + +assert.sameValue(result1, true, 'result1'); +assert.sameValue(result2, false, 'result2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-77.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-77.js new file mode 100644 index 0000000000..179177cdee --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-77.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-77 +description: > + Object.defineProperties - 'descObj' is the Math object which + implements its own [[Get]] method to get 'configurable' property + (8.10.5 step 4.a) +---*/ + +var obj = {}; + +Math.configurable = true; + +Object.defineProperties(obj, { + prop: Math +}); + +var result1 = obj.hasOwnProperty("prop"); +delete obj.prop; +var result2 = obj.hasOwnProperty("prop"); + +assert.sameValue(result1, true, 'result1'); +assert.sameValue(result2, false, 'result2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-78.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-78.js new file mode 100644 index 0000000000..827311cd55 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-78.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-78 +description: > + Object.defineProperties - 'descObj' is a Date object which + implements its own [[Get]] method to get 'configurable' property + (8.10.5 step 4.a) +---*/ + +var obj = {}; + +var descObj = new Date(); +descObj.configurable = true; + +Object.defineProperties(obj, { + prop: descObj +}); + +var result1 = obj.hasOwnProperty("prop"); +delete obj.prop; +var result2 = obj.hasOwnProperty("prop"); + +assert.sameValue(result1, true, 'result1'); +assert.sameValue(result2, false, 'result2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-79.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-79.js new file mode 100644 index 0000000000..30c6140460 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-79.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-79 +description: > + Object.defineProperties - 'descObj' is a RegExp object which + implements its own [[Get]] method to get 'configurable' property + (8.10.5 step 4.a) +---*/ + +var obj = {}; + +var descObj = new RegExp(); +descObj.configurable = true; + +Object.defineProperties(obj, { + prop: descObj +}); + +var result1 = obj.hasOwnProperty("prop"); +delete obj.prop; +var result2 = obj.hasOwnProperty("prop"); + +assert.sameValue(result1, true, 'result1'); +assert.sameValue(result2, false, 'result2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-8.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-8.js new file mode 100644 index 0000000000..10550729fe --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-8.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-8 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + own data property (8.10.5 step 3.a) +---*/ + +var obj = {}; +var accessed = false; + +var descObj = { + enumerable: true +}; + +Object.defineProperties(obj, { + prop: descObj +}); + +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-80.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-80.js new file mode 100644 index 0000000000..8b34049813 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-80.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-80 +description: > + Object.defineProperties - 'descObj' is the JSON object which + implements its own [[Get]] method to get 'configurable' property + (8.10.5 step 4.a) +---*/ + +var obj = {}; + +JSON.configurable = true; + +Object.defineProperties(obj, { + prop: JSON +}); + +var result1 = obj.hasOwnProperty("prop"); +delete obj.prop; +var result2 = obj.hasOwnProperty("prop"); + +assert.sameValue(result1, true, 'result1'); +assert.sameValue(result2, false, 'result2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-81.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-81.js new file mode 100644 index 0000000000..602d86f4cc --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-81.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-81 +description: > + Object.defineProperties - 'descObj' is an Error object which + implements its own [[Get]] method to get 'configurable' property + (8.10.5 step 4.a) +---*/ + +var obj = {}; + +var descObj = new Error(); +descObj.configurable = true; + +Object.defineProperties(obj, { + prop: descObj +}); + +var result1 = obj.hasOwnProperty("prop"); +delete obj.prop; +var result2 = obj.hasOwnProperty("prop"); + +assert.sameValue(result1, true, 'result1'); +assert.sameValue(result2, false, 'result2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-82.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-82.js new file mode 100644 index 0000000000..564569c783 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-82.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-82 +description: > + Object.defineProperties - 'descObj' is the Arguments object which + implements its own [[Get]] method to get 'configurable' property + (8.10.5 step 4.a) +---*/ + +var obj = {}; + +var arg; +(function fun() { + arg = arguments; +}()); + +arg.configurable = true; + +Object.defineProperties(obj, { + prop: arg +}); + +var result1 = obj.hasOwnProperty("prop"); +delete obj.prop; +var result2 = obj.hasOwnProperty("prop"); + +assert.sameValue(result1, true, 'result1'); +assert.sameValue(result2, false, 'result2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-84.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-84.js new file mode 100644 index 0000000000..eb476275d8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-84.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-84 +description: > + Object.defineProperties - 'descObj' is the global object which + implements its own [[Get]] method to get 'configurable' property + (8.10.5 step 4.a) +---*/ + +var obj = {}; + +this.configurable = true; + +Object.defineProperties(obj, { + prop: this +}); + +var result1 = obj.hasOwnProperty("prop"); +delete obj.prop; +var result2 = obj.hasOwnProperty("prop"); + +assert.sameValue(result1, true, 'result1'); +assert.sameValue(result2, false, 'result2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-85.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-85.js new file mode 100644 index 0000000000..4417c630c6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-85.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-85 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is undefined (8.10.5 step 4.b) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + configurable: undefined + } +}); + +assert(obj.hasOwnProperty("property")); +verifyNotConfigurable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-86.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-86.js new file mode 100644 index 0000000000..2745ab8dc5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-86.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-86 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is null (8.10.5 step 4.b) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + configurable: null + } +}); + +assert(obj.hasOwnProperty("property")); +verifyNotConfigurable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-87.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-87.js new file mode 100644 index 0000000000..54da422270 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-87.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-87 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is true (8.10.5 step 4.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + configurable: true + } +}); + +var hadOwnProperty = obj.hasOwnProperty("property"); + +delete obj.property; + +assert.sameValue(obj.hasOwnProperty("property"), false, 'obj.hasOwnProperty("property")'); +assert(hadOwnProperty, 'hadOwnProperty !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-88.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-88.js new file mode 100644 index 0000000000..461bc8e7eb --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-88.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-88 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is false (8.10.5 step 4.b) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + configurable: false + } +}); + +assert(obj.hasOwnProperty("property")); +verifyNotConfigurable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-89.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-89.js new file mode 100644 index 0000000000..79c808f491 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-89.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-89 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is 0 (8.10.5 step 4.b) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + configurable: 0 + } +}); + +assert(obj.hasOwnProperty("property")); +verifyNotConfigurable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-9.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-9.js new file mode 100644 index 0000000000..f8816c00d3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-9.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-9 +description: > + Object.defineProperties - 'enumerable' property of 'descObj' is + inherited data property (8.10.5 step 3.a) +---*/ + +var obj = {}; +var accessed = false; + +var proto = { + enumerable: true +}; +var Con = function() {}; +Con.prototype = proto; +var descObj = new Con(); + +Object.defineProperties(obj, { + prop: descObj +}); + +for (var property in obj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-90.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-90.js new file mode 100644 index 0000000000..198d61ea03 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-90.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-90 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is +0 (8.10.5 step 4.b) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + configurable: +0 + } +}); + +assert(obj.hasOwnProperty("property")); +verifyNotConfigurable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-91.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-91.js new file mode 100644 index 0000000000..701fe1df53 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-91.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-91 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is -0 (8.10.5 step 4.b) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + configurable: -0 + } +}); + +assert(obj.hasOwnProperty("property")); +verifyNotConfigurable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-92.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-92.js new file mode 100644 index 0000000000..b7997b1714 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-92.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-92 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is NaN (8.10.5 step 4.b) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + configurable: NaN + } +}); + +assert(obj.hasOwnProperty("property")); +verifyNotConfigurable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-93.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-93.js new file mode 100644 index 0000000000..c122aa7b15 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-93.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-93 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is positive number (8.10.5 step 4.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + configurable: 123 + } +}); + +var hadOwnProperty = obj.hasOwnProperty("property"); + +delete obj.property; + +assert.sameValue(obj.hasOwnProperty("property"), false, 'obj.hasOwnProperty("property")'); +assert(hadOwnProperty, 'hadOwnProperty !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-94.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-94.js new file mode 100644 index 0000000000..35f5914822 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-94.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-94 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is negative number (8.10.5 step 4.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + configurable: -123 + } +}); + +var hadOwnProperty = obj.hasOwnProperty("property"); + +delete obj.property; + +assert.sameValue(obj.hasOwnProperty("property"), false, 'obj.hasOwnProperty("property")'); +assert(hadOwnProperty, 'hadOwnProperty !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-95.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-95.js new file mode 100644 index 0000000000..db02d8a4c9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-95.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-95 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is empty string (8.10.5 step 4.b) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + configurable: "" + } +}); + +assert(obj.hasOwnProperty("property")); +verifyNotConfigurable(obj, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-96.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-96.js new file mode 100644 index 0000000000..d300ffa35b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-96.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-96 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is non-empty string (8.10.5 step 4.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + configurable: "abc" + } +}); + +var hadOwnProperty = obj.hasOwnProperty("property"); + +delete obj.property; + +assert.sameValue(obj.hasOwnProperty("property"), false, 'obj.hasOwnProperty("property")'); +assert(hadOwnProperty, 'hadOwnProperty !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-97.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-97.js new file mode 100644 index 0000000000..233d735ae0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-97.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-97 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is Function object (8.10.5 step 4.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + configurable: function() {} + } +}); + +var hadOwnProperty = obj.hasOwnProperty("property"); + +delete obj.property; + +assert.sameValue(obj.hasOwnProperty("property"), false, 'obj.hasOwnProperty("property")'); +assert(hadOwnProperty, 'hadOwnProperty !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-98.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-98.js new file mode 100644 index 0000000000..a17f84b8e8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-98.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-98 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is Array object (8.10.5 step 4.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + configurable: [1, 2, 3] + } +}); + +var hadOwnProperty = obj.hasOwnProperty("property"); + +delete obj.property; + +assert.sameValue(obj.hasOwnProperty("property"), false, 'obj.hasOwnProperty("property")'); +assert(hadOwnProperty, 'hadOwnProperty !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-99.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-99.js new file mode 100644 index 0000000000..d09169fe10 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-5-b-99.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-5-b-99 +description: > + Object.defineProperties - value of 'configurable' property of + 'descObj' is String object (8.10.5 step 4.b) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + property: { + configurable: new String("abc") + } +}); + +var hadOwnProperty = obj.hasOwnProperty("property"); + +delete obj.property; + +assert.sameValue(obj.hasOwnProperty("property"), false, 'obj.hasOwnProperty("property")'); +assert(hadOwnProperty, 'hadOwnProperty !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-1.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-1.js new file mode 100644 index 0000000000..91f2f1111f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-1.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-1 +description: > + Object.defineProperties - 'P' is own existing data property + (8.12.9 step 1 ) +---*/ + +var obj = {}; +Object.defineProperty(obj, "prop", { + value: 11, + configurable: false +}); +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + prop: { + value: 12, + configurable: true + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-10.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-10.js new file mode 100644 index 0000000000..b85868e08e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-10.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-10 +description: > + Object.defineProperties - 'P' is own accessor property without a + get function that overrides an inherited accessor property (8.12.9 + step 1 ) +---*/ + +var proto = {}; +Object.defineProperty(proto, "prop", { + get: function() { + return 11; + }, + set: function() {}, + configurable: true +}); +var Con = function() {}; +Con.prototype = proto; + +var obj = new Con(); +Object.defineProperty(obj, "prop", { + set: function() {}, + configurable: false +}); +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + prop: { + value: 12, + configurable: true + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-100.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-100.js new file mode 100644 index 0000000000..47bc46e287 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-100.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-100 +description: > + Object.defineProperties - 'P' is data property, several attributes + values of P and properties are different (8.12.9 step 12) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: 100, + writable: true, + configurable: true +}); + +Object.defineProperties(obj, { + foo: { + value: 200, + writable: false, + configurable: false + } +}); +verifyEqualTo(obj, "foo", 200); + +verifyNotWritable(obj, "foo"); + +verifyNotEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-101.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-101.js new file mode 100644 index 0000000000..462fb436d4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-101.js @@ -0,0 +1,48 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-101 +description: > + Object.defineProperties - 'P' is accessor property, both + properties.[[Get]] and P.[[Get]] are two different values (8.12.9 + step 12) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +function get_func() { + return 10; +} + +function set_func(value) { + obj.setVerifyHelpProp = value; +} + +Object.defineProperty(obj, "foo", { + get: get_func, + set: set_func, + enumerable: true, + configurable: true +}); + +function get_func2() { + return 20; +} + +Object.defineProperties(obj, { + foo: { + get: get_func2 + } +}); +verifyEqualTo(obj, "foo", get_func2()); + +verifyWritable(obj, "foo", "setVerifyHelpProp"); + +verifyEnumerable(obj, "foo"); + +verifyConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-102.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-102.js new file mode 100644 index 0000000000..a52e3b7580 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-102.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-102 +description: > + Object.defineProperties - 'P' is accessor property, P.[[Get]] is + present and properties.[[Get]] is undefined (8.12.9 step 12) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +function get_func() { + return 10; +} + +function set_func(value) { + obj.setVerifyHelpProp = value; +} + +Object.defineProperty(obj, "foo", { + get: get_func, + set: set_func, + enumerable: true, + configurable: true +}); + +Object.defineProperties(obj, { + foo: { + get: undefined + } +}); +verifyWritable(obj, "foo", "setVerifyHelpProp"); + +verifyEnumerable(obj, "foo"); + +verifyConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-103.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-103.js new file mode 100644 index 0000000000..69239b2647 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-103.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-103 +description: > + Object.defineProperties - 'P' is accessor property, P.[[Get]] is + undefined and properties.[[Get]] is normal value (8.12.9 step 12) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +function set_func(value) { + obj.setVerifyHelpProp = value; +} + +Object.defineProperty(obj, "foo", { + get: undefined, + set: set_func, + enumerable: true, + configurable: true +}); + +function get_func() { + return 10; +} + +Object.defineProperties(obj, { + foo: { + get: get_func + } +}); +verifyEqualTo(obj, "foo", get_func()); + +verifyWritable(obj, "foo", "setVerifyHelpProp"); + +verifyEnumerable(obj, "foo"); + +verifyConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-104.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-104.js new file mode 100644 index 0000000000..9723898ac6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-104.js @@ -0,0 +1,48 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-104 +description: > + Object.defineProperties - 'P' is accessor property, both + properties.[[Set]] and P.[[Set]] are two different values (8.12.9 + step 12) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +function get_func() { + return 10; +} + +function set_func() { + return 10; +} + +Object.defineProperty(obj, "foo", { + get: get_func, + set: set_func, + enumerable: true, + configurable: true +}); + +function set_func2(value) { + obj.setVerifyHelpProp = value; +} + +Object.defineProperties(obj, { + foo: { + set: set_func2 + } +}); +verifyEqualTo(obj, "foo", get_func()); + +verifyWritable(obj, "foo", "setVerifyHelpProp"); + +verifyEnumerable(obj, "foo"); + +verifyConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-105.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-105.js new file mode 100644 index 0000000000..e8557c7375 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-105.js @@ -0,0 +1,59 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-105 +description: > + Object.defineProperties - 'P' is accessor property, P.[[Set]] is + present and properties.[[Set]] is undefined (8.12.9 step 12) +---*/ + +var obj = {}; + +function get_func() { + return 10; +} + +function set_func() { + return 10; +} + +Object.defineProperty(obj, "property", { + get: get_func, + set: set_func, + enumerable: true, + configurable: true +}); + +Object.defineProperties(obj, { + property: { + set: undefined + } +}); + +var hasProperty = obj.hasOwnProperty("property"); +var verifyGet = false; +verifyGet = (obj.property === 10); + +var verifySet = false; +var desc = Object.getOwnPropertyDescriptor(obj, "property"); +verifySet = (typeof desc.set === 'undefined'); + +var verifyEnumerable = false; +for (var p in obj) { + if (p === "property") { + verifyEnumerable = true; + } +} + +var verifyConfigurable = false; +delete obj.property; +verifyConfigurable = obj.hasOwnProperty("property"); + +assert(hasProperty, 'hasProperty !== true'); +assert(verifyGet, 'verifyGet !== true'); +assert(verifySet, 'verifySet !== true'); +assert(verifyEnumerable, 'verifyEnumerable !== true'); +assert.sameValue(verifyConfigurable, false, 'verifyConfigurable'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-106.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-106.js new file mode 100644 index 0000000000..67cf09ee28 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-106.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-106 +description: > + Object.defineProperties - 'P' is accessor property, P.[[Set]] is + undefined and properties.[[Set]] is normal value (8.12.9 step 12) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +function get_func() { + return 10; +} + +Object.defineProperty(obj, "foo", { + get: get_func, + set: undefined, + enumerable: true, + configurable: true +}); + +function set_func(value) { + obj.setVerifyHelpProp = value; +} + +Object.defineProperties(obj, { + foo: { + set: set_func + } +}); +verifyEqualTo(obj, "foo", get_func()); + +verifyWritable(obj, "foo", "setVerifyHelpProp"); + +verifyEnumerable(obj, "foo"); + +verifyConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-107.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-107.js new file mode 100644 index 0000000000..87f7990aaa --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-107.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-107 +description: > + Object.defineProperties - 'P' is accessor property, P.enumerable + and properties.enumerable are different values (8.12.9 step 12) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +function get_func() { + return 10; +} + +function set_func(value) { + obj.setVerifyHelpProp = value; +} + +Object.defineProperty(obj, "foo", { + get: get_func, + set: set_func, + enumerable: true, + configurable: true +}); + +Object.defineProperties(obj, { + foo: { + enumerable: false + } +}); +verifyEqualTo(obj, "foo", get_func()); + +verifyWritable(obj, "foo", "setVerifyHelpProp"); + +verifyNotEnumerable(obj, "foo"); + +verifyConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-108.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-108.js new file mode 100644 index 0000000000..cf434bfbd8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-108.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-108 +description: > + Object.defineProperties - 'P' is accessor property, P.configurable + is true and properties.configurable is false +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +function get_func() { + return 10; +} + +function set_func(value) { + obj.setVerifyHelpProp = value; +} + +Object.defineProperty(obj, "foo", { + get: get_func, + set: set_func, + enumerable: true, + configurable: true +}); + +Object.defineProperties(obj, { + foo: { + configurable: false + } +}); +verifyEqualTo(obj, "foo", get_func()); + +verifyWritable(obj, "foo", "setVerifyHelpProp"); + +verifyEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-109.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-109.js new file mode 100644 index 0000000000..021bf58825 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-109.js @@ -0,0 +1,51 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-109 +description: > + Object.defineProperties - 'P' is accessor property, several + attributes values of P and properties are different (8.12.9 step + 12) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +function get_func1() { + return 10; +} + +function set_func1() {} + +Object.defineProperty(obj, "foo", { + get: get_func1, + set: set_func1, + configurable: true +}); + +function get_func2() { + return 20; +} + +function set_func2(value) { + obj.setVerifyHelpProp = value; +} + +Object.defineProperties(obj, { + foo: { + get: get_func2, + set: set_func2, + configurable: false + } +}); +verifyEqualTo(obj, "foo", get_func2()); + +verifyWritable(obj, "foo", "setVerifyHelpProp"); + +verifyNotEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-11.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-11.js new file mode 100644 index 0000000000..d3613ffdd8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-11.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-11 +description: > + Object.defineProperties - 'P' is inherited accessor property + without a get function (8.12.9 step 1 ) +---*/ + +var proto = {}; +Object.defineProperty(proto, "prop", { + set: function() {}, + configurable: false +}); +var Con = function() {}; +Con.prototype = proto; + +var obj = new Con(); + +Object.defineProperties(obj, { + prop: { + get: function() { + return 12; + }, + configurable: true + } +}); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(obj.prop, 12, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-110.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-110.js new file mode 100644 index 0000000000..1dca6bcb2f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-110.js @@ -0,0 +1,54 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-110 +description: > + Object.defineProperties - all own properties (data property and + accessor property) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +function get_func() { + return 10; +} + +function set_func(value) { + obj.setVerifyHelpProp = value; +} + +var properties = { + foo1: { + value: 200, + enumerable: true, + writable: true, + configurable: true + }, + foo2: { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + } +}; + +Object.defineProperties(obj, properties); +verifyEqualTo(obj, "foo1", 200); + +verifyWritable(obj, "foo1"); + +verifyEnumerable(obj, "foo1"); + +verifyConfigurable(obj, "foo1"); +verifyEqualTo(obj, "foo2", get_func()); + +verifyWritable(obj, "foo2", "setVerifyHelpProp"); + +verifyEnumerable(obj, "foo2"); + +verifyConfigurable(obj, "foo2"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-111.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-111.js new file mode 100644 index 0000000000..7e50a96c3c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-111.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-111 +description: Object.defineProperties - each properties are in list order +---*/ + +var obj = {}; + +function get_func() { + return 20; +} + +function set_func() {} + +var properties = { + a: { + value: 100, + enumerable: true, + writable: true, + configurable: true + }, + b: { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + }, + c: { + value: 200, + enumerable: true, + writable: true, + configurable: true + } +}; + +Object.defineProperties(obj, properties); + +assert.sameValue(obj["a"], 100, 'obj["a"]'); +assert.sameValue(obj["b"], 20, 'obj["b"]'); +assert.sameValue(obj["c"], 200, 'obj["c"]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-112.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-112.js new file mode 100644 index 0000000000..c33ed8dab5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-112.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-112 +description: > + Object.defineProperties - 'O' is an Array, test the length + property of 'O' is own data property (15.4.5.1 step 1) +---*/ + +var arr = [0, 1]; +Object.defineProperty(arr, "1", { + value: 1, + configurable: false +}); +assert.throws(TypeError, function() { + Object.defineProperties(arr, { + length: { + value: 1 + } + }); +}); +var desc = Object.getOwnPropertyDescriptor(arr, "length"); + +assert.sameValue(desc.value, 2, 'desc.value'); +assert(desc.writable, 'desc.writable !== true'); +assert.sameValue(desc.enumerable, false, 'desc.enumerable'); +assert.sameValue(desc.configurable, false, 'desc.configurable'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-113.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-113.js new file mode 100644 index 0000000000..dae7882a21 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-113.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-113 +description: > + Object.defineProperties - 'O' is an Array, test the length + property of 'O' is own data property that overrides an inherited + data property (15.4.5.1 step 1) +---*/ + +var arrProtoLen; +var arr = [0, 1, 2]; + +assert.throws(TypeError, function() { + arrProtoLen = Array.prototype.length; + Array.prototype.length = 0; + + Object.defineProperty(arr, "2", { + configurable: false + }); + + Object.defineProperties(arr, { + length: { + value: 1 + } + }); +}); + +var desc = Object.getOwnPropertyDescriptor(arr, "length"); +assert.sameValue(desc.value, 3, 'desc.value'); +assert(desc.writable, 'desc.writable !== true'); +assert.sameValue(desc.enumerable, false, 'desc.enumerable'); +assert.sameValue(desc.configurable, false, 'desc.configurable'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-114-b.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-114-b.js new file mode 100644 index 0000000000..dd6222e964 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-114-b.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-114-b +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is absent, test + every field in 'desc' is absent (15.4.5.1 step 3.a.i) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperties(arr, { + length: {} +}); + +if (arr.length !== 0) { + throw new Test262Error("Expected arr.length to be 0, actually " + arr.length); +} + +verifyEqualTo(arr, "length", 0); + +verifyWritable(arr, "length", "length", 1); + +verifyNotEnumerable(arr, "length"); + +verifyNotConfigurable(arr, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-114.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-114.js new file mode 100644 index 0000000000..2afb374774 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-114.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-114 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is absent, test + every field in 'desc' is absent (15.4.5.1 step 3.a.i) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperties(arr, { + length: {} +}); + +if (arr.length !== 0) { + throw new Test262Error("Expected arr.length to be 0, actually " + arr.length); +} + +arr.length = 2; + +verifyEqualTo(arr, "length", 2); + +verifyWritable(arr, "length", "length", 5); + +verifyNotEnumerable(arr, "length"); + +verifyNotConfigurable(arr, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-115.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-115.js new file mode 100644 index 0000000000..239ba3bb3e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-115.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-115 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is absent, test + every field in 'desc' is same with corresponding attribute value + of the length property in 'O' (15.4.5.1 step 3.a.i) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperties(arr, { + length: { + writable: true, + enumerable: false, + configurable: false + } +}); + +assert.sameValue(arr.length, 0); + +arr.length = 2; +assert.sameValue(arr.length, 2); + +verifyNotEnumerable(arr, "length"); + +verifyNotConfigurable(arr, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-116.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-116.js new file mode 100644 index 0000000000..29788037c2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-116.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-116 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is absent, test + TypeError is thrown when updating the [[Configurable]] attribute + of the length property from false to true (15.4.5.1 step 3.a.i) +---*/ + +var arr = []; +assert.throws(TypeError, function() { + Object.defineProperties(arr, { + length: { + configurable: true + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-117.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-117.js new file mode 100644 index 0000000000..ca94613c14 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-117.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-117 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is absent, test + TypeError is thrown when updating the [[Enumerable]] attribute of + the length property from false to true (15.4.5.1 step 3.a.i) +---*/ + +var arr = []; +assert.throws(TypeError, function() { + Object.defineProperties(arr, { + length: { + enumerable: true + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-118.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-118.js new file mode 100644 index 0000000000..f8e2d125c1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-118.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-118 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is absent, test + TypeError is thrown when 'desc' is accessor descriptor (15.4.5.1 + step 3.a.i) +---*/ + +var arr = []; +assert.throws(TypeError, function() { + Object.defineProperties(arr, { + length: { + get: function() { + return 2; + } + } + }); +}); +assert.sameValue(arr.length, 0, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-119.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-119.js new file mode 100644 index 0000000000..b65c1ffe81 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-119.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-119 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is absent, test + TypeError is thrown when updating the [[Writable]] attribute of + the length property from false to true (15.4.5.1 step 3.a.i) +---*/ + +var arr = []; + +Object.defineProperty(arr, "length", { + writable: false +}); +assert.throws(TypeError, function() { + Object.defineProperties(arr, { + length: { + writable: true + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-12.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-12.js new file mode 100644 index 0000000000..0c195e5e0d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-12.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-12 +description: > + Object.defineProperties - 'O' is a Function object which + implements its own [[GetOwnProperty]] method to get 'P' (8.12.9 + step 1 ) +includes: [propertyHelper.js] +---*/ + +var fun = function() {}; + +Object.defineProperty(fun, "prop", { + value: 11, + configurable: false +}); + +try { + Object.defineProperties(fun, { + prop: { + value: 12, + configurable: true + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(fun, "prop", 11); + + verifyNotWritable(fun, "prop"); + + verifyNotEnumerable(fun, "prop"); + + verifyNotConfigurable(fun, "prop"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-120.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-120.js new file mode 100644 index 0000000000..4704109b46 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-120.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-120 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is absent, test + updating the [[Writable]] attribute of the length property from + true to false (15.4.5.1 step 3.a.i) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperties(arr, { + length: { + writable: false + } +}); + +verifyEqualTo(arr, "length", 0); + +verifyNotWritable(arr, "length"); + +verifyNotEnumerable(arr, "length"); + +verifyNotConfigurable(arr, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-121.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-121.js new file mode 100644 index 0000000000..e2a62925b5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-121.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-121 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', test RangeError is thrown when setting the + [[Value]] field of 'desc' to undefined (15.4.5.1 step 3.c) +---*/ + +var arr = []; +assert.throws(RangeError, function() { + Object.defineProperties(arr, { + length: { + value: undefined + } + }); +}); +assert.sameValue(arr.length, 0, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-122.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-122.js new file mode 100644 index 0000000000..04d38a7546 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-122.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-122 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', test setting the [[Value]] field of 'desc' to + null actuall is set to 0 (15.4.5.1 step 3.c) +---*/ + +var arr = [0, 1]; + +Object.defineProperties(arr, { + length: { + value: null + } +}); + +assert.sameValue(arr.length, 0, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-123.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-123.js new file mode 100644 index 0000000000..c2aacf23ba --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-123.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-123 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is a boolean + with value false (15.4.5.1 step 3.c) +---*/ + +var arr = [0, 1]; + +Object.defineProperties(arr, { + length: { + value: false + } +}); + +assert.sameValue(arr.length, 0, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-124.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-124.js new file mode 100644 index 0000000000..c5d5ab9d99 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-124.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-124 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is a boolean + with value true (15.4.5.1 step 3.c) +---*/ + +var arr = []; + +Object.defineProperties(arr, { + length: { + value: true + } +}); + +assert.sameValue(arr.length, 1, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-125.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-125.js new file mode 100644 index 0000000000..45941af224 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-125.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-125 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is 0 (15.4.5.1 + step 3.c) +---*/ + +var arr = [0, 1]; + +Object.defineProperties(arr, { + length: { + value: 0 + } +}); + +assert.sameValue(arr.length, 0, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-126.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-126.js new file mode 100644 index 0000000000..76d099f8c2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-126.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-126 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is +0 + (15.4.5.1 step 3.c) +---*/ + +var arr = [0, 1]; + +Object.defineProperties(arr, { + length: { + value: +0 + } +}); + +assert.sameValue(arr.length, 0, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-127.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-127.js new file mode 100644 index 0000000000..e7fb1e20b2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-127.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-127 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is -0 + (15.4.5.1 step 3.c) +---*/ + +var arr = [0, 1]; + +Object.defineProperties(arr, { + length: { + value: -0 + } +}); + +assert.sameValue(arr.length, 0, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-128.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-128.js new file mode 100644 index 0000000000..c87e70626f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-128.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-128 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is positive + number (15.4.5.1 step 3.c) +---*/ + +var arr = []; + +Object.defineProperties(arr, { + length: { + value: 12 + } +}); + +assert.sameValue(arr.length, 12, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-129.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-129.js new file mode 100644 index 0000000000..1a4aeead29 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-129.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-129 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is negative + number (15.4.5.1 step 3.c) +---*/ + +var arr = []; +assert.throws(RangeError, function() { + Object.defineProperties(arr, { + length: { + value: -9 + } + }); +}); +assert.sameValue(arr.length, 0, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-13.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-13.js new file mode 100644 index 0000000000..be22cb8d81 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-13.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-13 +description: > + Object.defineProperties - 'O' is an Array object which implements + its own [[GetOwnProperty]] method to get 'P' (8.12.9 step 1 ) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperty(arr, "prop", { + value: 11, + configurable: false +}); + +try { + Object.defineProperties(arr, { + prop: { + value: 12, + configurable: true + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arr, "prop", 11); + + verifyNotWritable(arr, "prop"); + + verifyNotEnumerable(arr, "prop"); + + verifyNotConfigurable(arr, "prop"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-130.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-130.js new file mode 100644 index 0000000000..74c83edc72 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-130.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-130 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is +Infinity + (15.4.5.1 step 3.c) +---*/ + +var arr = []; +assert.throws(RangeError, function() { + Object.defineProperties(arr, { + length: { + value: +Infinity + } + }); +}); +assert.sameValue(arr.length, 0, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-131.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-131.js new file mode 100644 index 0000000000..f926330579 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-131.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-131 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is -Infinity + (15.4.5.1 step 3.c) +---*/ + +var arr = []; +assert.throws(RangeError, function() { + Object.defineProperties(arr, { + length: { + value: -Infinity + } + }); +}); +assert.sameValue(arr.length, 0, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-132.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-132.js new file mode 100644 index 0000000000..df5beab3ce --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-132.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-132 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is NaN + (15.4.5.1 step 3.c) +---*/ + +var arr = []; +assert.throws(RangeError, function() { + Object.defineProperties(arr, { + length: { + value: NaN + } + }); +}); +assert.sameValue(arr.length, 0, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-133.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-133.js new file mode 100644 index 0000000000..51846f930d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-133.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-133 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is a string + containing a positive number (15.4.5.1 step 3.c) +---*/ + +var arr = []; + +Object.defineProperties(arr, { + length: { + value: "2" + } +}); + +assert.sameValue(arr.length, 2, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-134.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-134.js new file mode 100644 index 0000000000..bb4c3fea69 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-134.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-134 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is a string + containing a negative number (15.4.5.1 step 3.c) +---*/ + +var arr = []; +assert.throws(RangeError, function() { + Object.defineProperties(arr, { + length: { + value: "-42" + } + }); +}); +assert.sameValue(arr.length, 0, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-135.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-135.js new file mode 100644 index 0000000000..9b191cf36c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-135.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-135 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is a string + containing a decimal number (15.4.5.1 step 3.c) +---*/ + +var arr = []; +assert.throws(RangeError, function() { + Object.defineProperties(arr, { + length: { + value: "200.59" + } + }); +}); +assert.sameValue(arr.length, 0, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-136.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-136.js new file mode 100644 index 0000000000..e941c99a5c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-136.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-136 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is a string + containing +Infinity (15.4.5.1 step 3.c) +---*/ + +var arr = []; +assert.throws(RangeError, function() { + Object.defineProperties(arr, { + length: { + value: "+Infinity" + } + }); +}); +assert.sameValue(arr.length, 0, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-137.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-137.js new file mode 100644 index 0000000000..8f22ff6d12 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-137.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-137 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is a string + containing -Infinity (15.4.5.1 step 3.c) +---*/ + +var arr = []; +assert.throws(RangeError, function() { + Object.defineProperties(arr, { + length: { + value: "-Infinity" + } + }); +}); +assert.sameValue(arr.length, 0, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-138.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-138.js new file mode 100644 index 0000000000..f5f4ca97c7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-138.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-138 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is a string + containing an exponential number (15.4.5.1 step 3.c) +---*/ + +var arr = []; + +Object.defineProperties(arr, { + length: { + value: "2E3" + } +}); + +assert.sameValue(arr.length, 2E3, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-139.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-139.js new file mode 100644 index 0000000000..779dc80530 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-139.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-139 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is a string + containing an hex number (15.4.5.1 step 3.c) +---*/ + +var arr = []; + +Object.defineProperties(arr, { + length: { + value: "0x00B" + } +}); + +assert.sameValue(arr.length, 0x00B, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-14.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-14.js new file mode 100644 index 0000000000..3ecd73ab51 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-14.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-14 +description: > + Object.defineProperties - 'O' is a String object which implements + its own [[GetOwnProperty]] method to get 'P' (8.12.9 step 1 ) +includes: [propertyHelper.js] +---*/ + +var str = new String(); + +Object.defineProperty(str, "prop", { + value: 11, + configurable: false +}); + +try { + Object.defineProperties(str, { + prop: { + value: 12, + configurable: true + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(str, "prop", 11); + + verifyNotWritable(str, "prop"); + + verifyNotEnumerable(str, "prop"); + + verifyNotConfigurable(str, "prop"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-140.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-140.js new file mode 100644 index 0000000000..0cf0195afd --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-140.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-140 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is a string + containing an leading zero number (15.4.5.1 step 3.c) +---*/ + +var arr = []; + +Object.defineProperties(arr, { + length: { + value: "0002.0" + } +}); + +assert.sameValue(arr.length, 2, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-141.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-141.js new file mode 100644 index 0000000000..b2f64a82fc --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-141.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-141 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', test the [[Value]] field of 'desc' is a string + which doesn't convert to a number (15.4.5.1 step 3.c) +---*/ + +var arr = []; +assert.throws(RangeError, function() { + Object.defineProperties(arr, { + length: { + value: "two" + } + }); +}); +assert.sameValue(arr.length, 0, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-142.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-142.js new file mode 100644 index 0000000000..0a01558be8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-142.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-142 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', test the [[Value]] field of 'desc' is an Object + which has an own toString method (15.4.5.1 step 3.c) +---*/ + +var arr = []; + +Object.defineProperties(arr, { + length: { + value: { + toString: function() { + return '2'; + } + } + } +}); + +assert.sameValue(arr.length, 2, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-143.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-143.js new file mode 100644 index 0000000000..6eb1eef701 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-143.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-143 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is an Object + which has an own valueOf method (15.4.5.1 step 3.c) +---*/ + +var arr = []; + +Object.defineProperties(arr, { + length: { + value: { + valueOf: function() { + return 2; + } + } + } +}); + +assert.sameValue(arr.length, 2, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-144.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-144.js new file mode 100644 index 0000000000..eb8e70e562 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-144.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-144 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is an Object + which has an own valueOf method that returns an object and + toString method that returns a string (15.4.5.1 step 3.c) +---*/ + +var arr = []; +var toStringAccessed = false; +var valueOfAccessed = false; + +Object.defineProperties(arr, { + length: { + value: { + toString: function() { + toStringAccessed = true; + return '2'; + }, + + valueOf: function() { + valueOfAccessed = true; + return {}; + } + } + } +}); + +assert.sameValue(arr.length, 2, 'arr.length'); +assert(toStringAccessed, 'toStringAccessed !== true'); +assert(valueOfAccessed, 'valueOfAccessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-145.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-145.js new file mode 100644 index 0000000000..8106192eb6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-145.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-145 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is an Object + which has an own toString and valueOf method (15.4.5.1 step 3.c) +---*/ + +var arr = []; +var toStringAccessed = false; +var valueOfAccessed = false; + +Object.defineProperties(arr, { + length: { + value: { + toString: function() { + toStringAccessed = true; + return '2'; + }, + + valueOf: function() { + valueOfAccessed = true; + return 3; + } + } + } +}); + +assert.sameValue(arr.length, 3, 'arr.length'); +assert.sameValue(toStringAccessed, false, 'toStringAccessed'); +assert(valueOfAccessed, 'valueOfAccessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-146.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-146.js new file mode 100644 index 0000000000..5ad11449cb --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-146.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-146 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test TypeError is thrown when the [[Value]] field + of 'desc' is an Object that both toString and valueOf wouldn't + return primitive value (15.4.5.1 step 3.c) +---*/ + +var arr = []; +var toStringAccessed = false; +var valueOfAccessed = false; +assert.throws(TypeError, function() { + Object.defineProperties(arr, { + length: { + value: { + toString: function() { + toStringAccessed = true; + return {}; + }, + + valueOf: function() { + valueOfAccessed = true; + return {}; + } + } + } + }); +}); +assert(toStringAccessed, 'toStringAccessed !== true'); +assert(valueOfAccessed, 'valueOfAccessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-147.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-147.js new file mode 100644 index 0000000000..ad2a99a518 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-147.js @@ -0,0 +1,47 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-147 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test using inherited valueOf method when the + [[Value]] field of 'desc' is an Objec with an own toString and + inherited valueOf methods (15.4.5.1 step 3.c) +---*/ + +var arr = []; +var toStringAccessed = false; +var valueOfAccessed = false; + +var proto = { + value: { + valueOf: function() { + valueOfAccessed = true; + return 2; + } + } +}; + +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); +Object.defineProperty(child, "value", { + value: { + toString: function() { + toStringAccessed = true; + return 3; + } + } +}); + +Object.defineProperties(arr, { + length: child +}); + +assert.sameValue(arr.length, 3, 'arr.length'); +assert(toStringAccessed, 'toStringAccessed !== true'); +assert.sameValue(valueOfAccessed, false, 'valueOfAccessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-148.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-148.js new file mode 100644 index 0000000000..8bf9f0d7b2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-148.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-148 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test RangeError is thrown when the [[Value]] + field of 'desc' is positive non-integer values (15.4.5.1 step 3.c) +---*/ + +var arr = []; +assert.throws(RangeError, function() { + Object.defineProperties(arr, { + length: { + value: 123.5 + } + }); +}); +assert.sameValue(arr.length, 0, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-149.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-149.js new file mode 100644 index 0000000000..ee25283c2d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-149.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-149 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test RangeError is thrown when the [[Value]] + field of 'desc' is negative non-integer values (15.4.5.1 step 3.c) +---*/ + +var arr = []; +assert.throws(RangeError, function() { + Object.defineProperties(arr, { + length: { + value: -4294967294.5 + } + }); +}); +assert.sameValue(arr.length, 0, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-15.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-15.js new file mode 100644 index 0000000000..a86aaa2ec5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-15.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-15 +description: > + Object.defineProperties - 'O' is a Boolean object which implements + its own [[GetOwnProperty]] method to get 'P' (8.12.9 step 1 ) +includes: [propertyHelper.js] +---*/ + + +var obj = new Boolean(false); + +Object.defineProperty(obj, "prop", { + value: 11, + configurable: false +}); + +try { + Object.defineProperties(obj, { + prop: { + value: 12, + configurable: true + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(obj, "prop", 11); + + verifyNotWritable(obj, "prop"); + + verifyNotEnumerable(obj, "prop"); + + verifyNotConfigurable(obj, "prop"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-150.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-150.js new file mode 100644 index 0000000000..fa670c41a2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-150.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-150 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is boundary + value 2^32 - 2 (15.4.5.1 step 3.c) +---*/ + +var arr = []; + +Object.defineProperties(arr, { + length: { + value: 4294967294 + } +}); + +assert.sameValue(arr.length, 4294967294, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-151.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-151.js new file mode 100644 index 0000000000..874276ed8c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-151.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-151 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test the [[Value]] field of 'desc' is boundary + value 2^32 - 1 (15.4.5.1 step 3.c) +---*/ + +var arr = []; + +Object.defineProperties(arr, { + length: { + value: 4294967295 + } +}); + +assert.sameValue(arr.length, 4294967295, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-152.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-152.js new file mode 100644 index 0000000000..0e5e9f0e0b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-152.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-152 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test RangeError is thrown when the [[Value]] + field of 'desc' is boundary value 2^32 (15.4.5.1 step 3.c) +---*/ + +var arr = []; +assert.throws(RangeError, function() { + Object.defineProperties(arr, { + length: { + value: 4294967296 + } + }); +}); +assert.sameValue(arr.length, 0, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-153.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-153.js new file mode 100644 index 0000000000..31bed6610c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-153.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-153 +description: > + Object.defineProperties - 'O' is an Array, 'name' is the length + property of 'O', test RangeError is thrown when the [[Value]] + field of 'desc' is boundary value 2^32 + 1 (15.4.5.1 step 3.c) +---*/ + +var arr = []; +assert.throws(RangeError, function() { + Object.defineProperties(arr, { + length: { + value: 4294967297 + } + }); +}); +assert.sameValue(arr.length, 0, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-155.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-155.js new file mode 100644 index 0000000000..d83b7c6c20 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-155.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-155 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', test the [[Value]] field of 'desc' which is + greater than value of the length property is defined into 'O' + without deleting any property with large index named (15.4.5.1 + step 3.f) +---*/ + +var arr = [0, , 2]; + +Object.defineProperties(arr, { + length: { + value: 5 + } +}); + +assert.sameValue(arr.length, 5, 'arr.length'); +assert.sameValue(arr[0], 0, 'arr[0]'); +assert.sameValue(arr.hasOwnProperty("1"), false, 'arr.hasOwnProperty("1")'); +assert.sameValue(arr[2], 2, 'arr[2]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-156.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-156.js new file mode 100644 index 0000000000..84987aa27f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-156.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-156 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', test the [[Value]] field of 'desc' which equals + to value of the length property is defined into 'O' without + deleting any property with large index named (15.4.5.1 step 3.f) +---*/ + +var arr = [0, , 2]; + +Object.defineProperties(arr, { + length: { + value: 3 + } +}); + +assert.sameValue(arr.length, 3, 'arr.length'); +assert.sameValue(arr[0], 0, 'arr[0]'); +assert.sameValue(arr.hasOwnProperty("1"), false, 'arr.hasOwnProperty("1")'); +assert.sameValue(arr[2], 2, 'arr[2]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-157.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-157.js new file mode 100644 index 0000000000..d840a1338b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-157.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-157 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', test the [[Value]] field of 'desc' which is less + than value of the length property is defined into 'O' with + deleting properties with large index named (15.4.5.1 step 3.f) +---*/ + +var arr = [0, 1]; + +Object.defineProperties(arr, { + length: { + value: 1 + } +}); + +assert.sameValue(arr.length, 1, 'arr.length'); +assert.sameValue(arr.hasOwnProperty("1"), false, 'arr.hasOwnProperty("1")'); +assert.sameValue(arr[0], 0, 'arr[0]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-158.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-158.js new file mode 100644 index 0000000000..018905fbe8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-158.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-158 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is greater than + value of the length property, test TypeError is thrown when the + length property is not writable (15.4.5.1 step 3.f.i) +---*/ + +var arr = []; + +Object.defineProperty(arr, "length", { + writable: false +}); +assert.throws(TypeError, function() { + Object.defineProperties(arr, { + length: { + value: 12 + } + }); +}); +assert.sameValue(arr.length, 0, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-159.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-159.js new file mode 100644 index 0000000000..df9393aefd --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-159.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-159 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' equals to value of + the length property, test TypeError wouldn't be thrown when the + length property is not writable (15.4.5.1 step 3.f.i) +---*/ + +var arr = []; + +Object.defineProperty(arr, "length", { + writable: false +}); + +Object.defineProperties(arr, { + length: { + value: 0 + } +}); + +assert.sameValue(arr.length, 0, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-16.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-16.js new file mode 100644 index 0000000000..e78dcaa3e2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-16.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-16 +description: > + Object.defineProperties - 'O' is a Number object which implements + its own [[GetOwnProperty]] method to get 'P' (8.12.9 step 1 ) +includes: [propertyHelper.js] +---*/ + + +var obj = new Number(-9); + +Object.defineProperty(obj, "prop", { + value: 11, + configurable: false +}); + +try { + Object.defineProperties(obj, { + prop: { + value: 12, + configurable: true + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(obj, "prop", 11); + + verifyNotWritable(obj, "prop"); + + verifyNotEnumerable(obj, "prop"); + + verifyNotConfigurable(obj, "prop"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-160.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-160.js new file mode 100644 index 0000000000..6ad259a4cc --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-160.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-160 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test TypeError is thrown when the + [[Writable]] attribute of the length property is false (15.4.5.1 + step 3.g) +---*/ + +var arr = [0, 1]; + +Object.defineProperty(arr, "length", { + writable: false +}); +assert.throws(TypeError, function() { + Object.defineProperties(arr, { + length: { + value: 0 + } + }); +}); +assert.sameValue(arr.length, 2, 'arr.length'); +assert.sameValue(arr[0], 0, 'arr[0]'); +assert.sameValue(arr[1], 1, 'arr[1]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-161.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-161.js new file mode 100644 index 0000000000..8e61857063 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-161.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-161 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Writable]] attribute of the + length property is set to true at last after deleting properties + with large index named if the [[Writable]] field of 'desc' is + absent (15.4.5.1 step 3.h) +---*/ + +var arr = [0, 1]; + +Object.defineProperties(arr, { + length: { + value: 1 + } +}); + +arr.length = 10; //try to overwrite length value of arr + +assert.sameValue(arr.hasOwnProperty("1"), false, 'arr.hasOwnProperty("1")'); +assert.sameValue(arr.length, 10, 'arr.length'); +assert.sameValue(arr[0], 0, 'arr[0]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-162.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-162.js new file mode 100644 index 0000000000..a4b8af0beb --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-162.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-162 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Writable]] attribute of the + length property is set to true at last after deleting properties + with large index named if the [[Writable]] field of 'desc' is true + (15.4.5.1 step 3.h) +---*/ + +var arr = [0, 1]; + +Object.defineProperties(arr, { + length: { + value: 1, + writable: true + } +}); + +arr.length = 10; //try to overwrite length value of arr + +assert.sameValue(arr.hasOwnProperty("1"), false, 'arr.hasOwnProperty("1")'); +assert.sameValue(arr.length, 10, 'arr.length'); +assert.sameValue(arr[0], 0, 'arr[0]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-163.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-163.js new file mode 100644 index 0000000000..cbe3a65ff3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-163.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-163 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Writable]] attribute of the + length property is set to false at last after deleting properties + with large index named if the [[Writable]] field of 'desc' is + false (15.4.5.1 step 3.i.ii) +includes: [propertyHelper.js] +---*/ + + +var arr = [0, 1]; + +Object.defineProperties(arr, { + length: { + value: 1, + writable: false + } +}); + +//try to overwrite length value of arr +verifyNotWritable(arr, "length") + +assert(!arr.hasOwnProperty("1")); +assert.sameValue(arr.length, 1); +assert.sameValue(arr[0], 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-164.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-164.js new file mode 100644 index 0000000000..f699551ca6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-164.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-164 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Writable]] attribute of the + length property in 'O' is set as true before deleting properties + with large index named (15.4.5.1 step 3.i.iii) +includes: [propertyHelper.js] +---*/ + + +var arr = [0, 1, 2]; +var result = 0; + +try { + Object.defineProperty(arr, "1", { + configurable: false + }); + + Object.defineProperties(arr, { + length: { + value: 0, + writable: false + } + }); + + throw new Test262Error("expected to throw TypeError") +} catch (e) { + assert(e instanceof TypeError); + assert.sameValue(arr.length, 2); + verifyNotWritable(arr, "length"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-165.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-165.js new file mode 100644 index 0000000000..ed253052a5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-165.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-165 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the length property is decreased by + 1 (15.4.5.1 step 3.l.i) +---*/ + +var arr = [0, 1, 2]; + +Object.defineProperty(arr, "1", { + configurable: false +}); + +Object.defineProperty(arr, "2", { + configurable: true +}); +assert.throws(TypeError, function() { + Object.defineProperties(arr, { + length: { + value: 1 + } + }); +}); +assert.sameValue(arr.length, 2, 'arr.length'); +assert.sameValue(arr.hasOwnProperty("2"), false, 'arr.hasOwnProperty("2")'); +assert.sameValue(arr[0], 0, 'arr[0]'); +assert.sameValue(arr[1], 1, 'arr[1]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-166.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-166.js new file mode 100644 index 0000000000..ff19c657b1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-166.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-166 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Configurable]] attribute of + own data property with large index named in 'O' can stop deleting + index named properties (15.4.5.1 step 3.l.ii) +---*/ + +var arr = [0, 1]; +assert.throws(TypeError, function() { + Object.defineProperty(arr, "1", { + configurable: false + }); + + Object.defineProperties(arr, { + length: { + value: 1 + } + }); +}); +assert.sameValue(arr.length, 2, 'arr.length'); +assert(arr.hasOwnProperty("1"), 'arr.hasOwnProperty("1") !== true'); +assert.sameValue(arr[0], 0, 'arr[0]'); +assert.sameValue(arr[1], 1, 'arr[1]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-167.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-167.js new file mode 100644 index 0000000000..f623d1f37d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-167.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-167 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Configurable]] attribute of + inherited data property with large index named in 'O' can't stop + deleting index named properties (15.4.5.1 step 3.l.ii) +---*/ + +var arr = [0, 1]; + +Array.prototype[1] = 2; //we are not allowed to set the [[Configurable]] attribute of property "1" to false here, since Array.prototype is a global object, and non-configurbale property can't revert to configurable + +Object.defineProperties(arr, { + length: { + value: 1 + } +}); + +assert.sameValue(arr.length, 1, 'arr.length'); +assert.sameValue(arr.hasOwnProperty("1"), false, 'arr.hasOwnProperty("1")'); +assert.sameValue(arr[0], 0, 'arr[0]'); +assert.sameValue(Array.prototype[1], 2, 'Array.prototype[1]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-168.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-168.js new file mode 100644 index 0000000000..5454f79f69 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-168.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-168 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Configurable]] attribute of + own data property with large index named in 'O' that overrides + inherited data property can stop deleting index named properties + (15.4.5.1 step 3.l.ii) +---*/ + +var arr = [0, 1]; + +assert.throws(TypeError, function() { + Object.defineProperty(arr, "1", { + configurable: false + }); + + Array.prototype[1] = 2; + + Object.defineProperties(arr, { + length: { + value: 1 + } + }); +}); +assert.sameValue(arr.length, 2, 'arr.length'); +assert(arr.hasOwnProperty("1"), 'arr.hasOwnProperty("1") !== true'); +assert.sameValue(arr[0], 0, 'arr[0]'); +assert.sameValue(arr[1], 1, 'arr[1]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-169.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-169.js new file mode 100644 index 0000000000..16ef751878 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-169.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-169 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Configurable]] attribute of + own data property with large index named in 'O' that overrides + inherited accessor property can stop deleting index named + properties (15.4.5.1 step 3.l.ii) +---*/ + +var arr = [0, 1]; + +assert.throws(TypeError, function() { + Object.defineProperty(arr, "1", { + configurable: false + }); + + Object.defineProperty(Array.prototype, "1", { + get: function() { + return 2; + }, + configurable: true + }); + + Object.defineProperties(arr, { + length: { + value: 1 + } + }); +}); +assert.sameValue(arr.length, 2, 'arr.length'); +assert(arr.hasOwnProperty("1"), 'arr.hasOwnProperty("1") !== true'); +assert.sameValue(arr[0], 0, 'arr[0]'); +assert.sameValue(arr[1], 1, 'arr[1]'); +assert.sameValue(Array.prototype[1], 2, 'Array.prototype[1]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-17.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-17.js new file mode 100644 index 0000000000..89ca2bb911 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-17.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-17 +description: > + Object.defineProperties - 'O' is the Math object which implements + its own [[GetOwnProperty]] method to get 'P' (8.12.9 step 1 ) +---*/ + +Object.defineProperty(Math, "prop", { + value: 11, + writable: true, + configurable: true +}); +var hasProperty = Math.hasOwnProperty("prop") && Math.prop === 11; + +Object.defineProperties(Math, { + prop: { + value: 12 + } +}); + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(Math.prop, 12, 'Math.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-170.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-170.js new file mode 100644 index 0000000000..f6380a5e77 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-170.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-170 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Configurable]] attribute of + own accessor property with large index named in 'O' can stop + deleting index named properties (15.4.5.1 step 3.l.ii) +---*/ + +var arr = [0, 1]; +assert.throws(TypeError, function() { + Object.defineProperty(arr, "1", { + get: function() { + return 1; + }, + configurable: false + }); + + Object.defineProperties(arr, { + length: { + value: 1 + } + }); +}); +assert.sameValue(arr.length, 2, 'arr.length'); +assert(arr.hasOwnProperty("1"), 'arr.hasOwnProperty("1") !== true'); +assert.sameValue(arr[0], 0, 'arr[0]'); +assert.sameValue(arr[1], 1, 'arr[1]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-171.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-171.js new file mode 100644 index 0000000000..0d9fea2de9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-171.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-171 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Configurable]] attribute of + inherited accessor property with large index named in 'O' can't + stop deleting index named properties (15.4.5.1 step 3.l.ii) +---*/ + +var arr = [0, 1]; + +Object.defineProperty(Array.prototype, "1", { + get: function() { + return 1; + }, + configurable: true //we are not allowed to set the [[Configurable]] attribute of property "1" to false here, since Array.prototype is a global object, and non-configurbale property can't revert to configurable +}); + +Object.defineProperties(arr, { + length: { + value: 1 + } +}); + +assert.sameValue(arr.length, 1, 'arr.length'); +assert.sameValue(arr.hasOwnProperty("1"), false, 'arr.hasOwnProperty("1")'); +assert.sameValue(arr[0], 0, 'arr[0]'); +assert.sameValue(Array.prototype[1], 1, 'Array.prototype[1]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-172.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-172.js new file mode 100644 index 0000000000..0f6313a2c7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-172.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-172 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Configurable]] attribute of + own accessor property with large index named in 'O' that overrides + inherited data property can stop deleting index named properties + (15.4.5.1 step 3.l.ii) +---*/ + +var arr = [0, 1]; + +assert.throws(TypeError, function() { + Object.defineProperty(arr, "1", { + get: function() { + return 2; + }, + configurable: false + }); + + Array.prototype[1] = 3; + + Object.defineProperties(arr, { + length: { + value: 1 + } + }); +}); +assert.sameValue(arr.length, 2, 'arr.length'); +assert(arr.hasOwnProperty("1"), 'arr.hasOwnProperty("1") !== true'); +assert.sameValue(arr[0], 0, 'arr[0]'); +assert.sameValue(arr[1], 2, 'arr[1]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-173.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-173.js new file mode 100644 index 0000000000..e6be693280 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-173.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-173 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Configurable]] attribute of + own accessor property with large index named in 'O' that overrides + inherited accessor property can stop deleting index named + properties (15.4.5.1 step 3.l.ii) +---*/ + +var arr = [0, 1]; + +assert.throws(TypeError, function() { + Object.defineProperty(arr, "1", { + get: function() { + return 1; + }, + configurable: false + }); + + Object.defineProperty(Array.prototype, "1", { + get: function() { + return 2; + }, + configurable: true + }); + + Object.defineProperties(arr, { + length: { + value: 1 + } + }); +}); +assert.sameValue(arr.length, 2, 'arr.length'); +assert(arr.hasOwnProperty("1"), 'arr.hasOwnProperty("1") !== true'); +assert.sameValue(arr[0], 0, 'arr[0]'); +assert.sameValue(arr[1], 1, 'arr[1]'); +assert.sameValue(Array.prototype[1], 2, 'Array.prototype[1]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-174.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-174.js new file mode 100644 index 0000000000..6391a508db --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-174.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-174 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the configurable large index named + property of 'O' can be deleted (15.4.5.1 step 3.l.ii) +---*/ + +var arr = [0, 1]; + +Object.defineProperties(arr, { + length: { + value: 1 + } +}); + +assert.sameValue(arr.hasOwnProperty("1"), false, 'arr.hasOwnProperty("1")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-175.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-175.js new file mode 100644 index 0000000000..aec08e4e04 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-175.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-175 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test value of the length property is set + to the last non-configurable index named property of 'O' plus 1 + (15.4.5.1 step 3.l.iii.1) +---*/ + +var arr = [0, 1, 2, 3]; + +Object.defineProperty(arr, "1", { + configurable: false +}); +assert.throws(TypeError, function() { + Object.defineProperties(arr, { + length: { + value: 1 + } + }); +}); +assert.sameValue(arr.length, 2, 'arr.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-176.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-176.js new file mode 100644 index 0000000000..7117baebef --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-176.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-176 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Writable]] attribute of the + length property is set to false at last when the [[Writable]] + field of 'desc' is false and 'O' contains non-configurable large + index named property (15.4.5.1 step 3.l.iii.2) +includes: [propertyHelper.js] +---*/ + + +var arr = [0, 1]; + +try { + Object.defineProperty(arr, "1", { + configurable: false + }); + + Object.defineProperties(arr, { + length: { + value: 1, + writable: false + } + }); + + throw new Test262Error("Expected to throw TypeError"); +} catch (e) { + assert(e instanceof TypeError); + assert(arr.hasOwnProperty("1")); + verifyNotWritable(arr, "length"); + assert.sameValue(arr[0], 0); + assert.sameValue(arr[1], 1); + assert.sameValue(arr.length, 2) +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-177.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-177.js new file mode 100644 index 0000000000..1ebd1320be --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-177.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-177 +description: > + Object.defineProperties - 'O' is an Array, 'P' is the length + property of 'O', the [[Value]] field of 'desc' is less than value + of the length property, test the [[Writable]] attribute of the + length property is set to false at last when the [[Writable]] + field of 'desc' is false and 'O' doesn't contain non-configurable + large index named property (15.4.5.1 step 3.m) +includes: [propertyHelper.js] +---*/ + + +var arr = [0, 1]; + +Object.defineProperties(arr, { + length: { + value: 0, + writable: false + } +}); + +assert(!arr.hasOwnProperty("1")); +assert.sameValue(arr.length, 0); +assert(!arr.hasOwnProperty("0")); +verifyNotWritable(arr, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-178.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-178.js new file mode 100644 index 0000000000..517426c669 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-178.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-178 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' is available String values that convert to + numbers (15.4.5.1 step 4.a) +---*/ + +var arr = [0]; + +Object.defineProperties(arr, { + "0": { + value: 12 + } +}); + +assert.sameValue(arr[0], 12, 'arr[0]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-179.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-179.js new file mode 100644 index 0000000000..935cec1042 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-179.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-179 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' is boundary value 2^32 - 2 (15.4.5.1 step 4.a) +---*/ + +var arr = []; + +Object.defineProperties(arr, { + "4294967294": { + value: 100 + } +}); + +assert(arr.hasOwnProperty("4294967294"), 'arr.hasOwnProperty("4294967294") !== true'); +assert.sameValue(arr.length, 4294967295, 'arr.length'); +assert.sameValue(arr[4294967294], 100, 'arr[4294967294]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-18.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-18.js new file mode 100644 index 0000000000..fcd1e5d0d7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-18.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-18 +description: > + Object.defineProperties - 'O' is a Date object which implements + its own [[GetOwnProperty]] method to get 'P' (8.12.9 step 1 ) +includes: [propertyHelper.js] +---*/ + + +var obj = new Date(); + +Object.defineProperty(obj, "prop", { + value: 11, + configurable: false +}); + +try { + Object.defineProperties(obj, { + prop: { + value: 12, + configurable: true + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(obj, "prop", 11); + + verifyNotWritable(obj, "prop"); + + verifyNotEnumerable(obj, "prop"); + + verifyNotConfigurable(obj, "prop"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-180.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-180.js new file mode 100644 index 0000000000..ab90e9b38a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-180.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-180 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' is boundary value 2^32 - 1 (15.4.5.1 step 4.a) +---*/ + +var arr = []; + +Object.defineProperties(arr, { + "4294967295": { + value: 100 + } +}); + +assert(arr.hasOwnProperty("4294967295"), 'arr.hasOwnProperty("4294967295") !== true'); +assert.sameValue(arr.length, 0, 'arr.length'); +assert.sameValue(arr[4294967295], 100, 'arr[4294967295]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-181.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-181.js new file mode 100644 index 0000000000..2aecacf063 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-181.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-181 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' is boundary value 2^32 (15.4.5.1 step 4.a) +---*/ + +var arr = []; + +Object.defineProperties(arr, { + "4294967296": { + value: 100 + } +}); + +assert(arr.hasOwnProperty("4294967296"), 'arr.hasOwnProperty("4294967296") !== true'); +assert.sameValue(arr.length, 0, 'arr.length'); +assert.sameValue(arr[4294967296], 100, 'arr[4294967296]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-182.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-182.js new file mode 100644 index 0000000000..899b84191f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-182.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-182 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' is boundary value 2^32 + 1 (15.4.5.1 step 4.a) +---*/ + +var arr = []; + +Object.defineProperties(arr, { + "4294967297": { + value: 100 + } +}); + +assert(arr.hasOwnProperty("4294967297"), 'arr.hasOwnProperty("4294967297") !== true'); +assert.sameValue(arr.length, 0, 'arr.length'); +assert.sameValue(arr[4294967297], 100, 'arr[4294967297]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-183.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-183.js new file mode 100644 index 0000000000..9bb21f289b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-183.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-183 +description: > + Object.defineProperties - TypeError is not thrown if 'O' is an + Array, 'P' is an array index named property, [[Writable]] + attribute of the length property in 'O' is false, value of 'P' is + less than value of the length property in'O' (15.4.5.1 step 4.b) +---*/ + +var arr = [1, 2, 3]; + +Object.defineProperty(arr, "length", { + writable: false +}); + +Object.defineProperties(arr, { + "1": { + value: "abc" + } +}); + +assert.sameValue(arr[0], 1, 'arr[0]'); +assert.sameValue(arr[1], "abc", 'arr[1]'); +assert.sameValue(arr[2], 3, 'arr[2]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-184.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-184.js new file mode 100644 index 0000000000..5ac557f243 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-184.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-184 +description: > + Object.defineProperties - TypeError is thrown if 'O' is an Array, + 'P' is an array index named property,[[Writable]] attribute of the + length property in 'O' is false, value of 'P' is equal to value of + the length property in 'O' (15.4.5.1 step 4.b) +---*/ + +var arr = [1, 2, 3]; + +Object.defineProperty(arr, "length", { + writable: false +}); +assert.throws(TypeError, function() { + Object.defineProperties(arr, { + "3": { + value: "abc" + } + }); +}); +assert.sameValue(arr[0], 1, 'arr[0]'); +assert.sameValue(arr[1], 2, 'arr[1]'); +assert.sameValue(arr[2], 3, 'arr[2]'); +assert.sameValue(arr.hasOwnProperty("3"), false, 'arr.hasOwnProperty("3")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-185.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-185.js new file mode 100644 index 0000000000..1ab2e2d467 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-185.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-185 +description: > + Object.defineProperties - TypeError is thrown if 'O' is an Array, + 'P' is an array index named property,[[Writable]] attribute of the + length property in 'O' is false, value of 'P' is bigger than value + of the length property in 'O' (15.4.5.1 step 4.b) +---*/ + +var arr = [1, 2, 3]; + +Object.defineProperty(arr, "length", { + writable: false +}); +assert.throws(TypeError, function() { + Object.defineProperties(arr, { + "4": { + value: "abc" + } + }); +}); +assert.sameValue(arr[0], 1, 'arr[0]'); +assert.sameValue(arr[1], 2, 'arr[1]'); +assert.sameValue(arr[2], 3, 'arr[2]'); +assert.sameValue(arr.hasOwnProperty("3"), false, 'arr.hasOwnProperty("3")'); +assert.sameValue(arr.hasOwnProperty("4"), false, 'arr.hasOwnProperty("4")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-186.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-186.js new file mode 100644 index 0000000000..1c708db7df --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-186.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-186 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' is own data property (15.4.5.1 step 4.c) +---*/ + +var arr = []; +Object.defineProperty(arr, 0, { + value: "ownDataProperty", + configurable: false +}); +assert.throws(TypeError, function() { + Object.defineProperties(arr, { + "0": { + value: "abc", + configurable: true + } + }); +}); +assert.sameValue(arr[0], "ownDataProperty", 'arr[0]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-187.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-187.js new file mode 100644 index 0000000000..4a36ae53c5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-187.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-187 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' is inherited data property (15.4.5.1 step 4.c) +---*/ + +Object.defineProperty(Array.prototype, "0", { + value: 11, + configurable: true +}); + +var arr = []; + +Object.defineProperties(arr, { + "0": { + configurable: false + } +}); + +assert(arr.hasOwnProperty("0"), 'arr.hasOwnProperty("0") !== true'); +assert.sameValue(typeof arr[0], "undefined", 'typeof arr[0]'); +assert.sameValue(Array.prototype[0], 11, 'Array.prototype[0]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-188.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-188.js new file mode 100644 index 0000000000..91f70d0b74 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-188.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-188 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' is own data property that overrides an + inherited data property (15.4.5.1 step 4.c) +---*/ + +var arr = []; + +assert.throws(TypeError, function() { + Object.defineProperty(Array.prototype, "0", { + value: 11, + configurable: true + }); + + Object.defineProperty(arr, "0", { + value: 12, + configurable: false + }); + + Object.defineProperties(arr, { + "0": { + configurable: true + } + }); +}); +assert.sameValue(arr[0], 12, 'arr[0]'); +assert.sameValue(Array.prototype[0], 11, 'Array.prototype[0]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-189.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-189.js new file mode 100644 index 0000000000..93b1c0cba9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-189.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-189 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' is own data property that overrides an + inherited accessor property (15.4.5.1 step 4.c) +---*/ + +var arr = []; + +assert.throws(TypeError, function() { + Object.defineProperty(Array.prototype, "0", { + get: function() { + return 11; + }, + configurable: true + }); + + Object.defineProperty(arr, "0", { + value: 12, + configurable: false + }); + + Object.defineProperties(arr, { + "0": { + configurable: true + } + }); +}); +assert.sameValue(arr[0], 12, 'arr[0]'); +assert.sameValue(Array.prototype[0], 11, 'Array.prototype[0]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-19.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-19.js new file mode 100644 index 0000000000..9d5111dd19 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-19.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-19 +description: > + Object.defineProperties - 'O' is a RegExp object which implements + its own [[GetOwnProperty]] method to get 'P' (8.12.9 step 1 ) +includes: [propertyHelper.js] +---*/ + + +var obj = new RegExp(); + +Object.defineProperty(obj, "prop", { + value: 11, + configurable: false +}); + +try { + Object.defineProperties(obj, { + prop: { + value: 12, + configurable: true + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(obj, "prop", 11); + + verifyNotWritable(obj, "prop"); + + verifyNotEnumerable(obj, "prop"); + + verifyNotConfigurable(obj, "prop"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-190.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-190.js new file mode 100644 index 0000000000..f633cf6a21 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-190.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-190 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' is own accessor property (15.4.5.1 step 4.c) +---*/ + +var arr = []; + +Object.defineProperty(arr, "0", { + get: function() { + return 11; + }, + configurable: false +}); +assert.throws(TypeError, function() { + Object.defineProperties(arr, { + "0": { + get: function() { + return 12; + }, + configurable: true + } + }); +}); +assert.sameValue(arr[0], 11, 'arr[0]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-191.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-191.js new file mode 100644 index 0000000000..46eef4c953 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-191.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-191 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property, 'P' is inherited accessor property (15.4.5.1 step 4.c) +---*/ + +Object.defineProperty(Array.prototype, "0", { + get: function() { + return 11; + }, + configurable: true +}); + +var arr = []; + +Object.defineProperties(arr, { + "0": { + get: function() { + return 12; + }, + configurable: false + } +}); + +assert(arr.hasOwnProperty("0"), 'arr.hasOwnProperty("0") !== true'); +assert.sameValue(arr[0], 12, 'arr[0]'); +assert.sameValue(Array.prototype[0], 11, 'Array.prototype[0]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-192.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-192.js new file mode 100644 index 0000000000..ef1277d220 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-192.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-192 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' is own accessor property that overrides an + inherited data property (15.4.5.1 step 4.c) +---*/ + +var arr = []; + +assert.throws(TypeError, function() { + Object.defineProperty(Array.prototype, "0", { + value: 11, + configurable: true + }); + + Object.defineProperty(arr, "0", { + get: function() { + return 12; + }, + configurable: false + }); + + Object.defineProperties(arr, { + "0": { + configurable: true + } + }); +}); +assert.sameValue(arr[0], 12, 'arr[0]'); +assert.sameValue(Array.prototype[0], 11, 'Array.prototype[0]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-193.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-193.js new file mode 100644 index 0000000000..e825e022a7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-193.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-193 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' is own accessor property that overrides an + inherited accessor property (15.4.5.1 step 4.c) +---*/ + +var arr = []; + +assert.throws(TypeError, function() { + Object.defineProperty(Array.prototype, "0", { + get: function() { + return 11; + }, + configurable: true + }); + + Object.defineProperty(arr, "0", { + get: function() { + return 12; + }, + configurable: false + }); + + Object.defineProperties(arr, { + "0": { + configurable: true + } + }); +}); +assert.sameValue(arr[0], 12, 'arr[0]'); +assert.sameValue(Array.prototype[0], 11, 'Array.prototype[0]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-194.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-194.js new file mode 100644 index 0000000000..d375160c7b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-194.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-194 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' property doesn't exist in 'O', test TypeError + is thrown when 'O' is not extensible (15.4.5.1 step 4.c) +---*/ + +var arr = []; +Object.preventExtensions(arr); +assert.throws(TypeError, function() { + Object.defineProperties(arr, { + "0": { + value: 1 + } + }); +}); +assert.sameValue(arr.hasOwnProperty("0"), false, 'arr.hasOwnProperty("0")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-195.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-195.js new file mode 100644 index 0000000000..46e202818f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-195.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-195 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' property doesn't exist in 'O', test 'P' is + defined as data property when 'desc' is generic descriptor + (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperties(arr, { + "0": { + enumerable: true + } +}); + +verifyEqualTo(arr, "0", undefined); + +verifyNotWritable(arr, "0"); + +verifyEnumerable(arr, "0"); + +verifyNotConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-196.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-196.js new file mode 100644 index 0000000000..9fc08f1389 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-196.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-196 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' property doesn't exist in 'O', test [[Value]] + of 'P' property in 'Attributes' is set as undefined value if + [[Value]] is absent in data descriptor 'desc' (15.4.5.1 step 4.c) +---*/ + +var arr = []; + +Object.defineProperties(arr, { + "0": { + writable: true, + enumerable: true, + configurable: false + } +}); + +assert(arr.hasOwnProperty("0"), 'arr.hasOwnProperty("0") !== true'); +assert.sameValue(typeof(arr[0]), "undefined", 'typeof (arr[0])'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-197.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-197.js new file mode 100644 index 0000000000..c95e92a883 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-197.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-197 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' property doesn't exist in 'O', test + [[Writable]] of 'P' property in 'Attributes' is set as false value + if [[Writable]] is absent in data descriptor 'desc' (15.4.5.1 + step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; +var isOwnProperty = false; +var canWritable = false; + +Object.defineProperties(arr, { + "0": { + value: 1001, + enumerable: true, + configurable: false + } +}); + +assert(arr.hasOwnProperty("0")); +verifyNotWritable(arr, "0"); +assert.sameValue(arr[0], 1001); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-198.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-198.js new file mode 100644 index 0000000000..46d4871278 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-198.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-198 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' property doesn't exist in 'O', test + [[Enumerable]] of 'P' property in 'Attributes' is set as false + value if [[Enumerable]] is absent in data descriptor 'desc' + (15.4.5.1 step 4.c) +---*/ + +var arr = []; +var isOwnProperty = false; +var canEnumerable = false; + +Object.defineProperties(arr, { + "0": { + value: 1001, + writable: true, + configurable: true + } +}); + +isOwnProperty = arr.hasOwnProperty("0"); +for (var i in arr) { + if (i === "0") { + canEnumerable = true; + } +} + +assert(isOwnProperty, 'isOwnProperty !== true'); +assert.sameValue(canEnumerable, false, 'canEnumerable'); +assert.sameValue(arr[0], 1001, 'arr[0]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-199.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-199.js new file mode 100644 index 0000000000..5d24369753 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-199.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-199 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' property doesn't exist in 'O', test + [[Configurable]] of 'P' property in 'Attributes' is set as false + value if [[Configurable]] is absent in data descriptor 'desc' + (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; +var beforeDeleted = false; +var afterDeleted = false; + +Object.defineProperties(arr, { + "0": { + value: 1001, + writable: true, + enumerable: true + } +}); + +assert(arr.hasOwnProperty("0")); +verifyNotConfigurable(arr, "0"); +assert(arr.hasOwnProperty("0")); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-2.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-2.js new file mode 100644 index 0000000000..19de43a79c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-2.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-2 +description: > + Object.defineProperties - 'P' is inherited data property (8.12.9 + step 1 ) +includes: [propertyHelper.js] +---*/ + +var proto = {}; +Object.defineProperty(proto, "prop", { + value: 11, + configurable: false +}); +var Con = function() {}; +Con.prototype = proto; + +var obj = new Con(); + +Object.defineProperties(obj, { + prop: { + value: 12, + configurable: true + } +}); + +verifyEqualTo(obj, "prop", 12); + +verifyNotWritable(obj, "prop"); + +verifyNotEnumerable(obj, "prop"); + +verifyConfigurable(obj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-20.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-20.js new file mode 100644 index 0000000000..b9a5e51c45 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-20.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-20 +description: > + Object.defineProperties - 'O' is a JSON object which implements + its own [[GetOwnProperty]] method to get 'P' (8.12.9 step 1 ) +---*/ + +Object.defineProperty(JSON, "prop", { + value: 11, + writable: true, + configurable: true +}); +var hasProperty = JSON.hasOwnProperty("prop") && JSON.prop === 11; +Object.defineProperties(JSON, { + prop: { + value: 12 + } +}); + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(JSON.prop, 12, 'JSON.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-200.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-200.js new file mode 100644 index 0000000000..b382c908c7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-200.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-200 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'desc' is data descriptor, test updating all + attribute values of 'P' (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = [1]; // default value of attributes: writable: true, configurable: true, enumerable: true + +Object.defineProperties(arr, { + "0": { + value: 1001, + writable: false, + enumerable: false, + configurable: false + } +}); + +verifyEqualTo(arr, "0", 1001); + +verifyNotWritable(arr, "0"); + +verifyNotEnumerable(arr, "0"); + +verifyNotConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-201.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-201.js new file mode 100644 index 0000000000..7ea8911b62 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-201.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-201 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' property doesn't exist in 'O', test [[Get]] of + 'P' property in 'Attributes' is set as undefined value if [[Get]] + is absent in accessor descriptor 'desc' (15.4.5.1 step 4.c) +---*/ + +var arr = []; + +Object.defineProperties(arr, { + "0": { + set: function() {}, + enumerable: true, + configurable: true + } +}); + +assert(arr.hasOwnProperty("0"), 'arr.hasOwnProperty("0") !== true'); +assert.sameValue(typeof(arr[0]), "undefined", 'typeof (arr[0])'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-202.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-202.js new file mode 100644 index 0000000000..6997fab614 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-202.js @@ -0,0 +1,46 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-202 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' property doesn't exist in 'O', test [[Set]] of + 'P' property in 'Attributes' is set as undefined value if [[Set]] + is absent in accessor descriptor 'desc' (15.4.5.1 step 4.c) +---*/ + +var arr = []; +var getFunc = function() { + return 11; +}; + +Object.defineProperties(arr, { + "0": { + get: getFunc, + enumerable: true, + configurable: true + } +}); + +var verifyEnumerable = false; +for (var i in arr) { + if (i === "0" && arr.hasOwnProperty("0")) { + verifyEnumerable = true; + } +} + +var desc = Object.getOwnPropertyDescriptor(arr, "0"); +var propertyDefineCorrect = arr.hasOwnProperty("0"); + +var verifyConfigurable = false; +delete arr[0]; +verifyConfigurable = arr.hasOwnProperty("0"); + +assert.sameValue(typeof desc.set, "undefined", 'typeof desc.set'); +assert(propertyDefineCorrect, 'propertyDefineCorrect !== true'); +assert.sameValue(desc.get, getFunc, 'desc.get'); +assert.sameValue(verifyConfigurable, false, 'verifyConfigurable'); +assert(verifyEnumerable, 'verifyEnumerable !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-203.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-203.js new file mode 100644 index 0000000000..a237d335dd --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-203.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-203 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' property doesn't exist in 'O', test + [[Enumerable]] of 'P' property in 'Attributes' is set as false + value if [[Enumerable]] is absent in accessor descriptor 'desc' + (15.4.5.1 step 4.c) +---*/ + +var arr = []; + +Object.defineProperties(arr, { + "0": { + set: function() {}, + get: function() {}, + configurable: true + } +}); + +for (var i in arr) { + assert.sameValue(i === "0" && arr.hasOwnProperty("0"), false, 'i === "0" && arr.hasOwnProperty("0")'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-204.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-204.js new file mode 100644 index 0000000000..ef679dcc11 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-204.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-204 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' property doesn't exist in 'O', test + [[Configurable]] of 'P' property in 'Attributes' is set as false + value if [[Configurable]] is absent in accessor descriptor 'desc' + (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; +arr.verifySetter = 100; + +Object.defineProperties(arr, { + "0": { + set: function(value) { + arr.verifySetter = value; + }, + get: function() { + return arr.verifySetter; + }, + enumerable: true + } +}); + +if (!Object.prototype.hasOwnProperty.call(arr, "0")) { + throw new Test262Error("Expected hasOwnProperty to return true."); +} + +arr[0] = 101; + +verifyEqualTo(arr, 0, 101); + +if (arr.verifySetter !== 101) { + throw new Test262Error('Expected arr.verifySetter === 101, actually ' + arr.verifySetter); +} + +verifyNotConfigurable(arr, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-205.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-205.js new file mode 100644 index 0000000000..46d98ea0a0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-205.js @@ -0,0 +1,49 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-205 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'desc' is accessor descriptor, test updating all + attribute values of 'P' (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperties(arr, { + "0": { + get: function() { + return 11; + }, + set: function() {}, + configurable: true, + enumerable: true + } +}); + +var setFun = function(value) { + arr.setVerifyHelpProp = value; +}; +var getFun = function() { + return 14; +}; +Object.defineProperties(arr, { + "0": { + get: getFun, + set: setFun, + configurable: false, + enumerable: false + } +}); + +verifyEqualTo(arr, "0", getFun()); + +verifyWritable(arr, "0", "setVerifyHelpProp"); + +verifyNotEnumerable(arr, "0"); + +verifyNotConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-206.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-206.js new file mode 100644 index 0000000000..a322992ba4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-206.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-206 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' makes no change if every field in 'desc' is + absent (name is data property) (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +arr[0] = 101; // default value of attributes: writable: true, configurable: true, enumerable: true + + +Object.defineProperties(arr, { + "0": {} +}); +verifyEqualTo(arr, "0", 101); + +verifyWritable(arr, "0"); + +verifyEnumerable(arr, "0"); + +verifyConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-207.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-207.js new file mode 100644 index 0000000000..46d88c42e1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-207.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-207 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' makes no change if every field in 'desc' is + absent (name is accessor property) (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +function get_func() { + return 11; +} + +function set_func(value) { + arr.setVerifyHelpProp = value; +} + +Object.defineProperty(arr, "0", { + get: get_func, + set: set_func, + enumerable: true, + configurable: true +}); + +Object.defineProperties(arr, { + "0": {} +}); +verifyEqualTo(arr, "0", get_func()); + +verifyWritable(arr, "0", "setVerifyHelpProp"); + +verifyEnumerable(arr, "0"); + +verifyConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-208.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-208.js new file mode 100644 index 0000000000..7d7f6ae685 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-208.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-208 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' makes no change if the value of every field in + 'desc' is the same value as the corresponding field in 'P'(desc is + data property) (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +arr[0] = 100; // default value of attributes: writable: true, configurable: true, enumerable: true + +Object.defineProperties(arr, { + "0": { + value: 100, + writable: true, + enumerable: true, + configurable: true + } +}); + +verifyEqualTo(arr, "0", 100); + +verifyWritable(arr, "0"); + +verifyEnumerable(arr, "0"); + +verifyConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-209.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-209.js new file mode 100644 index 0000000000..48d71fdc94 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-209.js @@ -0,0 +1,45 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-209 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, 'P' makes no change if the value of every field in + 'desc' is the same value as the corresponding field in 'P'(desc is + accessor property) (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; +var get_func = function() { + return "100"; +}; +var set_func = function(value) { + arr.setVerifyHelpProp = value; +}; + +var descObj = { + get: get_func, + set: set_func, + enumerable: true, + configurable: true +}; + +var properties = { + "0": descObj +}; + +Object.defineProperty(arr, "0", descObj); + +Object.defineProperties(arr, properties); + +verifyEqualTo(arr, "0", get_func()); + +verifyWritable(arr, "0", "setVerifyHelpProp"); + +verifyEnumerable(arr, "0"); + +verifyConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-21.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-21.js new file mode 100644 index 0000000000..174de35bac --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-21.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-21 +description: > + Object.defineProperties - 'O' is an Error object which implements + its own [[GetOwnProperty]] method to get 'P' (8.12.9 step 1 ) +includes: [propertyHelper.js] +---*/ + + +var obj = new Error(); + +Object.defineProperty(obj, "prop", { + value: 11, + configurable: false +}); + +try { + Object.defineProperties(obj, { + prop: { + value: 12, + configurable: true + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(obj, "prop", 11); + + verifyNotWritable(obj, "prop"); + + verifyNotEnumerable(obj, "prop"); + + verifyNotConfigurable(obj, "prop"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-210.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-210.js new file mode 100644 index 0000000000..5d74f4dfd0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-210.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-210 +description: > + Object.defineProperties - 'O' is an Array, 'name' is an array + index property, both the [[Value]] field of 'desc' and the + [[Value]] attribute value of 'name' are undefined (15.4.5.1 step + 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperty(arr, "0", { + value: undefined +}); + +Object.defineProperties(arr, { + "0": { + value: undefined + } +}); +verifyEqualTo(arr, "0", undefined); + +verifyNotWritable(arr, "0"); + +verifyNotEnumerable(arr, "0"); + +verifyNotConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-211.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-211.js new file mode 100644 index 0000000000..163eb6c69f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-211.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-211 +description: > + Object.defineProperties - 'O' is an Array, 'name' is an array + index property, both the [[Value]] field of 'desc' and the + [[Value]] attribute value of 'name' are null (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperty(arr, "0", { + value: null +}); + +Object.defineProperties(arr, { + "0": { + value: null + } +}); +verifyEqualTo(arr, "0", null); + +verifyNotWritable(arr, "0"); + +verifyNotEnumerable(arr, "0"); + +verifyNotConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-212.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-212.js new file mode 100644 index 0000000000..d6aa9bdf5b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-212.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-212 +description: > + Object.defineProperties - 'O' is an Array, 'name' is an array + index property, both the [[Value]] field of 'desc' and the + [[Value]] attribute value of 'name' are NaN (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperty(arr, "0", { + value: NaN +}); + +Object.defineProperties(arr, { + "0": { + value: NaN + } +}); + +verifyEqualTo(arr, "0", NaN); + +verifyNotWritable(arr, "0"); + +verifyNotEnumerable(arr, "0"); + +verifyNotConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-213.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-213.js new file mode 100644 index 0000000000..b9bff48f9d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-213.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-213 +description: > + Object.defineProperties - 'O' is an Array, 'name' is an array + index property, the [[Value]] field of 'desc' is +0, and the + [[Value]] attribute value of 'name' is -0 (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperty(arr, "0", { + value: -0 +}); + +try { + Object.defineProperties(arr, { + "0": { + value: +0 + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arr, "0", -0); + + verifyNotWritable(arr, "0"); + + verifyNotEnumerable(arr, "0"); + + verifyNotConfigurable(arr, "0"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-214.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-214.js new file mode 100644 index 0000000000..356f64d1bd --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-214.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-214 +description: > + Object.defineProperties - 'O' is an Array, 'name' is an array + index property, the [[Value]] field of 'desc' is -0, and the + [[Value]] attribute value of 'name' is +0 (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperty(arr, "0", { + value: +0 +}); + +try { + Object.defineProperties(arr, { + "0": { + value: -0 + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arr, "0", +0); + + verifyNotWritable(arr, "0"); + + verifyNotEnumerable(arr, "0"); + + verifyNotConfigurable(arr, "0"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-215.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-215.js new file mode 100644 index 0000000000..ea5c1a2d3f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-215.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-215 +description: > + Object.defineProperties - 'O' is an Array, 'name' is an array + index property, the [[Value]] field of 'desc' and the [[Value]] + attribute value of 'name' are two numbers with same vaule + (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperty(arr, "0", { + value: 101 +}); + +Object.defineProperties(arr, { + "0": { + value: 101 + } +}); +verifyEqualTo(arr, "0", 101); + +verifyNotWritable(arr, "0"); + +verifyNotEnumerable(arr, "0"); + +verifyNotConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-216.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-216.js new file mode 100644 index 0000000000..b658b05038 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-216.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-216 +description: > + Object.defineProperties - 'O' is an Array, 'name' is an array + index property, the [[Value]] field of 'desc' and the [[Value]] + attribute value of 'name' are two strings which have same length + and same characters in corresponding positions (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperty(arr, "0", { + value: "abcd" +}); + +Object.defineProperties(arr, { + "0": { + value: "abcd" + } +}); +verifyEqualTo(arr, "0", "abcd"); + +verifyNotWritable(arr, "0"); + +verifyNotEnumerable(arr, "0"); + +verifyNotConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-217.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-217.js new file mode 100644 index 0000000000..94e975a2cb --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-217.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-217 +description: > + Object.defineProperties - 'O' is an Array, 'name' is an array + index property, the [[Value]] field of 'desc' and the [[Value]] + attribute value of 'name' are two booleans with same value + (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperty(arr, "0", { + value: true +}); + +Object.defineProperties(arr, { + "0": { + value: true + } +}); +verifyEqualTo(arr, "0", true); + +verifyNotWritable(arr, "0"); + +verifyNotEnumerable(arr, "0"); + +verifyNotConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-218.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-218.js new file mode 100644 index 0000000000..9fefdec9a6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-218.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-218 +description: > + Object.defineProperties - 'O' is an Array, 'name' is an array + index property, the [[Value]] field of 'desc' and the [[Value]] + attribute value of 'name' are two objects which refer to the same + object (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +var obj1 = { + length: 10 +}; +Object.defineProperty(arr, "0", { + value: obj1 +}); + +var properties = { + "0": { + value: obj1 + } +}; + +Object.defineProperties(arr, properties); +verifyEqualTo(arr, "0", obj1); + +verifyNotWritable(arr, "0"); + +verifyNotEnumerable(arr, "0"); + +verifyNotConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-219.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-219.js new file mode 100644 index 0000000000..50afb5f2b0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-219.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-219 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property that already exists on 'O' with [[Writable]] true, and + the [[Writable]] field of 'desc' is true (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperty(arr, "0", { + writable: true +}); + +Object.defineProperties(arr, { + "0": { + writable: true + } +}); +verifyEqualTo(arr, "0", undefined); + +verifyWritable(arr, "0"); + +verifyNotEnumerable(arr, "0"); + +verifyNotConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-22.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-22.js new file mode 100644 index 0000000000..f7d7ee32ac --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-22.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-22 +description: > + Object.defineProperties - 'O' is the Arguments object which + implements its own [[GetOwnProperty]] method to get 'P' (8.12.9 + step 1 ) +---*/ + +var arg = function() { + return arguments; +}(); + +Object.defineProperty(arg, "prop", { + value: 11, + configurable: false +}); +assert.throws(TypeError, function() { + Object.defineProperties(arg, { + prop: { + value: 12, + configurable: true + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-220.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-220.js new file mode 100644 index 0000000000..e655774ae2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-220.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-220 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property that already exists on 'O' with [[Writable]] true, and + the [[Writable]] field of 'desc' is false (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperty(arr, "0", { + writable: true, + configurable: true +}); + +Object.defineProperties(arr, { + "0": { + writable: false + } +}); +verifyEqualTo(arr, "0", undefined); + +verifyNotWritable(arr, "0"); + +verifyNotEnumerable(arr, "0"); + +verifyConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-221.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-221.js new file mode 100644 index 0000000000..f3d107084e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-221.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-221 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property, the [[Get]] field of 'desc' and the [[Get]] attribute + value of 'P' are two objects which refer to the same object + (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +function get_func() { + return 10; +} + +Object.defineProperty(arr, "0", { + get: get_func +}); + +Object.defineProperties(arr, { + "0": { + get: get_func + } +}); +verifyEqualTo(arr, "0", get_func()); + +verifyNotEnumerable(arr, "0"); + +verifyNotConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-222.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-222.js new file mode 100644 index 0000000000..b9f60bdb8f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-222.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-222 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property, the [[Set]] field of 'desc' and the [[Set]] attribute + value of 'P' are two objects which refer to the same object + (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +function set_func(value) { + arr.setVerifyHelpProp = value; +} + +Object.defineProperty(arr, "0", { + set: set_func +}); + +Object.defineProperties(arr, { + "0": { + set: set_func + } +}); +verifyWritable(arr, "0", "setVerifyHelpProp"); + +verifyNotEnumerable(arr, "0"); + +verifyNotConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-223.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-223.js new file mode 100644 index 0000000000..25c4ab4089 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-223.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-223 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property that already exists on 'O' with [[Enumerable]] true, the + [[Enumerable]] field of 'desc' is true (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperty(arr, "0", { + enumerable: true +}); + +Object.defineProperties(arr, { + "0": { + enumerable: true + } +}); +verifyEqualTo(arr, "0", undefined); + +verifyNotWritable(arr, "0"); + +verifyEnumerable(arr, "0"); + +verifyNotConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-224.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-224.js new file mode 100644 index 0000000000..127f8f89dd --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-224.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-224 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property that already exists on 'O' with [[Enumerable]] true, the + [[Enumerable]] field of 'desc' is false (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperty(arr, "0", { + enumerable: true, + configurable: true +}); + +Object.defineProperties(arr, { + "0": { + enumerable: false + } +}); +verifyEqualTo(arr, "0", undefined); + +verifyNotWritable(arr, "0"); + +verifyNotEnumerable(arr, "0"); + +verifyConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-225.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-225.js new file mode 100644 index 0000000000..9db9a3514d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-225.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-225 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property that already exists on 'O' with [[Configurable]] true, + the [[Configurable]] field of 'desc' is true (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperty(arr, "0", { + configurable: true +}); + +Object.defineProperties(arr, { + "0": { + configurable: true + } +}); +verifyEqualTo(arr, "0", undefined); + +verifyNotWritable(arr, "0"); + +verifyNotEnumerable(arr, "0"); + +verifyConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-226.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-226.js new file mode 100644 index 0000000000..0b839c70e3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-226.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-226 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property that already exists on 'O' with [[Configurable]] true, + the [[Configurable]] field of 'desc' is false (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperty(arr, "0", { + configurable: true +}); + +Object.defineProperties(arr, { + "0": { + configurable: false + } +}); +verifyEqualTo(arr, "0", undefined); + +verifyNotWritable(arr, "0"); + +verifyNotEnumerable(arr, "0"); + +verifyNotConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-227.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-227.js new file mode 100644 index 0000000000..7e0a0eb3b8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-227.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-227 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property, TypeError is thrown if the [[Configurable]] attribute + value of 'P' is false and the [[Configurable]] field of 'desc' is + true (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + + +var arr = []; + +Object.defineProperty(arr, "1", { + value: 3, + configurable: false +}); + +try { + Object.defineProperties(arr, { + "1": { + value: 13, + configurable: true + } + }); +} catch (e) { + verifyEqualTo(arr, "1", 3); + + verifyNotWritable(arr, "1"); + + verifyNotEnumerable(arr, "1"); + + verifyNotConfigurable(arr, "1"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-228.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-228.js new file mode 100644 index 0000000000..ae93f23bb1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-228.js @@ -0,0 +1,48 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-228 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property, TypeError is thrown if the [[Configurable]] attribute + value of 'P' is false, and [[Enumerable]] of 'desc' is present and + its value is different from the [[Enumerable]] attribute value of + 'P' (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + + +var arr = []; + +Object.defineProperty(arr, "1", { + value: 3, + configurable: false, + enumerable: false + +}); + +try { + Object.defineProperties(arr, { + "1": { + value: 13, + enumerable: true + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arr, "1", 3); + + verifyNotWritable(arr, "1"); + + verifyNotEnumerable(arr, "1"); + + verifyNotConfigurable(arr, "1"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-229.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-229.js new file mode 100644 index 0000000000..52eeb0b5ef --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-229.js @@ -0,0 +1,48 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-229 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property, TypeError is thrown if 'P' is accessor property, and + 'desc' is data descriptor, and the [[Configurable]] attribute + value of 'P' is false (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + + +var arr = []; + +function set_fun(value) { + arr.setVerifyHelpProp = value; +} + +Object.defineProperty(arr, "1", { + set: set_fun, + configurable: false + +}); + +try { + Object.defineProperties(arr, { + "1": { + value: 13 + } + }); + throw new Test262Error("Expected an exception."); + +} catch (e) { + verifyWritable(arr, "1", "setVerifyHelpProp"); + + verifyNotEnumerable(arr, "1"); + + verifyNotConfigurable(arr, "1"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-230.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-230.js new file mode 100644 index 0000000000..70c1ebbcab --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-230.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-230 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property, TypeError is thrown if 'P' is data property, and'desc' + is accessor descriptor, and the [[Configurable]] attribute value + of 'P' is false (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + + +var arr = []; + +Object.defineProperty(arr, "1", { + value: 3, + configurable: false +}); + +try { + Object.defineProperties(arr, { + "1": { + set: function() {} + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arr, "1", 3); + + verifyNotWritable(arr, "1"); + + verifyNotEnumerable(arr, "1"); + + verifyNotConfigurable(arr, "1"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-231.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-231.js new file mode 100644 index 0000000000..77e43c731c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-231.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-231 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property, 'P' is data property and 'desc' is accessor descriptor, + and the [[Configurable]] attribute value of 'P' is true, test 'P' + is converted from data property to accessor property (15.4.5.1 + step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; +arr[1] = 3; // default value of attributes: writable: true, configurable: true, enumerable: true + +function set_fun(value) { + arr.setVerifyHelpProp = value; +} + +Object.defineProperties(arr, { + "1": { + set: set_fun + } +}); + +verifyWritable(arr, "1", "setVerifyHelpProp"); + +verifyEnumerable(arr, "1"); + +verifyConfigurable(arr, "1"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-232.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-232.js new file mode 100644 index 0000000000..a8f2187f8c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-232.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-232 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property, 'P' is accessor property and 'desc' is data descriptor, + and the [[Configurable]] attribute value of 'P' is true, test 'P' + is converted from accessor property to data property (15.4.5.1 + step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperty(arr, "1", { + get: function() { + return 3; + }, + configurable: true + +}); + +Object.defineProperties(arr, { + "1": { + value: 12 + } +}); + +verifyEqualTo(arr, "1", 12); + +verifyNotWritable(arr, "1"); + +verifyNotEnumerable(arr, "1"); + +verifyConfigurable(arr, "1"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-233.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-233.js new file mode 100644 index 0000000000..cc3247a9c7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-233.js @@ -0,0 +1,47 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-233 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property, 'P' is data property and 'desc' is data descriptor, and + the [[Configurable]] attribute value of 'P' is false, test + TypeError is thrown if the [[Writable]] attribute value of 'P' is + false and the [[Writable]] field of 'desc' is true. (15.4.5.1 + step 4.c) +includes: [propertyHelper.js] +---*/ + + +var arr = []; + +Object.defineProperty(arr, "1", { + configurable: false, + writable: false + +}); + +try { + Object.defineProperties(arr, { + "1": { + writable: true + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arr, "1", undefined); + + verifyNotWritable(arr, "1"); + + verifyNotEnumerable(arr, "1"); + + verifyNotConfigurable(arr, "1"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-234.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-234.js new file mode 100644 index 0000000000..668e02eb0f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-234.js @@ -0,0 +1,49 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-234 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + property, 'P' is data property and 'desc' is data descriptor, and + the [[Configurable]] attribute value of 'P' is false, test + TypeError is thrown if the [[Writable]] attribute value of 'P' is + false, and the type of the [[Value]] field of 'desc' is different + from the type of the [[Value]] attribute value of 'P' (15.4.5.1 + step 4.c) +includes: [propertyHelper.js] +---*/ + + +var arr = []; + +Object.defineProperty(arr, "1", { + value: 3, + configurable: false, + writable: false +}); + +try { + + Object.defineProperties(arr, { + "1": { + value: "abc" + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arr, "1", 3); + + verifyNotWritable(arr, "1"); + + verifyNotEnumerable(arr, "1"); + + verifyNotConfigurable(arr, "1"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-235.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-235.js new file mode 100644 index 0000000000..a4becc4796 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-235.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-235 +description: > + Object.defineProperties - TypeError is thrown if 'O' is an Array, + 'P' is an array index named property that already exists on 'O' is + data property with [[Configurable]], [[Writable]] false, 'desc' + is data descriptor, [[Value]] field of 'desc' is +0, and the + [[Value]] attribute value of 'P' is -0 (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperty(arr, "1", { + value: +0 +}); + +try { + Object.defineProperties(arr, { + "1": { + value: -0 + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arr, "1", +0); + + verifyNotWritable(arr, "1"); + + verifyNotEnumerable(arr, "1"); + + verifyNotConfigurable(arr, "1"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-236.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-236.js new file mode 100644 index 0000000000..7a76261002 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-236.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-236 +description: > + Object.defineProperties - TypeError is thrown if 'O' is an Array, + 'P' is an array index named property that already exists on 'O' is + data property with [[Configurable]], [[Writable]] false, 'desc' + is data descriptor, [[Value]] field of 'desc' is -0, and the + [[Value]] attribute value of 'P' is +0 (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperty(arr, "1", { + value: -0 +}); + +try { + Object.defineProperties(arr, { + "1": { + value: +0 + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arr, "1", -0); + + verifyNotWritable(arr, "1"); + + verifyNotEnumerable(arr, "1"); + + verifyNotConfigurable(arr, "1"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-237.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-237.js new file mode 100644 index 0000000000..9914b27c44 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-237.js @@ -0,0 +1,45 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-237 +description: > + Object.defineProperties - TypeError is thrown if 'O' is an Array, + 'P' is an array index named property that already exists on 'O' is + data property with [[Configurable]], [[Writable]] false, 'desc' + is data descriptor, [[Value]] field of 'desc' and the [[Value]] + attribute value of 'P' are two numbers with different vaule + (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + + +var arr = []; + +Object.defineProperty(arr, "1", { + value: 12 +}); + +try { + Object.defineProperties(arr, { + "1": { + value: 36 + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arr, "1", 12); + + verifyNotWritable(arr, "1"); + + verifyNotEnumerable(arr, "1"); + + verifyNotConfigurable(arr, "1"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-238.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-238.js new file mode 100644 index 0000000000..5928b5b299 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-238.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-238 +description: > + Object.defineProperties - TypeError is thrown if 'O' is an Array, + 'P' is an array index named property that already exists on 'O' is + data property with [[Configurable]], [[Writable]] false, 'desc' + is data descriptor, [[Value]] field of 'desc' and the [[Value]] + attribute value of 'P' are two strings with different values + (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperty(arr, "1", { + value: "abcd" +}); + +try { + Object.defineProperties(arr, { + "1": { + value: "efgh" + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arr, "1", "abcd"); + + verifyNotWritable(arr, "1"); + + verifyNotEnumerable(arr, "1"); + + verifyNotConfigurable(arr, "1"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-239.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-239.js new file mode 100644 index 0000000000..e27cf66f6e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-239.js @@ -0,0 +1,45 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-239 +description: > + Object.defineProperties - TypeError is thrown if 'O' is an Array, + 'P' is an array index named property that already exists on 'O' is + data property with [[Configurable]], [[Writable]] false, 'desc' + is data descriptor, [[Value]] field of 'desc' and the [[Value]] + attribute value of 'P' are two booleans with different values + (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperty(arr, "1", { + value: true +}); + +try { + Object.defineProperties(arr, { + "1": { + value: false + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arr, "1", true); + + verifyNotWritable(arr, "1"); + + verifyNotEnumerable(arr, "1"); + + verifyNotConfigurable(arr, "1"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-24.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-24.js new file mode 100644 index 0000000000..f57eb5d1db --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-24.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-24 +description: > + Object.defineProperties - 'O' is the global object which + implements its own [[GetOwnProperty]] method to get 'P' (8.12.9 + step 1 ) +includes: [propertyHelper.js] +---*/ + + +Object.defineProperty(this, "prop", { + value: 11, + writable: true, + enumerable: true, + configurable: true +}); + +Object.defineProperties(this, { + prop: { + value: 12 + } +}); + +verifyEqualTo(this, "prop", 12); + +verifyWritable(this, "prop"); + +verifyEnumerable(this, "prop"); + +verifyConfigurable(this, "prop"); + +delete this.prop; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-240.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-240.js new file mode 100644 index 0000000000..3e22e8bf14 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-240.js @@ -0,0 +1,51 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-240 +description: > + Object.defineProperties - TypeError is thrown if 'O' is an Array, + 'P' is an array index named property that already exists on 'O' is + data property with [[Configurable]], [[Writable]] false, 'desc' + is data descriptor, [[Value]] field of 'desc' and the [[Value]] + attribute value of 'P' are two objects which refer to the + different objects (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; +var obj1 = { + value: 12 +}; +var obj2 = { + value: 36 +}; + +Object.defineProperty(arr, "1", { + value: obj1 +}); + +try { + Object.defineProperties(arr, { + "1": { + value: obj2 + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arr, "1", obj1); + + verifyNotWritable(arr, "1"); + + verifyNotEnumerable(arr, "1"); + + verifyNotConfigurable(arr, "1"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-241.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-241.js new file mode 100644 index 0000000000..6167a6ee64 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-241.js @@ -0,0 +1,47 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-241 +description: > + Object.defineProperties - TypeError is thrown if 'O' is an Array, + 'P' is an array index named property that already exists on 'O' is + accessor property with [[Configurable]] false, 'desc' is accessor + descriptor, the [[Set]] field of 'desc' is present, and the + [[Set]] field of 'desc' and the [[Set]] attribute value of 'P' are + two objects which refer to the different objects (15.4.5.1 step + 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +function set_fun(value) { + arr.setVerifyHelpProp = value; +} +Object.defineProperty(arr, "1", { + set: set_fun +}); + +try { + Object.defineProperties(arr, { + "1": { + set: function() {} + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyWritable(arr, "1", "setVerifyHelpProp"); + + verifyNotEnumerable(arr, "1"); + + verifyNotConfigurable(arr, "1"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-242.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-242.js new file mode 100644 index 0000000000..a794b04f0d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-242.js @@ -0,0 +1,46 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-242 +description: > + Object.defineProperties - TypeError is thrown if 'O' is an Array, + 'P' is an array index named property that already exists on 'O' is + accessor property with [[Configurable]] false, 'desc' is accessor + descriptor, the [[Set]] field of 'desc' is present, and the + [[Set]] field of 'desc' is an object and the [[Set]] attribute + value of 'P' is undefined (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +function set_fun(value) { + arr.setVerifyHelpProp = value; +} +Object.defineProperty(arr, "1", { + set: set_fun +}); + +try { + Object.defineProperties(arr, { + "1": { + set: undefined + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyWritable(arr, "1", "setVerifyHelpProp"); + + verifyNotEnumerable(arr, "1"); + + verifyNotConfigurable(arr, "1"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-243.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-243.js new file mode 100644 index 0000000000..4f8ba301c4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-243.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-243 +description: > + Object.defineProperties - TypeError is not thrown if 'O' is an + Array, 'P' is an array index named property that already exists on + 'O' is accessor property with [[Configurable]] false, 'desc' is + accessor descriptor, the [[Set]] field of 'desc' is present, and + the [[Set]] field of 'desc' and the [[Set]] attribute value of 'P' + are undefined (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperty(arr, "1", { + set: undefined +}); + +Object.defineProperties(arr, { + "1": { + set: undefined + } +}); + +verifyNotEnumerable(arr, "1"); + +verifyNotConfigurable(arr, "1"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-244.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-244.js new file mode 100644 index 0000000000..12d578b86f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-244.js @@ -0,0 +1,49 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-244 +description: > + Object.defineProperties - TypeError is thrown if 'O' is an Array, + 'P' is an array index named property that already exists on 'O' is + accessor property with [[Configurable]] false, 'desc' is accessor + descriptor, the [[Get]] field of 'desc' is present, and the + [[Get]] field of 'desc' and the [[Get]] attribute value of 'P' are + two objects which refer to the different objects (15.4.5.1 step + 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +function get_fun() { + return 36; +} +Object.defineProperty(arr, "1", { + get: get_fun +}); + +try { + Object.defineProperties(arr, { + "1": { + get: function() { + return 12; + } + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arr, "1", get_fun()); + + verifyNotEnumerable(arr, "1"); + + verifyNotConfigurable(arr, "1"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-245.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-245.js new file mode 100644 index 0000000000..046fc367f8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-245.js @@ -0,0 +1,45 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-245 +description: > + Object.defineProperties - TypeError is thrown if 'O' is an Array, + 'P' is an array index named property that already exists on 'O' is + accessor property with [[Configurable]] false, 'desc' is accessor + descriptor, the [[Get]] field of 'desc' is present, and the + [[Get]] field of 'desc' is an object and the [[Get]] attribute + value of 'P' is undefined (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +function get_fun() { + return 36; +} +Object.defineProperty(arr, "1", { + get: get_fun +}); + +try { + Object.defineProperties(arr, { + "1": { + get: undefined + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arr, "1", get_fun()); + + verifyNotEnumerable(arr, "1"); + + verifyNotConfigurable(arr, "1"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-246.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-246.js new file mode 100644 index 0000000000..f7bd329a1e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-246.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-246 +description: > + Object.defineProperties - TypeError is not thrown if ''O' is an + Array, 'P' is an array index named property that already exists on + 'O' is accessor property with [[Configurable]] false, 'desc' is + accessor descriptor, test TypeError is not thrown if the [[Get]] + field of 'desc' is present, and the [[Get]] field of 'desc' and + the [[Get]] attribute value of 'P' are undefined (15.4.5.1 step + 4.c) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +Object.defineProperty(arr, "1", { + get: undefined +}); + +Object.defineProperties(arr, { + "1": { + get: undefined + } +}); + +verifyNotEnumerable(arr, "1"); + +verifyNotConfigurable(arr, "1"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-247.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-247.js new file mode 100644 index 0000000000..f597aaf1af --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-247.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-247 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is data property and + 'desc' is data descriptor, test updating the [[Value]] attribute + value of 'P' (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + + +var arr = [12]; + +Object.defineProperties(arr, { + "0": { + value: 36 + } +}); +verifyEqualTo(arr, "0", 36); + +verifyWritable(arr, "0"); + +verifyEnumerable(arr, "0"); + +verifyConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-248.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-248.js new file mode 100644 index 0000000000..547713544d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-248.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-248 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is data property and + 'desc' is data descriptor, test setting the [[Value]] attribute + value of 'P' as undefined (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + + +var arr = [12]; + +Object.defineProperties(arr, { + "0": { + value: undefined + } +}); +verifyEqualTo(arr, "0", undefined); + +verifyWritable(arr, "0"); + +verifyEnumerable(arr, "0"); + +verifyConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-249.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-249.js new file mode 100644 index 0000000000..36907737c5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-249.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-249 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is data property and + 'desc' is data descriptor, test setting the [[Value]] attribute + value of 'P' from undefined to normal value (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + + +var arr = [undefined]; + +Object.defineProperties(arr, { + "0": { + value: 12 + } +}); +verifyEqualTo(arr, "0", 12); + +verifyWritable(arr, "0"); + +verifyEnumerable(arr, "0"); + +verifyConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-25.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-25.js new file mode 100644 index 0000000000..b64b7ed7e6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-25.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-25 +description: > + Object.defineProperties - 'P' doesn't exist in 'O', test TypeError + is thrown when 'O' is not extensible (8.12.9 step 3) +---*/ + +var obj = {}; +Object.preventExtensions(obj); +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + prop: { + value: 12, + configurable: true + } + }); +}); +assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-250.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-250.js new file mode 100644 index 0000000000..f247cfd64b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-250.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-250 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is data property and + 'desc' is data descriptor, test updating the [[Writable]] + attribute value of 'P' (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + + +var arr = [100]; + +Object.defineProperties(arr, { + "0": { + writable: false + } +}); +verifyEqualTo(arr, "0", 100); + +verifyNotWritable(arr, "0"); + +verifyEnumerable(arr, "0"); + +verifyConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-251.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-251.js new file mode 100644 index 0000000000..d8e2e29bf4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-251.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-251 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is data property and + 'desc' is data descriptor, test updating the [[Enumerable]] + attribute value of 'P' (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + + +var arr = [12]; + +Object.defineProperties(arr, { + "0": { + enumerable: false + } +}); +verifyEqualTo(arr, "0", 12); + +verifyWritable(arr, "0"); + +verifyNotEnumerable(arr, "0"); + +verifyConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-252.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-252.js new file mode 100644 index 0000000000..c74dba3fb4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-252.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-252 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is data property and + 'desc' is data descriptor, test updating the [[Configurable]] + attribute value of 'P' (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + + +var arr = [12]; + +Object.defineProperties(arr, { + "0": { + configurable: false + } +}); +verifyEqualTo(arr, "0", 12); + +verifyWritable(arr, "0"); + +verifyEnumerable(arr, "0"); + +verifyNotConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-253.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-253.js new file mode 100644 index 0000000000..bec2effb09 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-253.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-253 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is data property and + 'desc' is data descriptor, test updating multiple attribute values + of 'P' (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + + +var arr = [12]; + +Object.defineProperties(arr, { + "0": { + value: 36, + writable: false, + configurable: false + } +}); +verifyEqualTo(arr, "0", 36); + +verifyNotWritable(arr, "0"); + +verifyEnumerable(arr, "0"); + +verifyNotConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-254.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-254.js new file mode 100644 index 0000000000..5ff7603393 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-254.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-254 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is accessor property and + 'desc' is accessor descriptor, test updating the [[Get]] attribute + value of 'P' with different getter function (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + + +var arr = []; + +function get_fun() { + return 36; +} + +Object.defineProperty(arr, "0", { + get: function() { + return 12; + }, + configurable: true +}); + +Object.defineProperties(arr, { + "0": { + get: get_fun + } +}); +verifyEqualTo(arr, "0", get_fun()); + +verifyNotEnumerable(arr, "0"); + +verifyConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-255.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-255.js new file mode 100644 index 0000000000..ca5c0bb33f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-255.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-255 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is accessor property and + 'desc' is accessor descriptor, test setting the [[Get]] attribute + value of 'P' as undefined (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + + +var arr = []; + +Object.defineProperty(arr, "0", { + get: function() { + return 12; + }, + configurable: true +}); + +Object.defineProperties(arr, { + "0": { + get: undefined + } +}); +verifyNotEnumerable(arr, "0"); + +verifyConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-256.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-256.js new file mode 100644 index 0000000000..5f2eec519b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-256.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-256 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is accessor property and + 'desc' is accessor descriptor, test updating the [[Get]] attribute + value of 'P' from undefined to function (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + + +var arr = []; + +function get_fun() { + return 36; +} + +Object.defineProperty(arr, "0", { + get: undefined, + configurable: true +}); + +Object.defineProperties(arr, { + "0": { + get: get_fun + } +}); +verifyEqualTo(arr, "0", get_fun()); + +verifyNotEnumerable(arr, "0"); + +verifyConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-257.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-257.js new file mode 100644 index 0000000000..24ebf36025 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-257.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-257 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is accessor property and + 'desc' is accessor descriptor, test updating the [[Set]] attribute + value of 'P' with different getter function (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + + +var arr = []; + +function set_fun(value) { + arr.setVerifyHelpProp = value; +} + +Object.defineProperty(arr, "0", { + set: function() {}, + configurable: true +}); + +Object.defineProperties(arr, { + "0": { + set: set_fun + } +}); +verifyWritable(arr, "0", "setVerifyHelpProp"); + +verifyNotEnumerable(arr, "0"); + +verifyConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-258.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-258.js new file mode 100644 index 0000000000..0cb48c5eb7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-258.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-258 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is accessor property and + 'desc' is accessor descriptor, test setting the [[Set]] attribute + value of 'P' as undefined (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + + +var arr = []; + +Object.defineProperty(arr, "0", { + set: function() {}, + configurable: true +}); + +Object.defineProperties(arr, { + "0": { + set: undefined + } +}); +verifyNotEnumerable(arr, "0"); + +verifyConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-259.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-259.js new file mode 100644 index 0000000000..0e846489aa --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-259.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-259 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is accessor property and + 'desc' is accessor descriptor, test updating the [[Set]] attribute + value of 'P' from undefined to function (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + + +var arr = []; + +function set_fun(value) { + arr.setVerifyHelpProp = value; +} +Object.defineProperty(arr, "0", { + set: undefined, + configurable: true +}); + +Object.defineProperties(arr, { + "0": { + set: set_fun + } +}); +verifyWritable(arr, "0", "setVerifyHelpProp"); + +verifyNotEnumerable(arr, "0"); + +verifyConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-26.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-26.js new file mode 100644 index 0000000000..230a2ceb7a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-26.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-26 +description: > + Object.defineProperties - 'P' doesn't exist in 'O', test 'P' is + defined as data property when 'desc' is generic descriptor (8.12.9 + step 4.a) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + prop: { + configurable: true, + enumerable: true + } +}); +var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + +assert(desc.hasOwnProperty("value"), 'desc.hasOwnProperty("value") !== true'); +assert.sameValue(typeof desc.value, "undefined", 'typeof desc.value'); +assert(desc.hasOwnProperty("writable"), 'desc.hasOwnProperty("writable") !== true'); +assert.sameValue(desc.writable, false, 'desc.writable'); +assert(desc.hasOwnProperty("configurable"), 'desc.hasOwnProperty("configurable") !== true'); +assert.sameValue(desc.configurable, true, 'desc.configurable'); +assert(desc.hasOwnProperty("enumerable"), 'desc.hasOwnProperty("enumerable") !== true'); +assert.sameValue(desc.enumerable, true, 'desc.enumerable'); +assert.sameValue(desc.hasOwnProperty("get"), false, 'desc.hasOwnProperty("get")'); +assert.sameValue(desc.hasOwnProperty("set"), false, 'desc.hasOwnProperty("set")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-260.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-260.js new file mode 100644 index 0000000000..62e09ab0f2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-260.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-260 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is accessor property and + 'desc' is accessor descriptor, test updating the [[Enumerable]] + attribute value of 'P' (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + + +var arr = []; + +function set_fun(value) { + arr.setVerifyHelpProp = value; +} +Object.defineProperty(arr, "0", { + set: set_fun, + enumerable: true, + configurable: true +}); + +Object.defineProperties(arr, { + "0": { + enumerable: false + } +}); +verifyWritable(arr, "0", "setVerifyHelpProp"); + +verifyNotEnumerable(arr, "0"); + +verifyConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-261.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-261.js new file mode 100644 index 0000000000..3a4aeaac10 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-261.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-261 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is accessor property and + 'desc' is accessor descriptor, test updating the [[Configurable]] + attribute value of 'P' (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + + +var arr = []; + +function set_fun(value) { + arr.setVerifyHelpProp = value; +} +Object.defineProperty(arr, "0", { + set: set_fun, + configurable: true +}); + +Object.defineProperties(arr, { + "0": { + configurable: false + } +}); +verifyWritable(arr, "0", "setVerifyHelpProp"); + +verifyNotEnumerable(arr, "0"); + +verifyNotConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-262.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-262.js new file mode 100644 index 0000000000..ee319f6ff2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-262.js @@ -0,0 +1,48 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-262 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property that already exists on 'O' is accessor property and + 'desc' is accessor descriptor, test updating multiple attribute + values of 'P' (15.4.5.1 step 4.c) +includes: [propertyHelper.js] +---*/ + + +var arr = []; + +function get_fun() { + return 36; +} + +function set_fun(value) { + arr.setVerifyHelpProp = value; +} +Object.defineProperty(arr, "0", { + get: function() { + return 12; + }, + set: set_fun, + enumerable: true, + configurable: true +}); + +Object.defineProperties(arr, { + "0": { + get: get_fun, + enumerable: false, + configurable: false + } +}); +verifyEqualTo(arr, "0", get_fun()); + +verifyWritable(arr, "0", "setVerifyHelpProp"); + +verifyNotEnumerable(arr, "0"); + +verifyNotConfigurable(arr, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-263.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-263.js new file mode 100644 index 0000000000..c11a3fede0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-263.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-263 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, test the length property of 'O' is not changed if + ToUint32('P') is less than value of the length property in 'O' + (15.4.5.1 step 4.e) +---*/ + +var arr = []; + +arr.length = 3; // default value of length: writable: true, configurable: false, enumerable: false + +Object.defineProperties(arr, { + "1": { + value: 26 + } +}); + +assert.sameValue(arr.length, 3, 'arr.length'); +assert.sameValue(arr[1], 26, 'arr[1]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-264.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-264.js new file mode 100644 index 0000000000..5486a526f4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-264.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-264 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, test the length property of 'O' is set as + ToUint32('P') + 1 if ToUint32('P') equals to value of the length + property in 'O' (15.4.5.1 step 4.e.ii) +---*/ + +var arr = []; + +arr.length = 3; // default value of length: writable: true, configurable: false, enumerable: false + +Object.defineProperties(arr, { + "3": { + value: 26 + } +}); + +assert.sameValue(arr.length, 4, 'arr.length'); +assert.sameValue(arr[3], 26, 'arr[3]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-265.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-265.js new file mode 100644 index 0000000000..7d7eb62132 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-265.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-265 +description: > + Object.defineProperties - 'O' is an Array, 'P' is an array index + named property, test the length property of 'O' is set as + ToUint32('P') + 1 if ToUint32('P') is greater than value of the + length property in 'O' (15.4.5.1 step 4.e.ii) +---*/ + +var arr = []; + +Object.defineProperties(arr, { + "5": { + value: 26 + } +}); + +assert.sameValue(arr.length, 6, 'arr.length'); +assert.sameValue(arr[5], 26, 'arr[5]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-266.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-266.js new file mode 100644 index 0000000000..689bec9b21 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-266.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-266 +description: > + Object.defineProperties - 'O' is an Array, 'P' is generic property + that won't exist on 'O', and 'desc' is data descriptor, test 'P' + is defined in 'O' with all correct attribute values (15.4.5.1 step + 5) +includes: [propertyHelper.js] +---*/ + + +var arr = []; + +Object.defineProperties(arr, { + "property": { + value: 12, + writable: true, + enumerable: true, + configurable: true + } +}); +verifyEqualTo(arr, "property", 12); + +verifyWritable(arr, "property"); + +verifyEnumerable(arr, "property"); + +verifyConfigurable(arr, "property"); + +if (arr.length !== 0) { + throw new Test262Error('Expected arr.length === 0, actually ' + arr.length); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-267.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-267.js new file mode 100644 index 0000000000..c81aad2b3f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-267.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-267 +description: > + Object.defineProperties - 'O' is an Array, 'P' is generic + property, and 'desc' is accessor descriptor, test 'P' is defined + in 'O' with all correct attribute values (15.4.5.1 step 5) +includes: [propertyHelper.js] +---*/ + + +var arr = []; + +function get_fun() { + return 12; +} + +function set_fun(value) { + arr.setVerifyHelpProp = value; +} + +Object.defineProperties(arr, { + "property": { + get: get_fun, + set: set_fun, + enumerable: true, + configurable: true + } +}); +verifyEqualTo(arr, "property", get_fun()); + +verifyWritable(arr, "property", "setVerifyHelpProp"); + +verifyEnumerable(arr, "property"); + +verifyConfigurable(arr, "property"); + +if (arr.length !== 0) { + throw new Test262Error('Expected arr.length === 0, actually ' + arr.length); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-268.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-268.js new file mode 100644 index 0000000000..3f27c8552a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-268.js @@ -0,0 +1,45 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-268 +description: > + Object.defineProperties - 'O' is an Array, 'P' is generic own + accessor property of 'O', and 'desc' is accessor descriptor, test + updating multiple attribute values of 'P' (15.4.5.1 step 5) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +function get_fun() { + return 12; +} + +function set_fun(value) { + arr.verifySetFun = value; +} +Object.defineProperty(arr, "property", { + get: function() { + return 36; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperties(arr, { + "property": { + get: get_fun, + set: set_fun, + enumerable: false + } +}); +verifyEqualTo(arr, "property", get_fun()); + +verifyWritable(arr, "property", "verifySetFun"); + +verifyNotEnumerable(arr, "property"); + +verifyConfigurable(arr, "property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-269.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-269.js new file mode 100644 index 0000000000..217cd5b052 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-269.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-269 +description: > + Object.defineProperties - 'O' is an Array, 'P' is generic own data + property of 'O', and 'desc' is data descriptor, test updating + multiple attribute values of 'P' (15.4.5.1 step 5) +includes: [propertyHelper.js] +---*/ + + +var arr = []; +arr.property = 12; // default value of attributes: writable: true, configurable: true, enumerable: true + +Object.defineProperties(arr, { + "property": { + writable: false, + enumerable: false, + configurable: false + } +}); +verifyEqualTo(arr, "property", 12); + +verifyNotWritable(arr, "property"); + +verifyNotEnumerable(arr, "property"); + +verifyNotConfigurable(arr, "property"); + +if (arr.length !== 0) { + throw new Test262Error('Expected arr.length === 0, actually ' + arr.length); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-27.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-27.js new file mode 100644 index 0000000000..a1d78a42e0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-27.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-27 +description: > + Object.defineProperties - 'P' doesn't exist in 'O', test [[Value]] + of 'P' is set as undefined value if absent in data descriptor + 'desc' (8.12.9 step 4.a.i) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + prop: { + writable: true + } +}); + +var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + +assert(desc.hasOwnProperty("value"), 'desc.hasOwnProperty("value") !== true'); +assert.sameValue(typeof desc.value, "undefined", 'typeof desc.value'); +assert(desc.hasOwnProperty("writable"), 'desc.hasOwnProperty("writable") !== true'); +assert.sameValue(desc.writable, true, 'desc.writable'); +assert(desc.hasOwnProperty("configurable"), 'desc.hasOwnProperty("configurable") !== true'); +assert.sameValue(desc.configurable, false, 'desc.configurable'); +assert(desc.hasOwnProperty("enumerable"), 'desc.hasOwnProperty("enumerable") !== true'); +assert.sameValue(desc.enumerable, false, 'desc.enumerable'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-270.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-270.js new file mode 100644 index 0000000000..1fb83b1df8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-270.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-270 +description: > + Object.defineProperties - 'O' is an Array, 'P' is generic own data + property of 'O', test TypeError is thrown when updating the + [[Value]] attribute value of 'P' which is defined as unwritable + and non-configurable (15.4.5.1 step 5) +includes: [propertyHelper.js] +---*/ + + +var arr = []; + +Object.defineProperty(arr, "property", { + value: 12 +}); + +try { + Object.defineProperties(arr, { + "property": { + value: 36 + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arr, "property", 12); + + verifyNotWritable(arr, "property"); + + verifyNotEnumerable(arr, "property"); + + verifyNotConfigurable(arr, "property"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-271.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-271.js new file mode 100644 index 0000000000..01af4ede13 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-271.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-271 +description: > + Object.defineProperties -'O' is an Array, 'P' is generic own data + property of 'O', test TypeError is thrown when updating the + [[Writable]] attribute value of 'P' which is defined as + non-configurable (15.4.5.1 step 5) +includes: [propertyHelper.js] +---*/ + + +var arr = []; + +Object.defineProperty(arr, "property", { + writable: false +}); + +try { + Object.defineProperties(arr, { + "property": { + writable: true + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arr, "property", undefined); + + verifyNotWritable(arr, "property"); + + verifyNotEnumerable(arr, "property"); + + verifyNotConfigurable(arr, "property"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-272.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-272.js new file mode 100644 index 0000000000..1235a3604d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-272.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-272 +description: > + Object.defineProperties - 'O' is an Array, 'P' is generic own data + property of 'O', test TypeError is thrown when updating the + [[Enumerable]] attribute value of 'P' which is defined as + non-configurable (15.4.5.1 step 5) +includes: [propertyHelper.js] +---*/ + + +var arr = []; + +Object.defineProperty(arr, "property", { + value: 12, + enumerable: false +}); + +try { + Object.defineProperties(arr, { + "property": { + enumerable: true + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arr, "property", 12); + + verifyNotWritable(arr, "property"); + + verifyNotEnumerable(arr, "property"); + + verifyNotConfigurable(arr, "property"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-273.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-273.js new file mode 100644 index 0000000000..9d8807a77f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-273.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-273 +description: > + Object.defineProperties - 'O' is an Array, 'P' is generic own data + property of 'O', test TypeError is thrown when updating the + [[Configurable]] attribute value of 'P' which is defined as + non-configurable (15.4.5.1 step 5) +includes: [propertyHelper.js] +---*/ + + +var arr = []; + +Object.defineProperty(arr, "property", { + value: 12 +}); + +try { + Object.defineProperties(arr, { + "property": { + configurable: true + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arr, "property", 12); + + verifyNotWritable(arr, "property"); + + verifyNotEnumerable(arr, "property"); + + verifyNotConfigurable(arr, "property"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-274.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-274.js new file mode 100644 index 0000000000..87b8c4cb9a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-274.js @@ -0,0 +1,52 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-274 +description: > + Object.defineProperties - 'O' is an Array, 'P' is generic own + accessor property of 'O', test TypeError is thrown when updating + the [[Get]] attribute value of 'P' which is defined as + non-configurable (15.4.5.1 step 5) +includes: [propertyHelper.js] +---*/ + +var arr = []; + +function get_fun() { + return 37; +} + +function set_fun(value) { + arr.verifySetFun = value; +} +Object.defineProperty(arr, "property", { + get: get_fun, + set: set_fun +}); + +try { + Object.defineProperties(arr, { + "property": { + get: function() { + return 36; + } + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arr, "property", get_fun()); + + verifyWritable(arr, "property", "verifySetFun"); + + verifyNotEnumerable(arr, "property"); + + verifyNotConfigurable(arr, "property"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-275.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-275.js new file mode 100644 index 0000000000..73a3eb6ff6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-275.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-275 +description: > + Object.defineProperties - 'O' is an Array, 'P' is generic own + accessor property of 'O', test TypeError is thrown when updating + the [[Set]] attribute value of 'P' which is defined as + non-configurable (15.4.5.1 step 5) +includes: [propertyHelper.js] +---*/ + + +var arr = []; + +function set_fun(value) { + arr.setVerifyHelpProp = value; +} +Object.defineProperty(arr, "property", { + set: set_fun +}); + +try { + Object.defineProperties(arr, { + "property": { + set: function() {} + } + }); +} catch (e) { + verifyWritable(arr, "property", "setVerifyHelpProp"); + + verifyNotEnumerable(arr, "property"); + + verifyNotConfigurable(arr, "property"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-276.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-276.js new file mode 100644 index 0000000000..4f44eedb27 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-276.js @@ -0,0 +1,45 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-276 +description: > + Object.defineProperties - 'O' is an Array, 'P' is generic own + accessor property of 'O', test TypeError is thrown when updating + the [[Enumerable]] attribute value of 'P' which is defined as + non-configurable (15.4.5.1 step 5) +includes: [propertyHelper.js] +---*/ + + +var arr = []; + +function set_fun(value) { + arr.setVerifyHelpProp = value; +} +Object.defineProperty(arr, "property", { + set: set_fun, + enumerable: false +}); + +try { + Object.defineProperties(arr, { + "property": { + enumerable: true + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyWritable(arr, "property", "setVerifyHelpProp"); + + verifyNotEnumerable(arr, "property"); + + verifyNotConfigurable(arr, "property"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-277.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-277.js new file mode 100644 index 0000000000..6015feab01 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-277.js @@ -0,0 +1,45 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-277 +description: > + Object.defineProperties - 'O' is an Array, 'P' is generic own + accessor property of 'O', test TypeError is thrown when updating + the [[Configurable]] attribute value of 'P' which is defined as + non-configurable (15.4.5.1 step 5) +includes: [propertyHelper.js] +---*/ + + +var arr = []; + +function set_fun(value) { + arr.setVerifyHelpProp = value; +} +Object.defineProperty(arr, "property", { + set: set_fun, + configurable: false +}); + +try { + Object.defineProperties(arr, { + "property": { + configurable: true + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyWritable(arr, "property", "setVerifyHelpProp"); + + verifyNotEnumerable(arr, "property"); + + verifyNotConfigurable(arr, "property"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-278.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-278.js new file mode 100644 index 0000000000..ee646acae0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-278.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-278 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is own + property which is ever defined in both [[ParameterMap]] of 'O' and + 'O', and is deleted afterwards, and 'desc' is data descriptor, + test 'P' is redefined in 'O' with all correct attribute values + (10.6 [[DefineOwnProperty]] step 3) +includes: [propertyHelper.js] +---*/ + + +var arg; + +(function fun(a, b, c) { + arg = arguments; +}(0, 1, 2)); + +delete arg[0]; + +Object.defineProperties(arg, { + "0": { + value: 10, + writable: true, + enumerable: true, + configurable: true + } +}); + +verifyEqualTo(arg, "0", 10); + +verifyWritable(arg, "0"); + +verifyEnumerable(arg, "0"); + +verifyConfigurable(arg, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-279.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-279.js new file mode 100644 index 0000000000..69aff91049 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-279.js @@ -0,0 +1,49 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-279 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is own + property which is ever defined in both [[ParameterMap]] of 'O' and + 'O', and is deleted afterwards, and 'desc' is accessor descriptor, + test 'P' is redefined in 'O' with all correct attribute values + (10.6 [[DefineOwnProperty]] step 3) +includes: [propertyHelper.js] +---*/ + + +var arg; + +(function fun(a, b, c) { + arg = arguments; +}(0, 1, 2)); + +delete arg[0]; + +function get_func() { + return 10; +} + +function set_func(value) { + arg.setVerifyHelpProp = value; +} + +Object.defineProperties(arg, { + "0": { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + } +}); + +verifyEqualTo(arg, "0", get_func()); + +verifyWritable(arg, "0", "setVerifyHelpProp"); + +verifyEnumerable(arg, "0"); + +verifyConfigurable(arg, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-28.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-28.js new file mode 100644 index 0000000000..1b1b00f14b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-28.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-28 +description: > + Object.defineProperties - 'P' doesn't exist in 'O', test + [[Writable]] of 'P' is set as false value if absent in data + descriptor 'desc' (8.12.9 step 4.a.i) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + prop: { + value: 1001 + } +}); + +verifyNotWritable(obj, "prop"); + +if (!obj.hasOwnProperty("prop")) { + throw new Test262Error('Expected obj.hasOwnProperty("prop") to be true, actually ' + obj.hasOwnProperty("prop")); +} + +if (obj.prop !== 1001) { + throw new Test262Error('Expected obj.prop === 1001, actually ' + obj.prop); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-280.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-280.js new file mode 100644 index 0000000000..48e4384fab --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-280.js @@ -0,0 +1,48 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-280 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is own + accessor property of 'O' which is also defined in [[ParameterMap]] + of 'O', and 'desc' is accessor descriptor, test updating multiple + attribute values of 'P' (10.6 [[DefineOwnProperty]] step 3) +---*/ + +var arg; + +(function fun(a, b, c) { + arg = arguments; +}(0, 1, 2)); + +function get_func1() { + return 10; +} + +Object.defineProperty(arg, "0", { + get: get_func1, + enumerable: true, + configurable: true +}); + +function get_func2() { + return 20; +} + +Object.defineProperties(arg, { + "0": { + get: get_func2, + enumerable: false, + configurable: false + } +}); + +var desc = Object.getOwnPropertyDescriptor(arg, "0"); + +assert.sameValue(desc.get, get_func2, 'desc.get'); +assert.sameValue(typeof desc.set, "undefined", 'typeof desc.set'); +assert.sameValue(desc.configurable, false, 'desc.configurable'); +assert.sameValue(desc.enumerable, false, 'desc.enumerable'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-281.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-281.js new file mode 100644 index 0000000000..4df7240d9c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-281.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-281 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is own + data property of 'O' which is also defined in [[ParameterMap]] of + 'O', and 'desc' is data descriptor, test updating multiple + attribute values of 'P' (10.6 [[DefineOwnProperty]] step 3) +includes: [propertyHelper.js] +---*/ + + +var arg; + +(function fun(a, b, c) { + arg = arguments; +}(0, 1, 2)); + +Object.defineProperties(arg, { + "0": { + value: 20, + writable: false, + enumerable: false, + configurable: false + } +}); + +verifyEqualTo(arg, "0", 20); + +verifyNotWritable(arg, "0"); + +verifyNotEnumerable(arg, "0"); + +verifyNotConfigurable(arg, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-282.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-282.js new file mode 100644 index 0000000000..11d6e36781 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-282.js @@ -0,0 +1,51 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-282 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is own + data property of 'O' which is also defined in [[ParameterMap]] of + 'O', test TypeError is thrown when updating the [[Value]] + attribute value of 'P' whose writable and configurable attributes + are false (10.6 [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + + +var arg; + +(function fun(a, b, c) { + arg = arguments; +}(0, 1, 2)); + +Object.defineProperty(arg, "0", { + value: 0, + writable: false, + configurable: false +}); + +try { + Object.defineProperties(arg, { + "0": { + value: 10 + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arg, "0", 0); + + verifyNotWritable(arg, "0"); + + verifyEnumerable(arg, "0"); + + verifyNotConfigurable(arg, "0"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-283.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-283.js new file mode 100644 index 0000000000..8ac9b4f704 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-283.js @@ -0,0 +1,52 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-283 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is own + data property of 'O' which is also defined in [[ParameterMap]] of + 'O', test TypeError is thrown when updating the [[Writable]] + attribute value of 'P' which is defined as non-configurable (10.6 + [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + + +var arg; + +(function fun(a, b, c) { + arg = arguments; +}(0, 1, 2)); + +Object.defineProperty(arg, "0", { + value: 0, + writable: false, + enumerable: false, + configurable: false +}); + +try { + Object.defineProperties(arg, { + "0": { + writable: true + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arg, "0", 0); + + verifyNotWritable(arg, "0"); + + verifyNotEnumerable(arg, "0"); + + verifyNotConfigurable(arg, "0"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-284.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-284.js new file mode 100644 index 0000000000..9fed19833a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-284.js @@ -0,0 +1,52 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-284 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is own + data property of 'O' which is also defined in [[ParameterMap]] of + 'O', test TypeError is thrown when updating the [[Enumerable]] + attribute value of 'P' which is defined as non-configurable (10.6 + [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + + +var arg; + +(function fun(a, b, c) { + arg = arguments; +}(0, 1, 2)); + +Object.defineProperty(arg, "0", { + value: 0, + writable: false, + enumerable: true, + configurable: false +}); + +try { + Object.defineProperties(arg, { + "0": { + enumerable: false + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arg, "0", 0); + + verifyNotWritable(arg, "0"); + + verifyEnumerable(arg, "0"); + + verifyNotConfigurable(arg, "0"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-285.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-285.js new file mode 100644 index 0000000000..a22f1a59ba --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-285.js @@ -0,0 +1,52 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-285 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is own + data property of 'O' which is also defined in [[ParameterMap]] of + 'O', test TypeError is thrown when updating the [[Configurable]] + attribute value of 'P' which is defined as non-configurable (10.6 + [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + + +var arg; + +(function fun(a, b, c) { + arg = arguments; +}(0, 1, 2)); + +Object.defineProperty(arg, "0", { + value: 0, + writable: false, + enumerable: false, + configurable: false +}); + +try { + Object.defineProperties(arg, { + "0": { + configurable: true + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arg, "0", 0); + + verifyNotWritable(arg, "0"); + + verifyNotEnumerable(arg, "0"); + + verifyNotConfigurable(arg, "0"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-286.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-286.js new file mode 100644 index 0000000000..ea68464df0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-286.js @@ -0,0 +1,46 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-286 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is own + accessor property of 'O' which is also defined in [[ParameterMap]] + of 'O', test TypeError is thrown when updating the [[Get]] + attribute value of 'P' which is defined as non-configurable (10.6 + [[DefineOwnProperty]] step 4) +---*/ + +var arg; + +(function fun(a, b, c) { + arg = arguments; +}(0, 1, 2)); + +function get_func1() { + return 0; +} + +Object.defineProperty(arg, "0", { + get: get_func1, + enumerable: false, + configurable: false +}); + +function get_func2() { + return 10; +} +assert.throws(TypeError, function() { + Object.defineProperties(arg, { + "0": { + get: get_func2 + } + }); +}); +var desc = Object.getOwnPropertyDescriptor(arg, "0"); +assert.sameValue(desc.get, get_func1, 'desc.get'); +assert.sameValue(typeof desc.set, "undefined", 'typeof desc.set'); +assert.sameValue(desc.enumerable, false, 'desc.enumerable'); +assert.sameValue(desc.configurable, false, 'desc.configurable'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-287.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-287.js new file mode 100644 index 0000000000..110f8e9417 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-287.js @@ -0,0 +1,47 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-287 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is own + accessor property of 'O' which is also defined in [[ParameterMap]] + of 'O', test TypeError is thrown when updating the [[Set]] + attribute value of 'P' which is defined as non-configurable (10.6 + [[DefineOwnProperty]] step 4) +---*/ + +var arg; + +(function fun(a, b, c) { + arg = arguments; +}(0, 1, 2)); + +function get_func() { + return 0; +} + +Object.defineProperty(arg, "0", { + get: get_func, + set: undefined, + enumerable: false, + configurable: false +}); + +function set_func(value) { + arg.setVerifyHelpProp = value; +} +assert.throws(TypeError, function() { + Object.defineProperties(arg, { + "0": { + set: set_func + } + }); +}); +var desc = Object.getOwnPropertyDescriptor(arg, "0"); +assert.sameValue(desc.get, get_func, 'desc.get'); +assert.sameValue(typeof desc.set, "undefined", 'typeof desc.set'); +assert.sameValue(desc.enumerable, false, 'desc.enumerable'); +assert.sameValue(desc.configurable, false, 'desc.configurable'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-288.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-288.js new file mode 100644 index 0000000000..a5a2feeecd --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-288.js @@ -0,0 +1,53 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-288 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is own + accessor property of 'O' which is also defined in [[ParameterMap]] + of 'O', test TypeError is thrown when updating the [[Enumerable]] + attribute value of 'P' which is defined as non-configurable (10.6 + [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + + +var arg; + +(function fun(a, b, c) { + arg = arguments; +}(0, 1, 2)); + +function get_func() { + return 0; +} + +Object.defineProperty(arg, "0", { + get: get_func, + enumerable: true, + configurable: false +}); + +try { + Object.defineProperties(arg, { + "0": { + enumerable: false + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arg, "0", get_func()); + + verifyEnumerable(arg, "0"); + + verifyNotConfigurable(arg, "0"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-289.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-289.js new file mode 100644 index 0000000000..58daa19af6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-289.js @@ -0,0 +1,53 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-289 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is own + accessor property of 'O' which is also defined in [[ParameterMap]] + of 'O', test TypeError is thrown when updating the + [[Configurable]] attribute value of 'P' which is defined as + non-configurable (10.6 [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + + +var arg; + +(function fun(a, b, c) { + arg = arguments; +}(0, 1, 2)); + +function get_func() { + return 0; +} + +Object.defineProperty(arg, "0", { + get: get_func, + enumerable: true, + configurable: false +}); + +try { + Object.defineProperties(arg, { + "0": { + configurable: true + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arg, "0", get_func()); + + verifyEnumerable(arg, "0"); + + verifyNotConfigurable(arg, "0"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-29.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-29.js new file mode 100644 index 0000000000..93d238775d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-29.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-29 +description: > + Object.defineProperties - 'P' doesn't exist in 'O', test + [[Enumerable]] of 'P' is set as false value if absent in data + descriptor 'desc' (8.12.9 step 4.a.i) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + prop: { + value: 1001 + } +}); + +for (var prop in obj) { + if (obj.hasOwnProperty(prop)) { + assert.notSameValue(prop, "prop", 'prop'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-290.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-290.js new file mode 100644 index 0000000000..f03e73674a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-290.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-290 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is an + array index named property of 'O' but not defined in + [[ParameterMap]] of 'O', and 'desc' is data descriptor, test 'P' + is defined in 'O' with all correct attribute values (10.6 + [[DefineOwnProperty]] step 3) +includes: [propertyHelper.js] +---*/ + + +var arg; + +(function fun() { + arg = arguments; +}(0, 1, 2)); + +delete arg[0]; + +Object.defineProperties(arg, { + "0": { + value: 10, + writable: false, + enumerable: false, + configurable: false + } +}); + +verifyEqualTo(arg, "0", 10); + +verifyNotWritable(arg, "0"); + +verifyNotEnumerable(arg, "0"); + +verifyNotConfigurable(arg, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-291.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-291.js new file mode 100644 index 0000000000..1319ec70c2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-291.js @@ -0,0 +1,49 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-291 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is an + array index named property of 'O' but not defined in + [[ParameterMap]] of 'O', and 'desc' is accessor descriptor, test + 'P' is defined in 'O' with all correct attribute values (10.6 + [[DefineOwnProperty]] step 3) +includes: [propertyHelper.js] +---*/ + + +var arg; + +(function fun() { + arg = arguments; +}(0, 1, 2)); + +delete arg[0]; + +function get_func() { + return 10; +} + +function set_func(value) { + arg.setVerifyHelpProp = value; +} + +Object.defineProperties(arg, { + "0": { + get: get_func, + set: set_func, + enumerable: false, + configurable: false + } +}); + +verifyEqualTo(arg, "0", get_func()); + +verifyWritable(arg, "0", "setVerifyHelpProp"); + +verifyNotEnumerable(arg, "0"); + +verifyNotConfigurable(arg, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-292.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-292.js new file mode 100644 index 0000000000..a03cfd2060 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-292.js @@ -0,0 +1,50 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-292 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is an + array index named accessor property of 'O' but not defined in + [[ParameterMap]] of 'O', and 'desc' is accessor descriptor, test + updating multiple attribute values of 'P' (10.6 + [[DefineOwnProperty]] step 3) +includes: [propertyHelper.js] +---*/ + + +var arg; + +(function fun() { + arg = arguments; +}(0, 1, 2)); + +function get_func1() { + return 10; +} + +Object.defineProperty(arg, "0", { + get: get_func1, + enumerable: true, + configurable: true +}); + +function get_func2() { + return 20; +} + +Object.defineProperties(arg, { + "0": { + get: get_func2, + enumerable: false, + configurable: false + } +}); + +verifyEqualTo(arg, "0", get_func2()); + +verifyNotEnumerable(arg, "0"); + +verifyNotConfigurable(arg, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-293.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-293.js new file mode 100644 index 0000000000..5d9589888b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-293.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-293 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is an + array index named data property of 'O' but not defined in + [[ParameterMap]] of 'O', and 'desc' is data descriptor, test + updating multiple attribute values of 'P' (10.6 + [[DefineOwnProperty]] step 3) +includes: [propertyHelper.js] +---*/ + + +var arg; + +(function fun() { + arg = arguments; +}(0, 1, 2)); + +Object.defineProperties(arg, { + "0": { + value: 20, + writable: false, + enumerable: false, + configurable: false + } +}); + +verifyEqualTo(arg, "0", 20); + +verifyNotWritable(arg, "0"); + +verifyNotEnumerable(arg, "0"); + +verifyNotConfigurable(arg, "0"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-294.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-294.js new file mode 100644 index 0000000000..e1af163e2b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-294.js @@ -0,0 +1,51 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-294 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is an + array index named data property of 'O' but not defined in + [[ParameterMap]] of 'O', test TypeError is thrown when updating + the [[Value]] attribute value of 'P' which is not writable and not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + + +var arg; + +(function fun() { + arg = arguments; +}()); + +Object.defineProperty(arg, "0", { + value: 0, + writable: false, + configurable: false +}); + +try { + Object.defineProperties(arg, { + "0": { + value: 10 + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arg, "0", 0); + + verifyNotWritable(arg, "0"); + + verifyNotEnumerable(arg, "0"); + + verifyNotConfigurable(arg, "0"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-295.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-295.js new file mode 100644 index 0000000000..995e695b60 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-295.js @@ -0,0 +1,52 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-295 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is an + array index named data property of 'O' but not defined in + [[ParameterMap]] of 'O', test TypeError is thrown when updating + the [[Writable]] attribute value of 'P' which is not configurable + (10.6 [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + + +var arg; + +(function fun() { + arg = arguments; +}()); + +Object.defineProperty(arg, "0", { + value: 0, + writable: false, + enumerable: false, + configurable: false +}); + +try { + Object.defineProperties(arg, { + "0": { + writable: true + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arg, "0", 0); + + verifyNotWritable(arg, "0"); + + verifyNotEnumerable(arg, "0"); + + verifyNotConfigurable(arg, "0"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-296.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-296.js new file mode 100644 index 0000000000..d63b6abd7c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-296.js @@ -0,0 +1,52 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-296 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is an + array index named data property of 'O' but not defined in + [[ParameterMap]] of 'O', test TypeError is thrown when updating + the [[Enumerable]] attribute value of 'P' which is not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + + +var arg; + +(function fun() { + arg = arguments; +}()); + +Object.defineProperty(arg, "0", { + value: 0, + writable: false, + enumerable: true, + configurable: false +}); + +try { + Object.defineProperties(arg, { + "0": { + enumerable: false + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arg, "0", 0); + + verifyNotWritable(arg, "0"); + + verifyEnumerable(arg, "0"); + + verifyNotConfigurable(arg, "0"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-297.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-297.js new file mode 100644 index 0000000000..85a07ad038 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-297.js @@ -0,0 +1,52 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-297 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is an + array index named data property of 'O' but not defined in + [[ParameterMap]] of 'O', test TypeError is thrown when updating + the [[Configurable]] attribute value of 'P' which is not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + + +var arg; + +(function fun() { + arg = arguments; +}()); + +Object.defineProperty(arg, "0", { + value: 0, + writable: false, + enumerable: false, + configurable: false +}); + +try { + Object.defineProperties(arg, { + "0": { + configurable: true + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arg, "0", 0); + + verifyNotWritable(arg, "0"); + + verifyNotEnumerable(arg, "0"); + + verifyNotConfigurable(arg, "0"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-298.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-298.js new file mode 100644 index 0000000000..2bb794f123 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-298.js @@ -0,0 +1,55 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-298 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is an + array index named accessor property of 'O' but not defined in + [[ParameterMap]] of 'O', test TypeError is thrown when updating + the [[Get]] attribute value of 'P' which is not configurable (10.6 + [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + + +var arg; + +(function fun() { + arg = arguments; +}()); + +function get_func1() { + return 0; +} + +Object.defineProperty(arg, "0", { + get: get_func1, + enumerable: false, + configurable: false +}); + +function get_func2() { + return 10; +} +try { + Object.defineProperties(arg, { + "0": { + get: get_func2 + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arg, "0", get_func1()); + + verifyNotEnumerable(arg, "0"); + + verifyNotConfigurable(arg, "0"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-299.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-299.js new file mode 100644 index 0000000000..2e59611209 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-299.js @@ -0,0 +1,56 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-299 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is an + array index named accessor property of 'O' but not defined in + [[ParameterMap]] of 'O', test TypeError is thrown when updating + the [[Set]] attribute value of 'P' which is not configurable (10.6 + [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + + +var arg; + +(function fun() { + arg = arguments; +}()); + +function get_func() { + return 0; +} + +Object.defineProperty(arg, "0", { + get: get_func, + set: undefined, + enumerable: false, + configurable: false +}); + +function set_func(value) { + arg.setVerifyHelpProp = value; +} +try { + Object.defineProperties(arg, { + "0": { + set: set_func + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arg, "0", get_func()); + + verifyNotEnumerable(arg, "0"); + + verifyNotConfigurable(arg, "0"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-3.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-3.js new file mode 100644 index 0000000000..685c2a5422 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-3.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-3 +description: > + Object.defineProperties - 'P' is own data property that overrides + an inherited data property (8.12.9 step 1 ) +---*/ + +var proto = {}; +Object.defineProperty(proto, "prop", { + value: 11, + configurable: true +}); +var Con = function() {}; +Con.prototype = proto; + +var obj = new Con(); +Object.defineProperty(obj, "prop", { + value: 12, + configurable: false +}); +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + prop: { + value: 13, + configurable: true + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-30.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-30.js new file mode 100644 index 0000000000..bba5d89ff4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-30.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-30 +description: > + Object.defineProperties - 'P' doesn't exist in 'O', test + [[Configurable]] of 'P' is set as false value if absent in data + descriptor 'desc' (8.12.9 step 4.a.i) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + + +Object.defineProperties(obj, { + prop: { + value: 1001 + } +}); + +verifyNotConfigurable(obj, "prop"); + +if (!obj.hasOwnProperty("prop")) { + throw new Test262Error('Expected obj.hasOwnProperty("prop") to be true, actually ' + obj.hasOwnProperty("prop")); +} + +if (obj.prop !== 1001) { + throw new Test262Error('Expected obj.prop === 1001, actually ' + obj.prop); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-300.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-300.js new file mode 100644 index 0000000000..7c10d4efa7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-300.js @@ -0,0 +1,52 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-300 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is an + array index named accessor property of 'O' but not defined in + [[ParameterMap]] of 'O', test TypeError is thrown when updating + the [[Enumerable]] attribute value of 'P' which is not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + + +var arg; + +(function fun() { + arg = arguments; +}()); + +function get_func() { + return 0; +} + +Object.defineProperty(arg, "0", { + get: get_func, + enumerable: true, + configurable: false +}); + +try { + Object.defineProperties(arg, { + "0": { + enumerable: false + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arg, "0", get_func()); + + verifyEnumerable(arg, "0"); + + verifyNotConfigurable(arg, "0"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-301.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-301.js new file mode 100644 index 0000000000..607a3a746d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-301.js @@ -0,0 +1,52 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-301 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is an + array index named accessor property of 'O' but not defined in + [[ParameterMap]] of 'O', test TypeError is thrown when updating + the [[Configurable]] attribute value of 'P' which is not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + + +var arg; + +(function fun() { + arg = arguments; +}()); + +function get_func() { + return 0; +} + +Object.defineProperty(arg, "0", { + get: get_func, + enumerable: true, + configurable: false +}); + +try { + Object.defineProperties(arg, { + "0": { + configurable: true + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arg, "0", get_func()); + + verifyEnumerable(arg, "0"); + + verifyNotConfigurable(arg, "0"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-302.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-302.js new file mode 100644 index 0000000000..16f710cd40 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-302.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-302 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is + generic property, and 'desc' is data descriptor, test 'P' is + defined in 'O' with all correct attribute values (10.6 + [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + +var arg = (function() { + return arguments; +}(1, 2, 3)); + +Object.defineProperties(arg, { + "genericProperty": { + value: 1001, + writable: true, + enumerable: true, + configurable: true + } +}); + +verifyEqualTo(arg, "genericProperty", 1001); + +verifyWritable(arg, "genericProperty"); + +verifyEnumerable(arg, "genericProperty"); + +verifyConfigurable(arg, "genericProperty"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-303.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-303.js new file mode 100644 index 0000000000..f3f32aab1c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-303.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-303 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is + generic property, and 'desc' is accessor descriptor, test 'P' is + defined in 'O' with all correct attribute values (10.6 + [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + +var arg = (function() { + return arguments; +}(1, 2, 3)); + +function getFun() { + return "getFunctionString"; +} + +function setFun(value) { + arg.testGetFunction = value; +} +Object.defineProperties(arg, { + "genericProperty": { + get: getFun, + set: setFun, + enumerable: true, + configurable: true + } +}); + +verifyEqualTo(arg, "genericProperty", getFun()); + +verifyWritable(arg, "genericProperty", "testGetFunction"); + +verifyEnumerable(arg, "genericProperty"); + +verifyConfigurable(arg, "genericProperty"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-304.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-304.js new file mode 100644 index 0000000000..e5168c7d84 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-304.js @@ -0,0 +1,53 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-304 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is + generic own accessor property of 'O', and 'desc' is accessor + descriptor, test updating multiple attribute values of 'P' (10.6 + [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + +var arg = (function() { + return arguments; +}(1, 2, 3)); + +Object.defineProperty(arg, "genericProperty", { + get: function() { + return 1001; + }, + set: function(value) { + arg.testGetFunction1 = value; + }, + enumerable: true, + configurable: true +}); + +function getFun() { + return "getFunctionString"; +} + +function setFun(value) { + arg.testGetFunction = value; +} +Object.defineProperties(arg, { + "genericProperty": { + get: getFun, + set: setFun, + enumerable: false, + configurable: false + } +}); + +verifyEqualTo(arg, "genericProperty", getFun()); + +verifyWritable(arg, "genericProperty", "testGetFunction"); + +verifyNotEnumerable(arg, "genericProperty"); + +verifyNotConfigurable(arg, "genericProperty"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-305.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-305.js new file mode 100644 index 0000000000..4863298678 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-305.js @@ -0,0 +1,41 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-305 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is + generic own data property of 'O', and 'desc' is data descriptor, + test updating multiple attribute values of 'P' (10.6 + [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + +var arg = (function() { + return arguments; +}(1, 2, 3)); + +Object.defineProperty(arg, "genericProperty", { + value: 1001, + writable: true, + enumerable: true, + configurable: true +}); + +Object.defineProperties(arg, { + "genericProperty": { + value: 1002, + enumerable: false, + configurable: false + } +}); + +verifyEqualTo(arg, "genericProperty", 1002); + +verifyWritable(arg, "genericProperty"); + +verifyNotEnumerable(arg, "genericProperty"); + +verifyNotConfigurable(arg, "genericProperty"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-306.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-306.js new file mode 100644 index 0000000000..5674c28b7d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-306.js @@ -0,0 +1,47 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-306 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is + generic own data property of 'O', test TypeError is thrown when + updating the [[Value]] attribute value of 'P' which is not + writable and not configurable (10.6 [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + +var arg = (function() { + return arguments; +}(1, 2, 3)); + +Object.defineProperty(arg, "genericProperty", { + value: 1001, + writable: false, + configurable: false +}); + +try { + Object.defineProperties(arg, { + "genericProperty": { + value: 1002 + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arg, "genericProperty", 1001); + + verifyNotWritable(arg, "genericProperty"); + + verifyNotEnumerable(arg, "genericProperty"); + + verifyNotConfigurable(arg, "genericProperty"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-307.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-307.js new file mode 100644 index 0000000000..f1294cc7e8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-307.js @@ -0,0 +1,46 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-307 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is + generic own data property of 'O', test TypeError is thrown when + updating the [[Writable]] attribute value of 'P' which is not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + +var arg = (function() { + return arguments; +}(1, 2, 3)); + +Object.defineProperty(arg, "genericProperty", { + writable: false, + configurable: false +}); + +try { + Object.defineProperties(arg, { + "genericProperty": { + writable: true + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arg, "genericProperty", undefined); + + verifyNotWritable(arg, "genericProperty"); + + verifyNotEnumerable(arg, "genericProperty"); + + verifyNotConfigurable(arg, "genericProperty"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-308.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-308.js new file mode 100644 index 0000000000..f905ee306c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-308.js @@ -0,0 +1,46 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-308 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is + generic own data property of 'O', test TypeError is thrown when + updating the [[Enumerable]] attribute value of 'P' which is not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + +var arg = (function() { + return arguments; +}(1, 2, 3)); + +Object.defineProperty(arg, "genericProperty", { + enumerable: true, + configurable: false +}); + +try { + Object.defineProperties(arg, { + "genericProperty": { + enumerable: false + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arg, "genericProperty", undefined); + + verifyNotWritable(arg, "genericProperty"); + + verifyEnumerable(arg, "genericProperty"); + + verifyNotConfigurable(arg, "genericProperty"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-309.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-309.js new file mode 100644 index 0000000000..fc7e123d7a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-309.js @@ -0,0 +1,45 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-309 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is + generic own data property of 'O', test TypeError is thrown when + updating the [[Configurable]] attribute value of 'P' which is not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + +var arg = (function() { + return arguments; +}(1, 2, 3)); + +Object.defineProperty(arg, "genericProperty", { + configurable: false +}); + +try { + Object.defineProperties(arg, { + "genericProperty": { + configurable: true + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arg, "genericProperty", undefined); + + verifyNotWritable(arg, "genericProperty"); + + verifyNotEnumerable(arg, "genericProperty"); + + verifyNotConfigurable(arg, "genericProperty"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-31.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-31.js new file mode 100644 index 0000000000..3e0d7399be --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-31.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-31 +description: > + Object.defineProperties - 'desc' is data descriptor, test setting + all attribute values of 'P' (8.12.9 step 4.a.i) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + prop: { + value: 1002, + writable: false, + enumerable: false, + configurable: false + } +}); +verifyEqualTo(obj, "prop", 1002); + +verifyNotWritable(obj, "prop"); + +verifyNotEnumerable(obj, "prop"); + +verifyNotConfigurable(obj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-310.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-310.js new file mode 100644 index 0000000000..a62ee445a7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-310.js @@ -0,0 +1,56 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-310 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is + generic own accessor property of 'O', test TypeError is thrown + when updating the [[Get]] attribute value of 'P' which is not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + +var arg = (function() { + return arguments; +}(1, 2, 3)); + +function getFun() { + return "genericPropertyString"; +} + +function setFun(value) { + arg.verifySetFun = value; +} +Object.defineProperty(arg, "genericProperty", { + get: getFun, + set: setFun, + configurable: false +}); + +try { + Object.defineProperties(arg, { + "genericProperty": { + get: function() { + return "overideGenericPropertyString"; + } + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(arg, "genericProperty", getFun()); + + verifyWritable(arg, "genericProperty", "verifySetFun"); + + verifyNotEnumerable(arg, "genericProperty"); + + verifyNotConfigurable(arg, "genericProperty"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-311.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-311.js new file mode 100644 index 0000000000..b5fd0b53f7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-311.js @@ -0,0 +1,49 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-311 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is + generic own accessor property of 'O', test TypeError is thrown + when updating the [[Set]] attribute value of 'P' which is not + configurable (10.6 [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + +var arg = (function() { + return arguments; +}(1, 2, 3)); + +function setFun(value) { + arg.genericPropertyString = value; +} +Object.defineProperty(arg, "genericProperty", { + set: setFun, + configurable: false +}); + +try { + Object.defineProperties(arg, { + "genericProperty": { + set: function(value) { + arg.genericPropertyString1 = value; + } + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyWritable(arg, "genericProperty", "genericPropertyString"); + + verifyNotEnumerable(arg, "genericProperty"); + + verifyNotConfigurable(arg, "genericProperty"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-312.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-312.js new file mode 100644 index 0000000000..a890c971e3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-312.js @@ -0,0 +1,48 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-312 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is + generic own accessor property of 'O', test TypeError is thrown + when updating the [[Enumerable]] attribute value of 'P' which is + not configurable (10.6 [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + +var arg = (function() { + return arguments; +}(1, 2, 3)); + +function setFun(value) { + arg.genericPropertyString = value; +} +Object.defineProperty(arg, "genericProperty", { + set: setFun, + enumerable: true, + configurable: false +}); + +try { + Object.defineProperties(arg, { + "genericProperty": { + enumerable: false + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyWritable(arg, "genericProperty", "genericPropertyString"); + + verifyEnumerable(arg, "genericProperty"); + + verifyNotConfigurable(arg, "genericProperty"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-313.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-313.js new file mode 100644 index 0000000000..8a0992330e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-313.js @@ -0,0 +1,47 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-313 +description: > + Object.defineProperties - 'O' is an Arguments object, 'P' is + generic own accessor property of 'O', test TypeError is thrown + when updating the [[Configurable]] attribute value of 'P' which is + not configurable (10.6 [[DefineOwnProperty]] step 4) +includes: [propertyHelper.js] +---*/ + +var arg = (function() { + return arguments; +}(1, 2, 3)); + +function setFun(value) { + arg.genericPropertyString = value; +} +Object.defineProperty(arg, "genericProperty", { + set: setFun, + configurable: false +}); + +try { + Object.defineProperties(arg, { + "genericProperty": { + configurable: true + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyWritable(arg, "genericProperty", "genericPropertyString"); + + verifyNotEnumerable(arg, "genericProperty"); + + verifyNotConfigurable(arg, "genericProperty"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-314.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-314.js new file mode 100644 index 0000000000..4c383c5b80 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-314.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-314 +description: > + Object.defineProperties - 'O' is an Arguments object, 'name' is + own property of [[ParameterMap]] of 'O', test 'name' is deleted if + 'name' is configurable and 'desc' is accessor descriptor (10.6 + [[DefineOwnProperty]] step 5.a.i) +---*/ + +var arg = (function() { + return arguments; +}(1, 2, 3)); +var accessed = false; + +Object.defineProperties(arg, { + "0": { + get: function() { + accessed = true; + return 12; + } + } +}); + +assert.sameValue(arg[0], 12, 'arg[0]'); +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-32.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-32.js new file mode 100644 index 0000000000..f87162d8b9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-32.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-32 +description: > + Object.defineProperties - 'desc' is generic descriptor without any + attribute, test 'P' is defined in 'obj' with all default attribute + values (8.12.9 step 4.a.i) +---*/ + +var obj = {}; + +Object.defineProperties(obj, { + prop: {} +}); + +var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + +assert(desc.hasOwnProperty("value"), 'desc.hasOwnProperty("value") !== true'); +assert.sameValue(typeof desc.value, "undefined", 'typeof desc.value'); +assert(desc.hasOwnProperty("writable"), 'desc.hasOwnProperty("writable") !== true'); +assert.sameValue(desc.writable, false, 'desc.writable'); +assert(desc.hasOwnProperty("configurable"), 'desc.hasOwnProperty("configurable") !== true'); +assert.sameValue(desc.configurable, false, 'desc.configurable'); +assert(desc.hasOwnProperty("enumerable"), 'desc.hasOwnProperty("enumerable") !== true'); +assert.sameValue(desc.enumerable, false, 'desc.enumerable'); +assert.sameValue(desc.hasOwnProperty("get"), false, 'desc.hasOwnProperty("get")'); +assert.sameValue(desc.hasOwnProperty("set"), false, 'desc.hasOwnProperty("set")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-33.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-33.js new file mode 100644 index 0000000000..c1c992a90d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-33.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-33 +description: > + Object.defineProperties - 'P' doesn't exist in 'O', test [[Get]] + of 'P' is set as undefined value if absent in accessor descriptor + 'desc' (8.12.9 step 4.b) +includes: [propertyHelper.js] +---*/ + +var obj = {}; +var setFun = function(value) { + obj.setVerifyHelpProp = value; +}; + +Object.defineProperties(obj, { + prop: { + set: setFun, + enumerable: true, + configurable: true + } +}); +verifyWritable(obj, "prop", "setVerifyHelpProp"); + +verifyEnumerable(obj, "prop"); + +verifyConfigurable(obj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-34.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-34.js new file mode 100644 index 0000000000..1ff7ac58bd --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-34.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-34 +description: > + Object.defineProperties - 'P' doesn't exist in 'O', test [[Set]] + of 'P' is set as undefined value if absent in accessor descriptor + 'desc' (8.12.9 step 4.b.i) +---*/ + +var obj = {}; +var getFunc = function() { + return 10; +}; + +Object.defineProperties(obj, { + prop: { + get: getFunc, + enumerable: true, + configurable: true + } +}); + +var desc = Object.getOwnPropertyDescriptor(obj, "prop"); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(typeof(desc.set), "undefined", 'typeof (desc.set)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-35.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-35.js new file mode 100644 index 0000000000..5ec06c05ef --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-35.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-35 +description: > + Object.defineProperties - 'P' doesn't exist in 'O', test + [[Enumerable]] of 'P' is set as false value if absent in accessor + descriptor 'desc' (8.12.9 step 4.b.i) +includes: [propertyHelper.js] +---*/ + +var obj = {}; +var getFun = function() { + return 10; +}; +var setFun = function(value) { + obj.setVerifyHelpProp = value; +}; + +Object.defineProperties(obj, { + prop: { + set: setFun, + get: getFun, + configurable: true + } +}); +verifyEqualTo(obj, "prop", getFun()); + +verifyWritable(obj, "prop", "setVerifyHelpProp"); + +verifyNotEnumerable(obj, "prop"); + +verifyConfigurable(obj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-36.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-36.js new file mode 100644 index 0000000000..cd1476eaea --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-36.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-36 +description: > + Object.defineProperties - 'P' doesn't exist in 'O', test + [[Configurable]] of 'P' is set as false value if absent in + accessor descriptor 'desc' (8.12.9 step 4.b.i) +includes: [propertyHelper.js] +---*/ + +var obj = {}; +var getFun = function() { + return 10; +}; +var setFun = function(value) { + obj.setVerifyHelpProp = value; +}; + +Object.defineProperties(obj, { + prop: { + set: setFun, + get: getFun, + enumerable: true + } +}); + +verifyEqualTo(obj, "prop", 10); + +verifyWritable(obj, "prop", "setVerifyHelpProp"); + +verifyEnumerable(obj, "prop"); + +verifyNotConfigurable(obj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-37.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-37.js new file mode 100644 index 0000000000..afdb5a5709 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-37.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-37 +description: > + Object.defineProperties - 'desc' is accessor descriptor, test + setting all attribute values of 'P' (8.12.9 step 4.b.i) +includes: [propertyHelper.js] +---*/ + +var obj = {}; +var getFun = function() { + return 10; +}; +var setFun = function(value) { + obj.setVerifyHelpProp = value; +}; + +Object.defineProperties(obj, { + prop: { + get: getFun, + set: setFun, + enumerable: false, + configurable: false + } +}); +verifyEqualTo(obj, "prop", getFun()); + +verifyWritable(obj, "prop", "setVerifyHelpProp"); + +verifyNotEnumerable(obj, "prop"); + +verifyNotConfigurable(obj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-38-1.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-38-1.js new file mode 100644 index 0000000000..97d92d286c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-38-1.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-38-1 +description: > + Object.defineProperties - 'P' exists in 'O' is an accessor + property, test 'P' makes no change if 'desc' is generic descriptor + without any attribute (8.12.9 step 5) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; +var getFunc = function() { + return 12; +}; +Object.defineProperties(obj, { + foo: { + get: getFunc, + enumerable: true, + configurable: true + } +}); + +Object.defineProperties(obj, { + foo: {} +}); + +verifyEqualTo(obj, "foo", getFunc()); + +verifyEnumerable(obj, "foo"); + +verifyConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-38.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-38.js new file mode 100644 index 0000000000..d687d6345e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-38.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-38 +description: > + Object.defineProperties - 'P' exists in 'O', test 'P' makes no + change if 'desc' is generic descriptor without any attribute + (8.12.9 step 5) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; +obj.foo = 100; // default value of attributes: writable: true, configurable: true, enumerable: true + +Object.defineProperties(obj, { + foo: {} +}); +verifyEqualTo(obj, "foo", 100); + +verifyWritable(obj, "foo"); + +verifyEnumerable(obj, "foo"); + +verifyConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-39.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-39.js new file mode 100644 index 0000000000..54c402d74f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-39.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-39 +description: > + Object.defineProperties - 'P' is data descriptor and every fields + in 'desc' is the same with 'P' (8.12.9 step 6) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +obj.foo = 101; // default value of attributes: writable: true, configurable: true, enumerable: true + +Object.defineProperties(obj, { + foo: { + value: 101, + enumerable: true, + writable: true, + configurable: true + } +}); +verifyEqualTo(obj, "foo", 101); + +verifyWritable(obj, "foo"); + +verifyEnumerable(obj, "foo"); + +verifyConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-4.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-4.js new file mode 100644 index 0000000000..988c1c7057 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-4.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-4 +description: > + Object.defineProperties - 'P' is own data property that overrides + an inherited accessor property (8.12.9 step 1 ) +---*/ + +var proto = {}; +Object.defineProperty(proto, "prop", { + get: function() { + return 11; + }, + configurable: true +}); +var Con = function() {}; +Con.prototype = proto; + +var obj = new Con(); +Object.defineProperty(obj, "prop", { + value: 12, + configurable: false +}); +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + prop: { + value: 13, + configurable: true + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-40.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-40.js new file mode 100644 index 0000000000..6c0d2f2c8a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-40.js @@ -0,0 +1,47 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-40 +description: > + Object.defineProperties - 'P' is accessor descriptor and every + fields in 'desc' is the same with 'P' (8.12.9 step 6) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +function get_func() { + return 0; +} + +function set_func(value) { + obj.setVerifyHelpProp = value; +} +var desc = { + get: get_func, + set: set_func, + enumerable: true, + configurable: true +}; + +Object.defineProperty(obj, "foo", desc); + +Object.defineProperties(obj, { + foo: { + get: get_func, + set: set_func, + enumerable: true, + configurable: true + } +}); +verifyEqualTo(obj, "foo", get_func()); + +verifyWritable(obj, "foo", "setVerifyHelpProp"); + +verifyEnumerable(obj, "foo"); + +verifyConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-41.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-41.js new file mode 100644 index 0000000000..f7d9be5dc4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-41.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-41 +description: > + Object.defineProperties - type of desc.value is different from + type of P.value (8.12.9 step 6) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +obj.foo = 101; // default value of attributes: writable: true, configurable: true, enumerable: true + +Object.defineProperties(obj, { + foo: { + value: "102" + } +}); +verifyEqualTo(obj, "foo", "102"); + +verifyWritable(obj, "foo"); + +verifyEnumerable(obj, "foo"); + +verifyConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-42.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-42.js new file mode 100644 index 0000000000..26da7ca748 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-42.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-42 +description: > + Object.defineProperties - both desc.value and P.value are + undefined (8.12.9 step 6) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +var desc = { + value: undefined +}; +Object.defineProperty(obj, "foo", desc); + +Object.defineProperties(obj, { + foo: { + value: undefined + } +}); +verifyEqualTo(obj, "foo", undefined); + +verifyNotWritable(obj, "foo"); + +verifyNotEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-43.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-43.js new file mode 100644 index 0000000000..f31e75dbed --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-43.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-43 +description: > + Object.defineProperties - both desc.value and P.value are null + (8.12.9 step 6) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +var desc = { + value: null +}; +Object.defineProperty(obj, "foo", desc); + +Object.defineProperties(obj, { + foo: { + value: null + } +}); +verifyEqualTo(obj, "foo", null); + +verifyNotWritable(obj, "foo"); + +verifyNotEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-44.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-44.js new file mode 100644 index 0000000000..ce699a71b2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-44.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-44 +description: > + Object.defineProperties - both desc.value and P.value are NaN + (8.12.9 step 6) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +var desc = { + value: NaN +}; +Object.defineProperty(obj, "foo", desc); + +Object.defineProperties(obj, { + foo: { + value: NaN + } +}); + +verifyNotEnumerable(obj, "foo"); +verifyNotWritable(obj, "foo"); +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-45.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-45.js new file mode 100644 index 0000000000..5738385a85 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-45.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-45 +description: > + Object.defineProperties - desc.value is +0 and P.value is -0 + (8.12.9 step 6) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +var desc = { + value: -0 +}; +Object.defineProperty(obj, "foo", desc); + +try { + Object.defineProperties(obj, { + foo: { + value: +0 + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(obj, "foo", -0); + + verifyNotWritable(obj, "foo"); + + verifyNotEnumerable(obj, "foo"); + + verifyNotConfigurable(obj, "foo"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-46.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-46.js new file mode 100644 index 0000000000..5b7397c87e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-46.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-46 +description: > + Object.defineProperties - desc.value is -0 and P.value is +0 + (8.12.9 step 6) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +var desc = { + value: +0 +}; +Object.defineProperty(obj, "foo", desc); + +try { + Object.defineProperties(obj, { + foo: { + value: -0 + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(obj, "foo", +0); + + verifyNotWritable(obj, "foo"); + + verifyNotEnumerable(obj, "foo"); + + verifyNotConfigurable(obj, "foo"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-47.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-47.js new file mode 100644 index 0000000000..3cbc638a8b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-47.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-47 +description: > + Object.defineProperties - desc.value and P.value are two numbers + with the same value (8.12.9 step 6) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +var desc = { + value: 101 +}; +Object.defineProperty(obj, "foo", desc); + +Object.defineProperties(obj, { + foo: { + value: 101 + } +}); +verifyEqualTo(obj, "foo", 101); + +verifyNotWritable(obj, "foo"); + +verifyNotEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-48.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-48.js new file mode 100644 index 0000000000..b3de13ed9d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-48.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-48 +description: > + Object.defineProperties - desc.value and P.value are two numbers + with different values (8.12.9 step 6) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +obj.foo = 101; // default value of attributes: writable: true, configurable: true, enumerable: true + +Object.defineProperties(obj, { + foo: { + value: 102 + } +}); +verifyEqualTo(obj, "foo", 102); + +verifyWritable(obj, "foo"); + +verifyEnumerable(obj, "foo"); + +verifyConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-49.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-49.js new file mode 100644 index 0000000000..5cb4ac2df9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-49.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-49 +description: > + Object.defineProperties - both desc.value and P.value are two + strings which have same length and same characters in + corresponding positions (8.12.9 step 6) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +var desc = { + value: "abcd" +}; +Object.defineProperty(obj, "foo", desc); + +Object.defineProperties(obj, { + foo: { + value: "abcd" + } +}); +verifyEqualTo(obj, "foo", "abcd"); + +verifyNotWritable(obj, "foo"); + +verifyNotEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-5.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-5.js new file mode 100644 index 0000000000..5893ad38d2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-5.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-5 +description: > + Object.defineProperties - 'P' is own accessor property (8.12.9 + step 1 ) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +function getFunc() { + return 11; +} + +Object.defineProperty(obj, "prop", { + get: getFunc, + configurable: false +}); + +try { + Object.defineProperties(obj, { + prop: { + value: 12, + configurable: true + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(obj, "prop", getFunc()); + + verifyNotEnumerable(obj, "prop"); + + verifyNotConfigurable(obj, "prop"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-50.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-50.js new file mode 100644 index 0000000000..c4459a802e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-50.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-50 +description: > + Object.defineProperties - desc.value and P.value are two strings + with different values (8.12.9 step 6) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +obj.foo = "abcd"; // default value of attributes: writable: true, configurable: true, enumerable: true + +Object.defineProperties(obj, { + foo: { + value: "fghj" + } +}); +verifyEqualTo(obj, "foo", "fghj"); + +verifyWritable(obj, "foo"); + +verifyEnumerable(obj, "foo"); + +verifyConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-51.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-51.js new file mode 100644 index 0000000000..eaeb92e3c7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-51.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-51 +description: > + Object.defineProperties - both desc.value and P.value are boolean + values with the same value (8.12.9 step 6) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +var desc = { + value: true +}; +Object.defineProperty(obj, "foo", desc); + +Object.defineProperties(obj, { + foo: { + value: true + } +}); +verifyEqualTo(obj, "foo", true); + +verifyNotWritable(obj, "foo"); + +verifyNotEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-52.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-52.js new file mode 100644 index 0000000000..294565851e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-52.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-52 +description: > + Object.defineProperties - desc.value and P.value are two boolean + values with different values (8.12.9 step 6) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +obj.foo = true; // default value of attributes: writable: true, configurable: true, enumerable: true + +Object.defineProperties(obj, { + foo: { + value: false + } +}); +verifyEqualTo(obj, "foo", false); + +verifyWritable(obj, "foo"); + +verifyEnumerable(obj, "foo"); + +verifyConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-53.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-53.js new file mode 100644 index 0000000000..47a8e4d761 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-53.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-53 +description: > + Object.defineProperties - both desc.value and P.value are Ojbects + which refer to the same Object (8.12.9 step 6) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +var obj1 = { + length: 10 +}; +var desc = { + value: obj1 +}; +Object.defineProperty(obj, "foo", desc); + +Object.defineProperties(obj, { + foo: { + value: obj1 + } +}); +verifyEqualTo(obj, "foo", obj1); + +verifyNotWritable(obj, "foo"); + +verifyNotEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-54.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-54.js new file mode 100644 index 0000000000..0c154f563f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-54.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-54 +description: > + Object.defineProperties - desc.value and P.value are two Ojbects + which refer to the different objects (8.12.9 step 6) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +var obj1 = { + length: 10 +}; +obj.foo = obj1; // default value of attributes: writable: true, configurable: true, enumerable: true + +var obj2 = { + length: 20 +}; + +Object.defineProperties(obj, { + foo: { + value: obj2 + } +}); +verifyEqualTo(obj, "foo", obj2); + +verifyWritable(obj, "foo"); + +verifyEnumerable(obj, "foo"); + +verifyConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-55.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-55.js new file mode 100644 index 0000000000..3db7ea5160 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-55.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-55 +description: > + Object.defineProperties - both desc.writable and P.writable are + boolean values with the same value (8.12.9 step 6) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +var desc = { + writable: false +}; +Object.defineProperty(obj, "foo", desc); + +Object.defineProperties(obj, { + foo: { + writable: false + } +}); +verifyEqualTo(obj, "foo", undefined); + +verifyNotWritable(obj, "foo"); + +verifyNotEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-56.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-56.js new file mode 100644 index 0000000000..c5e8d07b24 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-56.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-56 +description: > + Object.defineProperties - desc.writable and P.writable are two + boolean values with different values (8.12.9 step 6) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +var desc = { + writable: false, + configurable: true +}; +Object.defineProperty(obj, "foo", desc); + +Object.defineProperties(obj, { + foo: { + writable: true, + configurable: true + } +}); +verifyEqualTo(obj, "foo", undefined); + +verifyWritable(obj, "foo"); + +verifyNotEnumerable(obj, "foo"); + +verifyConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-57.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-57.js new file mode 100644 index 0000000000..07a9774921 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-57.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-57 +description: > + Object.defineProperties - both desc.[[Get]] and P.[[Get]] are two + objects which refer to the same object (8.12.9 step 6) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +function get_Func() { + return 10; +} + +Object.defineProperty(obj, "foo", { + get: get_Func +}); + +Object.defineProperties(obj, { + foo: { + get: get_Func + } +}); + +verifyNotEnumerable(obj, "foo"); +assert.sameValue(obj.foo, 10); + +verifyNotConfigurable(obj, "foo") + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-58.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-58.js new file mode 100644 index 0000000000..c774825fb6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-58.js @@ -0,0 +1,54 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-58 +description: > + Object.defineProperties - desc.[[Get]] and P.[[Get]] are two + objects which refer to the different objects (8.12.9 step 6) +---*/ + +var obj = {}; + +function get_Func1() { + return 10; +} + +Object.defineProperty(obj, "foo", { + get: get_Func1, + configurable: true +}); + +function get_Func2() { + return 20; +} + +Object.defineProperties(obj, { + foo: { + get: get_Func2 + } +}); + +var verifyEnumerable = false; +for (var p in obj) { + if (p === "foo") { + verifyEnumerable = true; + } +} + +var verifyValue = false; +verifyValue = (obj.foo === 20); + +var desc = Object.getOwnPropertyDescriptor(obj, "foo"); + +var verifyConfigurable = false; +delete obj.foo; +verifyConfigurable = obj.hasOwnProperty("foo"); + +assert.sameValue(verifyConfigurable, false, 'verifyConfigurable'); +assert.sameValue(verifyEnumerable, false, 'verifyEnumerable'); +assert(verifyValue, 'verifyValue !== true'); +assert.sameValue(typeof(desc.set), "undefined", 'typeof (desc.set)'); +assert.sameValue(desc.get, get_Func2, 'desc.get'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-59.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-59.js new file mode 100644 index 0000000000..55f0b6e98b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-59.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-59 +description: > + Object.defineProperties - both desc.[[Set]] and P.[[Set]] are two + objects which refer to the same object (8.12.9 step 6) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +function set_func(value) { + obj.setVerifyHelpProp = value; +} + +Object.defineProperty(obj, "foo", { + set: set_func +}); + +Object.defineProperties(obj, { + foo: { + set: set_func + } +}); +verifyWritable(obj, "foo", "setVerifyHelpProp"); + +verifyNotEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-6.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-6.js new file mode 100644 index 0000000000..d876cc955d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-6.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-6 +description: > + Object.defineProperties - 'P' is inherited accessor property + (8.12.9 step 1 ) +---*/ + +var proto = {}; +Object.defineProperty(proto, "prop", { + get: function() { + return 11; + }, + configurable: false +}); +var Con = function() {}; +Con.prototype = proto; + +var obj = new Con(); + +Object.defineProperties(obj, { + prop: { + get: function() { + return 12; + }, + configurable: true + } +}); + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(obj.prop, 12, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-60.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-60.js new file mode 100644 index 0000000000..18b3b08eff --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-60.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-60 +description: > + Object.defineProperties - desc.[[Set]] and P.[[Set]] are two + objects which refer to the different objects (8.12.9 step 6) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +function set_func1() {} + +Object.defineProperty(obj, "foo", { + set: set_func1, + configurable: true +}); + +function set_func2(value) { + obj.setVerifyHelpProp = value; +} + +Object.defineProperties(obj, { + foo: { + set: set_func2 + } +}); +verifyWritable(obj, "foo", "setVerifyHelpProp"); + +verifyNotEnumerable(obj, "foo"); + +verifyConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-61.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-61.js new file mode 100644 index 0000000000..d6b97792f2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-61.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-61 +description: > + Object.defineProperties - both desc.enumerable and P.enumerable + are boolean values with the same value (8.12.9 step 6) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: 10, + enumerable: false +}); + +Object.defineProperties(obj, { + foo: { + enumerable: false + } +}); +verifyEqualTo(obj, "foo", 10); + +verifyNotWritable(obj, "foo"); + +verifyNotEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-62.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-62.js new file mode 100644 index 0000000000..66707f734d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-62.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-62 +description: > + Object.defineProperties - desc.enumerable and P.enumerable are two + boolean values with different values (8.12.9 step 6) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: 10, + enumerable: false, + configurable: true +}); + +Object.defineProperties(obj, { + foo: { + enumerable: true + } +}); +verifyEqualTo(obj, "foo", 10); + +verifyNotWritable(obj, "foo"); + +verifyEnumerable(obj, "foo"); + +verifyConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-63.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-63.js new file mode 100644 index 0000000000..d6bfa302ff --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-63.js @@ -0,0 +1,34 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-63 +description: > + Object.defineProperties - both desc.configurable and + P.configurable are boolean values with the same value (8.12.9 step + 6) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: 10, + configurable: false +}); + +Object.defineProperties(obj, { + foo: { + configurable: false + } +}); +verifyEqualTo(obj, "foo", 10); + +verifyNotWritable(obj, "foo"); + +verifyNotEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-64.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-64.js new file mode 100644 index 0000000000..fe97b64dd8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-64.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-64 +description: > + Object.defineProperties - desc.configurable and P.configurable are + two boolean values with different values (8.12.9 step 6) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: 10, + configurable: true +}); + +Object.defineProperties(obj, { + foo: { + configurable: false + } +}); +verifyEqualTo(obj, "foo", 10); + +verifyNotWritable(obj, "foo"); + +verifyNotEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-65.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-65.js new file mode 100644 index 0000000000..c6678316fc --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-65.js @@ -0,0 +1,42 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-65 +description: > + Object.defineProperties throws TypeError when P.configurable is + false and desc.configurable is true (8.12.9 step 7.a) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: 10, + configurable: false +}); + +try { + Object.defineProperties(obj, { + foo: { + configurable: true + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(obj, "foo", 10); + + verifyNotWritable(obj, "foo"); + + verifyNotEnumerable(obj, "foo"); + + verifyNotConfigurable(obj, "foo"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-66-1.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-66-1.js new file mode 100644 index 0000000000..dd97034520 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-66-1.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-66-1 +description: > + Object.defineProperties throws TypeError when P.configurable is + false, P.enumerable and desc.enumerable has different values + (8.12.9 step 7.b) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: 10, + enumerable: false, + configurable: false +}); + +try { + Object.defineProperties(obj, { + foo: { + enumerable: true + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(obj, "foo", 10); + + verifyNotWritable(obj, "foo"); + + verifyNotEnumerable(obj, "foo"); + + verifyNotConfigurable(obj, "foo"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-66.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-66.js new file mode 100644 index 0000000000..6c1a70521e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-66.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-66 +description: > + Object.defineProperties throws TypeError when P.configurable is + false, P.enumerable and desc.enumerable has different values + (8.12.9 step 7.b) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: 10, + enumerable: true, + configurable: false +}); + +try { + Object.defineProperties(obj, { + foo: { + enumerable: false + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(obj, "foo", 10); + + verifyNotWritable(obj, "foo"); + + verifyEnumerable(obj, "foo"); + + verifyNotConfigurable(obj, "foo"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-67.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-67.js new file mode 100644 index 0000000000..3980343982 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-67.js @@ -0,0 +1,46 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-67 +description: > + Object.defineProperties throws TypeError when P is accessor + property and P.configurable is false, desc is data property + (8.12.9 step 9.a) +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +function get_Func() { + return 10; +} + +Object.defineProperty(obj, "foo", { + get: get_Func, + configurable: false +}); + +try { + Object.defineProperties(obj, { + foo: { + value: 11 + } + }); + + throw new Test262Error("Expected TypeError"); +} catch (e) { + assert(e instanceof TypeError); + verifyNotEnumerable(obj, "foo"); + + assert.sameValue(obj.foo, 10); + + verifyNotConfigurable(obj, "foo"); + + var desc = Object.getOwnPropertyDescriptor(obj, "foo"); + + assert.sameValue(typeof(desc.set), "undefined"); + assert.sameValue(desc.get, get_Func); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-68.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-68.js new file mode 100644 index 0000000000..c2581e46bf --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-68.js @@ -0,0 +1,47 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-68 +description: > + Object.defineProperties throws TypeError when P is data property + and P.configurable is false, desc is accessor property (8.12.9 + step 9.a) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: 10, + configurable: false +}); + +function get_func() { + return 11; +} + +try { + Object.defineProperties(obj, { + foo: { + get: get_func + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(obj, "foo", 10); + + verifyNotWritable(obj, "foo"); + + verifyNotEnumerable(obj, "foo"); + + verifyNotConfigurable(obj, "foo"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-69.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-69.js new file mode 100644 index 0000000000..16f5527999 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-69.js @@ -0,0 +1,50 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-69 +description: > + Object.defineProperties - 'P' is data property and P.configurable + is true, desc is accessor property (8.12.9 step 9.b.i) +---*/ + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: 10, + configurable: true +}); + +function get_Func() { + return 20; +} + +Object.defineProperties(obj, { + foo: { + get: get_Func + } +}); + +var verifyEnumerable = false; +for (var p in obj) { + if (p === "foo") { + verifyEnumerable = true; + } +} + +var verifyValue = false; +verifyValue = (obj.foo === 20); + +var desc = Object.getOwnPropertyDescriptor(obj, "foo"); + +var verifyConfigurable = true; +delete obj.foo; +verifyConfigurable = obj.hasOwnProperty("foo"); + +assert.sameValue(verifyConfigurable, false, 'verifyConfigurable'); +assert.sameValue(verifyEnumerable, false, 'verifyEnumerable'); +assert(verifyValue, 'verifyValue !== true'); +assert.sameValue(typeof desc.set, "undefined", 'typeof desc.set'); +assert.sameValue(desc.get, get_Func, 'desc.get'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-7.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-7.js new file mode 100644 index 0000000000..168b38a2d8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-7.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-7 +description: > + Object.defineProperties - 'P' is own accessor property that + overrides an inherited data property (8.12.9 step 1 ) +---*/ + +var proto = {}; +Object.defineProperty(proto, "prop", { + value: 11, + configurable: true +}); +var Con = function() {}; +Con.prototype = proto; + +var obj = new Con(); +Object.defineProperty(obj, "prop", { + get: function() { + return 12; + }, + configurable: false +}); +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + prop: { + value: 13, + configurable: true + } + }); +}); +assert.sameValue(obj.prop, 12, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-70.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-70.js new file mode 100644 index 0000000000..2c19545d04 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-70.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-70 +description: > + Object.defineProperties - 'P' is accessor property and + P.configurable is true, 'desc' in 'Properties' is data property + (8.12.9 step 9.c.i) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +function get_func() { + return 10; +} + +Object.defineProperty(obj, "foo", { + get: get_func, + configurable: true +}); + +Object.defineProperties(obj, { + foo: { + value: 12 + } +}); +verifyEqualTo(obj, "foo", 12); + +verifyNotWritable(obj, "foo"); + +verifyNotEnumerable(obj, "foo"); + +verifyConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-71.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-71.js new file mode 100644 index 0000000000..6be29229ee --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-71.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-71 +description: > + Object.defineProperties throws TypeError when 'P' is data property + and P.configurable is false, P.writable is false, desc is data + property and desc.writable is true (8.12.9 step 10.a.i) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: 10, + writable: false, + configurable: false +}); + +try { + Object.defineProperties(obj, { + foo: { + writable: true + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(obj, "foo", 10); + + verifyNotWritable(obj, "foo"); + + verifyNotEnumerable(obj, "foo"); + + verifyNotConfigurable(obj, "foo"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-72.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-72.js new file mode 100644 index 0000000000..3807bf9155 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-72.js @@ -0,0 +1,45 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-72 +description: > + Object.defineProperties throws TypeError when P is data property + and P.configurable is false, P.writable is false, desc is data + property and desc.value is not equal to P.value (8.12.9 step + 10.a.ii.1) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: 10, + writable: false, + configurable: false +}); + +try { + Object.defineProperties(obj, { + foo: { + value: 20 + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(obj, "foo", 10); + + verifyNotWritable(obj, "foo"); + + verifyNotEnumerable(obj, "foo"); + + verifyNotConfigurable(obj, "foo"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-73.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-73.js new file mode 100644 index 0000000000..ec98b17976 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-73.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-73 +description: > + Object.defineProperties will not throw TypeError if P.configurable + is false, P.writalbe is false, P.value is undefined and + properties.value is undefined (8.12.9 step 10.a.ii.1) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: undefined, + writable: false, + configurable: false +}); + +Object.defineProperties(obj, { + foo: { + value: undefined + } +}); +verifyEqualTo(obj, "foo", undefined); + +verifyNotWritable(obj, "foo"); + +verifyNotEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-74.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-74.js new file mode 100644 index 0000000000..7efeaf287a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-74.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-74 +description: > + Object.defineProperties will not throw TypeError if P.configurable + is false, P.writalbe is false, P.value is null and + properties.value is null (8.12.9 step 10.a.ii.1) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: null, + writable: false, + configurable: false +}); + +Object.defineProperties(obj, { + foo: { + value: null + } +}); +verifyEqualTo(obj, "foo", null); + +verifyNotWritable(obj, "foo"); + +verifyNotEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-75.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-75.js new file mode 100644 index 0000000000..a1fe2653ec --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-75.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-75 +description: > + Object.defineProperties will not throw TypeError if P.configurable + is false, P.writalbe is false, P.value is NaN and properties.value + is NaN (8.12.9 step 10.a.ii.1) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; +var accessed = false; + +Object.defineProperty(obj, "foo", { + value: NaN, + writable: false, + configurable: false +}); + +Object.defineProperties(obj, { + foo: { + value: NaN + } +}); + +verifyNotEnumerable(obj, "foo"); +verifyNotWritable(obj, "foo"); +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-76.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-76.js new file mode 100644 index 0000000000..1a1c1e02c0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-76.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-76 +description: > + Object.defineProperties throws TypeError when P.configurable is + false, P.writalbe is false, properties.value is +0 and P.value is + -0 (8.12.9 step 10.a.ii.1) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: -0, + writable: false, + configurable: false +}); + +try { + Object.defineProperties(obj, { + foo: { + value: +0 + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(obj, "foo", -0); + + verifyNotWritable(obj, "foo"); + + verifyNotEnumerable(obj, "foo"); + + verifyNotConfigurable(obj, "foo"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-77.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-77.js new file mode 100644 index 0000000000..4be63a9fc3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-77.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-77 +description: > + Object.defineProperties throws TypeError when P.configurable is + false, P.writalbe is false, properties.value is +0 and P.value is + -0 (8.12.9 step 10.a.ii.1) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: +0, + writable: false, + configurable: false +}); + +try { + Object.defineProperties(obj, { + foo: { + value: -0 + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(obj, "foo", +0); + + verifyNotWritable(obj, "foo"); + + verifyNotEnumerable(obj, "foo"); + + verifyNotConfigurable(obj, "foo"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-78.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-78.js new file mode 100644 index 0000000000..2752971e2e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-78.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-78 +description: > + Object.defineProperties will not throw TypeError when + P.configurable is false, P.writalbe is false, properties.value and + P.value are two numbers with the same value (8.12.9 step 10.a.ii.1) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: 100, + writable: false, + configurable: false +}); + +Object.defineProperties(obj, { + foo: { + value: 100 + } +}); +verifyEqualTo(obj, "foo", 100); + +verifyNotWritable(obj, "foo"); + +verifyNotEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-79.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-79.js new file mode 100644 index 0000000000..a6533a918c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-79.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-79 +description: > + Object.defineProperties throws TypeError when P.configurable is + false, P.writalbe is false, properties.value and P.value are two + numbers with different values (8.12.9 step 10.a.ii.1) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: 10, + writable: false, + configurable: false +}); + +try { + Object.defineProperties(obj, { + foo: { + value: 20 + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(obj, "foo", 10); + + verifyNotWritable(obj, "foo"); + + verifyNotEnumerable(obj, "foo"); + + verifyNotConfigurable(obj, "foo"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-8.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-8.js new file mode 100644 index 0000000000..d026b8b16a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-8.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-8 +description: > + Object.defineProperties - 'P' is own accessor property that + overrides an inherited accessor property (8.12.9 step 1 ) +---*/ + +var proto = {}; +Object.defineProperty(proto, "prop", { + get: function() { + return 11; + }, + configurable: true +}); +var Con = function() {}; +Con.prototype = proto; + +var obj = new Con(); +Object.defineProperty(obj, "prop", { + get: function() { + return 12; + }, + configurable: false +}); +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + prop: { + value: 13, + configurable: true + } + }); +}); +assert.sameValue(obj.prop, 12, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-80.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-80.js new file mode 100644 index 0000000000..a7b91fa17b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-80.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-80 +description: > + Object.defineProperties will not throw TypeError when + P.configurable is false, P.writalbe is false, properties.value and + P.value are two strings with the same value (8.12.9 step 10.a.ii.1) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: "abcd", + writable: false, + configurable: false +}); + +Object.defineProperties(obj, { + foo: { + value: "abcd" + } +}); +verifyEqualTo(obj, "foo", "abcd"); + +verifyNotWritable(obj, "foo"); + +verifyNotEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-81.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-81.js new file mode 100644 index 0000000000..a8b094a8e0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-81.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-81 +description: > + Object.defineProperties throws TypeError when P.configurable is + false, P.writalbe is false, properties.value and P.value are two + strings with different values (8.12.9 step 10.a.ii.1) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: "abcd", + writable: false, + configurable: false +}); + +try { + Object.defineProperties(obj, { + foo: { + value: "defg" + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(obj, "foo", "abcd"); + + verifyNotWritable(obj, "foo"); + + verifyNotEnumerable(obj, "foo"); + + verifyNotConfigurable(obj, "foo"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-82.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-82.js new file mode 100644 index 0000000000..e5d26c4acd --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-82.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-82 +description: > + Object.defineProperties will not throw TypeError when + P.configurable is false, P.writalbe is false, properties.value and + P.value are two booleans with the same value (8.12.9 step + 10.a.ii.1) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: false, + writable: false, + configurable: false +}); + +Object.defineProperties(obj, { + foo: { + value: false + } +}); +verifyEqualTo(obj, "foo", false); + +verifyNotWritable(obj, "foo"); + +verifyNotEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-83.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-83.js new file mode 100644 index 0000000000..7e69ae863b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-83.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-83 +description: > + Object.defineProperties throws TypeError when P.configurable is + false, P.writalbe is false, properties.value and P.value are two + booleans with different values (8.12.9 step 10.a.ii.1) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: false, + writable: false, + configurable: false +}); + +try { + Object.defineProperties(obj, { + foo: { + value: true + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(obj, "foo", false); + + verifyNotWritable(obj, "foo"); + + verifyNotEnumerable(obj, "foo"); + + verifyNotConfigurable(obj, "foo"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-84-1.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-84-1.js new file mode 100644 index 0000000000..19c54b3883 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-84-1.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-84-1 +description: > + Object.defineProperties will not throw TypeError when + P.configurable is false, P.writalbe is false, properties.value and + P.value are two Objects refer to the same object which has been + updated before use it to update the object (8.12.9 step 10.a.ii.1) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +var obj1 = { + length: 10 +}; + +Object.defineProperty(obj, "foo", { + value: obj1, + writable: false, + configurable: false +}); + +var obj2 = obj1; +obj2.y = "hello"; + +Object.defineProperties(obj, { + foo: { + value: obj2 + } +}); +verifyEqualTo(obj, "foo", obj1); + +verifyNotWritable(obj, "foo"); + +verifyNotEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-84.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-84.js new file mode 100644 index 0000000000..0edfc761a9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-84.js @@ -0,0 +1,40 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-84 +description: > + Object.defineProperties will not throw TypeError when + P.configurable is false, P.writalbe is false, properties.value and + P.value are two Objects refer to the same object (8.12.9 step + 10.a.ii.1) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +var obj1 = { + length: 10 +}; + +Object.defineProperty(obj, "foo", { + value: obj1, + writable: false, + configurable: false +}); + +Object.defineProperties(obj, { + foo: { + value: obj1 + } +}); +verifyEqualTo(obj, "foo", obj1); + +verifyNotWritable(obj, "foo"); + +verifyNotEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-85.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-85.js new file mode 100644 index 0000000000..f9b41a56a4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-85.js @@ -0,0 +1,52 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-85 +description: > + Object.defineProperties throws TypeError when P.configurable is + false, P.writalbe is false, properties.value and P.value are two + objects with different values (8.12.9 step 10.a.ii.1) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +var obj1 = { + length: 10 +}; + +Object.defineProperty(obj, "foo", { + value: obj1, + writable: false, + configurable: false +}); + +var obj2 = { + length: 20 +}; + +try { + Object.defineProperties(obj, { + foo: { + value: obj2 + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(obj, "foo", obj1); + + verifyNotWritable(obj, "foo"); + + verifyNotEnumerable(obj, "foo"); + + verifyNotConfigurable(obj, "foo"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-86-1.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-86-1.js new file mode 100644 index 0000000000..500986c18d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-86-1.js @@ -0,0 +1,49 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-86-1 +description: > + Object.defineProperties will not throw TypeError when + P.configurable is false, both properties.[[Set]] and P.[[Set]] are + two objects which refer to the same object and the object has been + updated after defined(8.12.9 step 11.a.i) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +var set_func = function(value) { + obj.setVerifyHelpProp = value; +}; + +Object.defineProperty(obj, "foo", { + set: set_func, + configurable: false +}); + +set_func = function(value) { + obj.setVerifyHelpProp1 = value; +}; + +try { + Object.defineProperties(obj, { + foo: { + set: set_func + } + }); +} catch (e) { + verifyWritable(obj, "foo", "setVerifyHelpProp"); + + verifyNotEnumerable(obj, "foo"); + + verifyNotConfigurable(obj, "foo"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-86.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-86.js new file mode 100644 index 0000000000..a6f109dabd --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-86.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-86 +description: > + Object.defineProperties will not throw TypeError when + P.configurable is false, both properties.[[Set]] and P.[[Set]] are + two objects which refer to the same object (8.12.9 step 11.a.i) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +function set_func(value) { + obj.setVerifyHelpProp = value; +} + +Object.defineProperty(obj, "foo", { + set: set_func, + configurable: false +}); + +Object.defineProperties(obj, { + foo: { + set: set_func + } +}); +verifyWritable(obj, "foo", "setVerifyHelpProp"); + +verifyNotEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-87.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-87.js new file mode 100644 index 0000000000..f1cee12ac7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-87.js @@ -0,0 +1,47 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-87 +description: > + Object.defineProperties throws TypeError when P.configurable is + false, both properties.[[Set]] and P.[[Set]] are two objects which + refer to different objects (8.12.9 step 11.a.i) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +function set_func1(value) { + obj.setVerifyHelpProp = value; +} + +Object.defineProperty(obj, "foo", { + set: set_func1, + configurable: false +}); + +function set_func2() {} + +try { + Object.defineProperties(obj, { + foo: { + set: set_func2 + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyWritable(obj, "foo", "setVerifyHelpProp"); + + verifyNotEnumerable(obj, "foo"); + + verifyNotConfigurable(obj, "foo"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-88.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-88.js new file mode 100644 index 0000000000..12de5bbe14 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-88.js @@ -0,0 +1,53 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-88 +description: > + Object.defineProperties throws TypeError when P.configurable is + false, P.[[Set]] is undefined, properties.[[Set]] refers to an + object (8.12.9 step 11.a.i) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +function get_Func() { + return 0; +} + +Object.defineProperty(obj, "foo", { + set: undefined, + get: get_Func, + enumerable: false, + configurable: false +}); + +function set_Func() {} + +try { + Object.defineProperties(obj, { + foo: { + set: set_Func + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyNotEnumerable(obj, "foo"); + + verifyNotConfigurable(obj, "foo"); + var desc = Object.getOwnPropertyDescriptor(obj, "foo"); + + if (typeof(desc.set) !== "undefined") { + throw new Test262Error('Expected typeof (desc.set) === "undefined", actually ' + typeof(desc.set)); + } + + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-89.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-89.js new file mode 100644 index 0000000000..ae7c1d6aa4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-89.js @@ -0,0 +1,43 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-89 +description: > + Object.defineProperties will not throw TypeError when + P.configurable is false, P.[[Set]] and properties.[[Set]] are + undefined (8.12.9 step 11.a.i) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +function get_Func() { + return 0; +} + +Object.defineProperty(obj, "foo", { + get: get_Func, + set: undefined, + enumerable: false, + configurable: false +}); + +Object.defineProperties(obj, { + foo: { + set: undefined + } +}); + +verifyNotEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +var desc = Object.getOwnPropertyDescriptor(obj, "foo"); + +if (typeof(desc.set) !== "undefined") { + throw new Test262Error('Expected typeof (desc.set) === "undefined", actually ' + typeof(desc.set)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-9.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-9.js new file mode 100644 index 0000000000..30c089dbc0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-9.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-9 +description: > + Object.defineProperties - 'P' is own accessor property without a + get function (8.12.9 step 1 ) +---*/ + +var obj = {}; +Object.defineProperty(obj, "prop", { + set: function() {}, + configurable: false +}); +assert.throws(TypeError, function() { + Object.defineProperties(obj, { + prop: { + get: function() {}, + configurable: true + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-90.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-90.js new file mode 100644 index 0000000000..4a7b37c5b0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-90.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-90 +description: > + Object.defineProperties will not throw TypeError when + P.configurable is false, both properties.[[Get]] and P.[[Get]] are + two objects which refer to the same object (8.12.9 step 11.a.ii) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +function set_func(value) { + obj.setVerifyHelpProp = value; +} + +function get_func() { + return 10; +} + +Object.defineProperty(obj, "foo", { + get: get_func, + set: set_func, + enumerable: false, + configurable: false +}); + +Object.defineProperties(obj, { + foo: { + get: get_func + } +}); +verifyEqualTo(obj, "foo", get_func()); + +verifyWritable(obj, "foo", "setVerifyHelpProp"); + +verifyNotEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-91.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-91.js new file mode 100644 index 0000000000..77f1b0a61c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-91.js @@ -0,0 +1,57 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-91 +description: > + Object.defineProperties throws TypeError when P.configurable is + false, both properties.[[Get]] and P.[[Get]] are two objects which + refer to different objects (8.12.9 step 11.a.ii) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +function set_func(value) { + obj.setVerifyHelpProp = value; +} + +function get_func1() { + return 10; +} + +Object.defineProperty(obj, "foo", { + get: get_func1, + set: set_func, + enumerable: false, + configurable: false +}); + +function get_func2() { + return 20; +} + +try { + Object.defineProperties(obj, { + foo: { + get: get_func2 + } + }); + throw new Test262Error("Expected an exception"); +} catch (e) { + verifyEqualTo(obj, "foo", get_func1()); + + verifyWritable(obj, "foo", "setVerifyHelpProp"); + + verifyNotEnumerable(obj, "foo"); + + verifyNotConfigurable(obj, "foo"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-92.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-92.js new file mode 100644 index 0000000000..8a79bf19b1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-92.js @@ -0,0 +1,51 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-92 +description: > + Object.defineProperties throws TypeError when P.configurable is + false, P.[[Get]] is undefined, properties.[[Get]] refers to an + objcet (8.12.9 step 11.a.ii) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +function set_func(value) { + obj.setVerifyHelpProp = value; +} + +Object.defineProperty(obj, "foo", { + get: undefined, + set: set_func, + enumerable: false, + configurable: false +}); + +function get_func() { + return 0; +} + +try { + Object.defineProperties(obj, { + foo: { + get: get_func + } + }); + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyWritable(obj, "foo", "setVerifyHelpProp"); + + verifyNotEnumerable(obj, "foo"); + + verifyNotConfigurable(obj, "foo"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-93-1.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-93-1.js new file mode 100644 index 0000000000..14f8f294c5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-93-1.js @@ -0,0 +1,62 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-93-1 +description: > + Object.defineProperties will update [[Value]] attribute of named + data property 'P' successfully when [[Configurable]] attribute is + true and [[Writable]] attribute is false but not when both are + false (8.12.9 - step Note & 10.a.ii.1) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "property", { + value: 1001, + writable: false, + configurable: true +}); + +Object.defineProperty(obj, "property1", { + value: 1003, + writable: false, + configurable: false +}); + +try { + Object.defineProperties(obj, { + property: { + value: 1002 + }, + property1: { + value: 1004 + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(obj, "property", 1002); + + verifyNotWritable(obj, "property"); + + verifyNotEnumerable(obj, "property"); + + verifyConfigurable(obj, "property"); + verifyEqualTo(obj, "property1", 1003); + + verifyNotWritable(obj, "property1"); + + verifyNotEnumerable(obj, "property1"); + + verifyNotConfigurable(obj, "property1"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-93-2.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-93-2.js new file mode 100644 index 0000000000..3426413f72 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-93-2.js @@ -0,0 +1,62 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-93-2 +description: > + Object.defineProperties will update [[Value]] attribute of indexed + data property 'P' successfully when [[Configurable]] attribute is + true and [[Writable]] attribute is false but not when both are + false (8.12.9 - step Note & 10.a.ii.1) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "0", { + value: 1001, + writable: false, + configurable: true +}); + +Object.defineProperty(obj, "1", { + value: 1003, + writable: false, + configurable: false +}); + +try { + Object.defineProperties(obj, { + 0: { + value: 1002 + }, + 1: { + value: 1004 + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(obj, "0", 1002); + + verifyNotWritable(obj, "0"); + + verifyNotEnumerable(obj, "0"); + + verifyConfigurable(obj, "0"); + verifyEqualTo(obj, "1", 1003); + + verifyNotWritable(obj, "1"); + + verifyNotEnumerable(obj, "1"); + + verifyNotConfigurable(obj, "1"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-93-3.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-93-3.js new file mode 100644 index 0000000000..927d25a004 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-93-3.js @@ -0,0 +1,62 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-93-3 +description: > + Object.defineProperties will fail to update [[Value]] attribute of + named data property 'P' when [[Configurable]] attribute of first + updating property is false (8.12.9 - step Note & 10.a.ii.1) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "property", { + value: 1001, + writable: false, + configurable: false +}); + +Object.defineProperty(obj, "property1", { + value: 1003, + writable: false, + configurable: true +}); + +try { + Object.defineProperties(obj, { + property: { + value: 1002 + }, + property1: { + value: 1004 + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(obj, "property", 1001); + + verifyNotWritable(obj, "property"); + + verifyNotEnumerable(obj, "property"); + + verifyNotConfigurable(obj, "property"); + + verifyEqualTo(obj, "property1", 1003); + + verifyNotWritable(obj, "property1"); + + verifyNotEnumerable(obj, "property1"); + + verifyConfigurable(obj, "property1"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-93-4.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-93-4.js new file mode 100644 index 0000000000..7d6548ea1d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-93-4.js @@ -0,0 +1,61 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-93-4 +description: > + Object.defineProperties will fail to update [[Value]] attribute of + indexed data property 'P' when [[Configurable]] attribute of first + updating property are false (8.12.9 - step Note & 10.a.ii.1) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "0", { + value: 1001, + writable: false, + configurable: false +}); + +Object.defineProperty(obj, "1", { + value: 1003, + writable: false, + configurable: true +}); + +try { + Object.defineProperties(obj, { + 0: { + value: 1002 + }, + 1: { + value: 1004 + } + }); + + throw new Test262Error("Expected an exception."); +} catch (e) { + verifyEqualTo(obj, "0", 1001); + + verifyNotWritable(obj, "0"); + + verifyNotEnumerable(obj, "0"); + + verifyNotConfigurable(obj, "0"); + verifyEqualTo(obj, "1", 1003); + + verifyNotWritable(obj, "1"); + + verifyNotEnumerable(obj, "1"); + + verifyConfigurable(obj, "1"); + + if (!(e instanceof TypeError)) { + throw new Test262Error("Expected TypeError, got " + e); + } + +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-93.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-93.js new file mode 100644 index 0000000000..cbfc06a190 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-93.js @@ -0,0 +1,38 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-93 +description: > + Object.defineProperties will not throw TypeError when + P.configurable is false, P.[[Get]] and properties.[[Get]] are + undefined (8.12.9 step 11.a.ii) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +function set_func(value) { + obj.setVerifyHelpProp = value; +} + +Object.defineProperty(obj, "foo", { + get: undefined, + set: set_func, + enumerable: false, + configurable: false +}); + +Object.defineProperties(obj, { + foo: { + get: undefined + } +}); +verifyWritable(obj, "foo", "setVerifyHelpProp"); + +verifyNotEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-94.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-94.js new file mode 100644 index 0000000000..8f97c40e12 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-94.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-94 +description: > + Object.defineProperties - 'P' is data property, properties.value + and P.value are two different values (8.12.9 step 12) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +obj.foo = 100; // default value of attributes: writable: true, configurable: true, enumerable: true + +Object.defineProperties(obj, { + foo: { + value: 200 + } +}); +verifyEqualTo(obj, "foo", 200); + +verifyWritable(obj, "foo"); + +verifyEnumerable(obj, "foo"); + +verifyConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-95.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-95.js new file mode 100644 index 0000000000..b89ec12636 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-95.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-95 +description: > + Object.defineProperties - 'P' is data property, P.value is present + and properties.value is undefined (8.12.9 step 12) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: 200, + enumerable: true, + writable: true, + configurable: true +}); + +Object.defineProperties(obj, { + foo: { + value: undefined + } +}); +verifyEqualTo(obj, "foo", undefined); + +verifyWritable(obj, "foo"); + +verifyEnumerable(obj, "foo"); + +verifyConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-96.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-96.js new file mode 100644 index 0000000000..cecec30eb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-96.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-96 +description: > + Object.defineProperties - 'P' is data property, properties.value + is present and P.value is undefined (8.12.9 step 12) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +Object.defineProperties(obj, { + foo: { + value: 200 + } +}); +verifyEqualTo(obj, "foo", 200); + +verifyWritable(obj, "foo"); + +verifyEnumerable(obj, "foo"); + +verifyConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-97.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-97.js new file mode 100644 index 0000000000..830402f265 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-97.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-97 +description: > + Object.defineProperties - 'P' is data property, P.writable and + properties.writable are different values (8.12.9 step 12) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: 100, + enumerable: true, + writable: false, + configurable: true +}); + +Object.defineProperties(obj, { + foo: { + writable: true + } +}); +verifyEqualTo(obj, "foo", 100); + +verifyWritable(obj, "foo"); + +verifyEnumerable(obj, "foo"); + +verifyConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-98.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-98.js new file mode 100644 index 0000000000..c45c0b3582 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-98.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-98 +description: > + Object.defineProperties - 'P' is data property, P.enumerable and + properties.enumerable are different values (8.12.9 step 12) +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: 200, + enumerable: false, + writable: true, + configurable: true +}); + +Object.defineProperties(obj, { + foo: { + enumerable: true + } +}); +verifyEqualTo(obj, "foo", 200); + +verifyWritable(obj, "foo"); + +verifyEnumerable(obj, "foo"); + +verifyConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-99.js b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-99.js new file mode 100644 index 0000000000..8dee2771e6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-99.js @@ -0,0 +1,35 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.7-6-a-99 +description: > + Object.defineProperties - 'P' is data property, P.configurable is + true and properties.configurable is false +includes: [propertyHelper.js] +---*/ + + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: 200, + enumerable: true, + writable: true, + configurable: true +}); + +Object.defineProperties(obj, { + foo: { + configurable: false + } +}); +verifyEqualTo(obj, "foo", 200); + +verifyWritable(obj, "foo"); + +verifyEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/browser.js b/js/src/tests/test262/built-ins/Object/defineProperties/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/browser.js diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/name.js b/js/src/tests/test262/built-ins/Object/defineProperties/name.js new file mode 100644 index 0000000000..64e4c0c4c2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 19.1.2.3 +description: > + Object.defineProperties.name is "defineProperties". +info: | + Object.defineProperties ( O, Properties ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Object.defineProperties.name, "defineProperties"); + +verifyNotEnumerable(Object.defineProperties, "name"); +verifyNotWritable(Object.defineProperties, "name"); +verifyConfigurable(Object.defineProperties, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/not-a-constructor.js b/js/src/tests/test262/built-ins/Object/defineProperties/not-a-constructor.js new file mode 100644 index 0000000000..7987b575ff --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/not-a-constructor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Object.defineProperties does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Object.defineProperties), + false, + 'isConstructor(Object.defineProperties) must return false' +); + +assert.throws(TypeError, () => { + new Object.defineProperties({}, {}); +}, '`new Object.defineProperties({}, {})` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/property-description-must-be-an-object-not-bigint.js b/js/src/tests/test262/built-ins/Object/defineProperties/property-description-must-be-an-object-not-bigint.js new file mode 100644 index 0000000000..57b3bf595b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/property-description-must-be-an-object-not-bigint.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-objectdefineproperties +description: > + Property description must be an object (bigint) +info: | + ObjectDefineProperties ( O, Properties ) + + ... + For each element nextKey of keys, do + Let propDesc be ? props.[[GetOwnProperty]](nextKey). + If propDesc is not undefined and propDesc.[[Enumerable]] is true, then + Let descObj be ? Get(props, nextKey). + Let desc be ? ToPropertyDescriptor(descObj). + ... + + ToPropertyDescriptor ( Obj ) + + If Type(Obj) is not Object, throw a TypeError exception. + ... +features: [BigInt] +---*/ + +assert.throws(TypeError, () => { + Object.defineProperties({}, { + a: 0n + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/property-description-must-be-an-object-not-false.js b/js/src/tests/test262/built-ins/Object/defineProperties/property-description-must-be-an-object-not-false.js new file mode 100644 index 0000000000..630359e751 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/property-description-must-be-an-object-not-false.js @@ -0,0 +1,30 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-objectdefineproperties +description: > + Property description must be an object (false) +info: | + ObjectDefineProperties ( O, Properties ) + + ... + For each element nextKey of keys, do + Let propDesc be ? props.[[GetOwnProperty]](nextKey). + If propDesc is not undefined and propDesc.[[Enumerable]] is true, then + Let descObj be ? Get(props, nextKey). + Let desc be ? ToPropertyDescriptor(descObj). + ... + + ToPropertyDescriptor ( Obj ) + + If Type(Obj) is not Object, throw a TypeError exception. + ... +---*/ + +assert.throws(TypeError, () => { + Object.defineProperties({}, { + a: false + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/property-description-must-be-an-object-not-null.js b/js/src/tests/test262/built-ins/Object/defineProperties/property-description-must-be-an-object-not-null.js new file mode 100644 index 0000000000..bf5bd3180f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/property-description-must-be-an-object-not-null.js @@ -0,0 +1,30 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-objectdefineproperties +description: > + Property description must be an object (null) +info: | + ObjectDefineProperties ( O, Properties ) + + ... + For each element nextKey of keys, do + Let propDesc be ? props.[[GetOwnProperty]](nextKey). + If propDesc is not undefined and propDesc.[[Enumerable]] is true, then + Let descObj be ? Get(props, nextKey). + Let desc be ? ToPropertyDescriptor(descObj). + ... + + ToPropertyDescriptor ( Obj ) + + If Type(Obj) is not Object, throw a TypeError exception. + ... +---*/ + +assert.throws(TypeError, () => { + Object.defineProperties({}, { + a: null + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/property-description-must-be-an-object-not-number.js b/js/src/tests/test262/built-ins/Object/defineProperties/property-description-must-be-an-object-not-number.js new file mode 100644 index 0000000000..ee70c0b83f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/property-description-must-be-an-object-not-number.js @@ -0,0 +1,30 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-objectdefineproperties +description: > + Property description must be an object (number) +info: | + ObjectDefineProperties ( O, Properties ) + + ... + For each element nextKey of keys, do + Let propDesc be ? props.[[GetOwnProperty]](nextKey). + If propDesc is not undefined and propDesc.[[Enumerable]] is true, then + Let descObj be ? Get(props, nextKey). + Let desc be ? ToPropertyDescriptor(descObj). + ... + + ToPropertyDescriptor ( Obj ) + + If Type(Obj) is not Object, throw a TypeError exception. + ... +---*/ + +assert.throws(TypeError, () => { + Object.defineProperties({}, { + a: 1 + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/property-description-must-be-an-object-not-string.js b/js/src/tests/test262/built-ins/Object/defineProperties/property-description-must-be-an-object-not-string.js new file mode 100644 index 0000000000..f8a1fe1b03 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/property-description-must-be-an-object-not-string.js @@ -0,0 +1,30 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-objectdefineproperties +description: > + Property description must be an object (string) +info: | + ObjectDefineProperties ( O, Properties ) + + ... + For each element nextKey of keys, do + Let propDesc be ? props.[[GetOwnProperty]](nextKey). + If propDesc is not undefined and propDesc.[[Enumerable]] is true, then + Let descObj be ? Get(props, nextKey). + Let desc be ? ToPropertyDescriptor(descObj). + ... + + ToPropertyDescriptor ( Obj ) + + If Type(Obj) is not Object, throw a TypeError exception. + ... +---*/ + +assert.throws(TypeError, () => { + Object.defineProperties({}, { + a: '' + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/property-description-must-be-an-object-not-symbol.js b/js/src/tests/test262/built-ins/Object/defineProperties/property-description-must-be-an-object-not-symbol.js new file mode 100644 index 0000000000..99d2ffb0e9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/property-description-must-be-an-object-not-symbol.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-objectdefineproperties +description: > + Property description must be an object (symbol) +info: | + ObjectDefineProperties ( O, Properties ) + + ... + For each element nextKey of keys, do + Let propDesc be ? props.[[GetOwnProperty]](nextKey). + If propDesc is not undefined and propDesc.[[Enumerable]] is true, then + Let descObj be ? Get(props, nextKey). + Let desc be ? ToPropertyDescriptor(descObj). + ... + + ToPropertyDescriptor ( Obj ) + + If Type(Obj) is not Object, throw a TypeError exception. + ... +features: [Symbol] +---*/ + +assert.throws(TypeError, () => { + Object.defineProperties({}, { + a: Symbol() + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/property-description-must-be-an-object-not-true.js b/js/src/tests/test262/built-ins/Object/defineProperties/property-description-must-be-an-object-not-true.js new file mode 100644 index 0000000000..b21778e8aa --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/property-description-must-be-an-object-not-true.js @@ -0,0 +1,30 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-objectdefineproperties +description: > + Property description must be an object (true) +info: | + ObjectDefineProperties ( O, Properties ) + + ... + For each element nextKey of keys, do + Let propDesc be ? props.[[GetOwnProperty]](nextKey). + If propDesc is not undefined and propDesc.[[Enumerable]] is true, then + Let descObj be ? Get(props, nextKey). + Let desc be ? ToPropertyDescriptor(descObj). + ... + + ToPropertyDescriptor ( Obj ) + + If Type(Obj) is not Object, throw a TypeError exception. + ... +---*/ + +assert.throws(TypeError, () => { + Object.defineProperties({}, { + a: true + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/property-description-must-be-an-object-not-undefined.js b/js/src/tests/test262/built-ins/Object/defineProperties/property-description-must-be-an-object-not-undefined.js new file mode 100644 index 0000000000..cb47a9d3d4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/property-description-must-be-an-object-not-undefined.js @@ -0,0 +1,30 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-objectdefineproperties +description: > + Property description must be an object (undefined) +info: | + ObjectDefineProperties ( O, Properties ) + + ... + For each element nextKey of keys, do + Let propDesc be ? props.[[GetOwnProperty]](nextKey). + If propDesc is not undefined and propDesc.[[Enumerable]] is true, then + Let descObj be ? Get(props, nextKey). + Let desc be ? ToPropertyDescriptor(descObj). + ... + + ToPropertyDescriptor ( Obj ) + + If Type(Obj) is not Object, throw a TypeError exception. + ... +---*/ + +assert.throws(TypeError, () => { + Object.defineProperties({}, { + a: undefined + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/proxy-no-ownkeys-returned-keys-order.js b/js/src/tests/test262/built-ins/Object/defineProperties/proxy-no-ownkeys-returned-keys-order.js new file mode 100644 index 0000000000..086b764551 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/proxy-no-ownkeys-returned-keys-order.js @@ -0,0 +1,53 @@ +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-object.getownpropertydescriptors +description: > + If Proxy "ownKeys" trap is missing, keys are sorted by type in ascending + chronological order. +info: | + ObjectDefineProperties ( O, Properties ) + + [...] + 3. Let keys be ? props.[[OwnPropertyKeys]](). + [...] + 4. For each element nextKey of keys in List order, do + a. Let propDesc be ? props.[[GetOwnProperty]](nextKey). + + [[OwnPropertyKeys]] ( ) + + [...] + 6. If trap is undefined, then + a. Return ? target.[[OwnPropertyKeys]](). + + OrdinaryOwnPropertyKeys ( O ) + + [...] + 3. For each own property key P of O such that Type(P) is String and P is + not an array index, in ascending chronological order of property creation, do + a. Add P as the last element of keys. + 4. For each own property key P of O such that Type(P) is Symbol, + in ascending chronological order of property creation, do + a. Add P as the last element of keys. + 5. Return keys. +features: [Proxy, Symbol] +includes: [compareArray.js] +---*/ + +var target = {}; +var sym = Symbol(); +target[sym] = 1; +target.foo = 2; +target[0] = 3; + +var getOwnKeys = []; +var proxy = new Proxy(target, { + getOwnPropertyDescriptor: function(_target, key) { + getOwnKeys.push(key); + }, +}); + +Object.defineProperties({}, proxy); +assert.compareArray(getOwnKeys, ["0", "foo", sym]); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/defineProperties/shell.js b/js/src/tests/test262/built-ins/Object/defineProperties/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/defineProperties/shell.js |