diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/built-ins/Object/create | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/Object/create')
322 files changed, 8504 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-0-1.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-0-1.js new file mode 100644 index 0000000000..30be8c6b03 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-0-1.js @@ -0,0 +1,11 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.5-0-1 +description: Object.create must exist as a function +---*/ + +assert.sameValue(typeof(Object.create), "function", 'typeof(Object.create)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-0-2.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-0-2.js new file mode 100644 index 0000000000..c87e471910 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-0-2.js @@ -0,0 +1,11 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.5-0-2 +description: Object.create must exist as a function taking 2 parameters +---*/ + +assert.sameValue(Object.create.length, 2, 'Object.create.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-1-1.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-1-1.js new file mode 100644 index 0000000000..132a3a2c04 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-1-1.js @@ -0,0 +1,14 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.5-1-1 +description: Object.create throws TypeError if 'O' is undefined +---*/ + + +assert.throws(TypeError, function() { + Object.create(undefined); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-1-2.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-1-2.js new file mode 100644 index 0000000000..cf33997d5e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-1-2.js @@ -0,0 +1,11 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.5-1-2 +description: Object.create TypeError is not thrown if 'O' is null +---*/ + +Object.create(null); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-1-3.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-1-3.js new file mode 100644 index 0000000000..83db89429e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-1-3.js @@ -0,0 +1,14 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.5-1-3 +description: Object.create throws TypeError if 'O' is a boolean primitive +---*/ + + +assert.throws(TypeError, function() { + Object.create(true); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-1-4.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-1-4.js new file mode 100644 index 0000000000..707867ba3b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-1-4.js @@ -0,0 +1,14 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.5-1-4 +description: Object.create throws TypeError if 'O' is a number primitive +---*/ + + +assert.throws(TypeError, function() { + Object.create(2); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-1.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-1.js new file mode 100644 index 0000000000..ce91396dae --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-1.js @@ -0,0 +1,14 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.5-1 +description: Object.create throws TypeError if type of first param is not Object +---*/ + + +assert.throws(TypeError, function() { + Object.create(0); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-2-1.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-2-1.js new file mode 100644 index 0000000000..90a3c94b7e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-2-1.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + create sets the [[Prototype]] of the created object to first parameter. + This can be checked using isPrototypeOf, or getPrototypeOf. +es5id: 15.2.3.5-2-1 +description: Object.create creates new Object +---*/ + +function base() {} +var b = new base(); +var prop = new Object(); +var d = Object.create(b); + +assert.sameValue(typeof d, 'object', 'typeof d'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-2-2.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-2-2.js new file mode 100644 index 0000000000..000675aef1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-2-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.5-2-2 +description: Object.create - returned object is an instance of Object +---*/ + +var newObj = Object.create({}); + +assert(newObj instanceof Object, 'newObj instanceof Object !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-3-1.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-3-1.js new file mode 100644 index 0000000000..12330461c2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-3-1.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + create sets the [[Prototype]] of the created object to first parameter. + This can be checked using isPrototypeOf, or getPrototypeOf. +es5id: 15.2.3.5-3-1 +description: Object.create sets the prototype of the passed-in object +---*/ + +function base() {} +var b = new base(); +var d = Object.create(b); + +assert.sameValue(Object.getPrototypeOf(d), b, 'Object.getPrototypeOf(d)'); +assert.sameValue(b.isPrototypeOf(d), true, 'b.isPrototypeOf(d)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-1.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-1.js new file mode 100644 index 0000000000..a314159269 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-1.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. + +/*--- +info: | + create sets the [[Prototype]] of the created object to first parameter. + This can be checked using isPrototypeOf, or getPrototypeOf. +es5id: 15.2.3.5-4-1 +description: > + Object.create sets the prototype of the passed-in object and adds + new properties +---*/ + +function base() {} +var b = new base(); +var prop = new Object(); +var d = Object.create(b, { + "x": { + value: true, + writable: false + }, + "y": { + value: "str", + writable: false + } +}); + +assert.sameValue(Object.getPrototypeOf(d), b, 'Object.getPrototypeOf(d)'); +assert.sameValue(b.isPrototypeOf(d), true, 'b.isPrototypeOf(d)'); +assert.sameValue(d.x, true, 'd.x'); +assert.sameValue(d.y, "str", 'd.y'); +assert.sameValue(b.x, undefined, 'b.x'); +assert.sameValue(b.y, undefined, 'b.y'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-10.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-10.js new file mode 100644 index 0000000000..259d115d7d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-10.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.5-4-10 +description: > + Object.create - argument 'Properties' is the Math object (15.2.3.7 + step 2) +---*/ + +var result = false; +Object.defineProperty(Math, "prop", { + get: function() { + result = (this === Math); + return {}; + }, + enumerable: true, + configurable: true +}); + +var newObj = Object.create({}, Math); + +assert(result, 'result !== true'); +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-100.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-100.js new file mode 100644 index 0000000000..ed3a1d5d13 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-100.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.5-4-100 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is not present (8.10.5 step 4) +includes: [propertyHelper.js] +---*/ + +var newObj = Object.create({}, { + prop: { + value: "ownDataProperty" + } +}); + +assert(newObj.hasOwnProperty("prop"), "expected newObj to have 'prop'"); +verifyNotConfigurable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-101.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-101.js new file mode 100644 index 0000000000..f325ce5059 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-101.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.5-4-101 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is own data property (8.10.5 step 4.a) +includes: [propertyHelper.js] +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: false + } +}); + +assert(newObj.hasOwnProperty("prop")); +verifyNotConfigurable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-102.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-102.js new file mode 100644 index 0000000000..b534f64345 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-102.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.5-4-102 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is an inherited data property (8.10.5 step 4.a) +---*/ + +var proto = { + configurable: true +}; + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var descObj = new ConstructFun(); + +var newObj = Object.create({}, { + prop: descObj +}); + +var result1 = newObj.hasOwnProperty("prop"); +delete newObj.prop; +var result2 = newObj.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/create/15.2.3.5-4-103.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-103.js new file mode 100644 index 0000000000..4da2d10566 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-103.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.5-4-103 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is own data property that overrides an inherited data + property (8.10.5 step 4.a) +includes: [propertyHelper.js] +---*/ + +var proto = { + configurable: true +}; + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var descObj = new ConstructFun(); + +Object.defineProperty(descObj, "configurable", { + value: false +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert(newObj.hasOwnProperty("prop")); +verifyNotConfigurable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-104.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-104.js new file mode 100644 index 0000000000..b76ea8de8b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-104.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.5-4-104 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is own data property that overrides an inherited + accessor property (8.10.5 step 4.a) +includes: [propertyHelper.js] +---*/ + +var proto = {}; +Object.defineProperty(proto, "configurable", { + get: function() { + return true; + } +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var descObj = new ConstructFun(); + +Object.defineProperty(descObj, "configurable", { + value: false +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert(newObj.hasOwnProperty("prop")); +verifyNotConfigurable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-105.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-105.js new file mode 100644 index 0000000000..c9377acdda --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-105.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.5-4-105 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is own accessor property (8.10.5 step 4.a) +---*/ + +var descObj = {}; +Object.defineProperty(descObj, "configurable", { + get: function() { + return true; + } +}); + +var newObj = Object.create({}, { + prop: descObj +}); +var result1 = newObj.hasOwnProperty("prop"); +delete newObj.prop; +var result2 = newObj.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/create/15.2.3.5-4-106.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-106.js new file mode 100644 index 0000000000..68941e6176 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-106.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.5-4-106 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is an inherited accessor property (8.10.5 step 4.a) +---*/ + +var proto = {}; + +Object.defineProperty(proto, "configurable", { + get: function() { + return true; + } +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var descObj = new ConstructFun(); + +var newObj = Object.create({}, { + prop: descObj +}); +var result1 = newObj.hasOwnProperty("prop"); +delete newObj.prop; +var result2 = newObj.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/create/15.2.3.5-4-107.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-107.js new file mode 100644 index 0000000000..867a3f4e8c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-107.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.5-4-107 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is own accessor property that overrides an inherited + data property (8.10.5 step 4.a) +includes: [propertyHelper.js] +---*/ + +var proto = { + configurable: true +}; + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var descObj = new ConstructFun(); + +Object.defineProperty(descObj, "configurable", { + get: function() { + return false; + } +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert(newObj.hasOwnProperty("prop")); +verifyNotConfigurable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-108.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-108.js new file mode 100644 index 0000000000..14d9da3a70 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-108.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.5-4-108 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is own accessor property that overrides an inherited + accessor property (8.10.5 step 4.a) +includes: [propertyHelper.js] +---*/ + +var proto = {}; +Object.defineProperty(proto, "configurable", { + get: function() { + return true; + } +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var descObj = new ConstructFun(); + +Object.defineProperty(descObj, "configurable", { + get: function() { + return false; + } +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert(newObj.hasOwnProperty("prop")); +verifyNotConfigurable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-109.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-109.js new file mode 100644 index 0000000000..8a38c3975e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-109.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.5-4-109 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is own accessor property without a get function + (8.10.5 step 4.a) +includes: [propertyHelper.js] +---*/ + +var descObj = {}; +Object.defineProperty(descObj, "configurable", { + set: function() {} +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert(newObj.hasOwnProperty("prop")); +verifyNotConfigurable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-11.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-11.js new file mode 100644 index 0000000000..6c3b27e932 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-11.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.5-4-11 +description: > + Object.create - argument 'Properties' is a Date object (15.2.3.7 + step 2) +---*/ + +var props = new Date(); +var result = false; + +Object.defineProperty(props, "prop", { + get: function() { + result = this instanceof Date; + return {}; + }, + enumerable: true +}); +var newObj = Object.create({}, props); + +assert(result, 'result !== true'); +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-110.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-110.js new file mode 100644 index 0000000000..9ac2bcea84 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-110.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.5-4-110 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is own accessor property without a get function, + which overrides an inherited accessor property (8.10.5 step 4.a) +includes: [propertyHelper.js] +---*/ + +var proto = {}; +Object.defineProperty(proto, "configurable", { + get: function() { + return true; + } +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var descObj = new ConstructFun(); + +Object.defineProperty(descObj, "configurable", { + set: function() {} +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert(newObj.hasOwnProperty("prop")); +verifyNotConfigurable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-111.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-111.js new file mode 100644 index 0000000000..e979fe76d7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-111.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.5-4-111 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is an inherited accessor property without a get + function (8.10.5 step 4.a) +includes: [propertyHelper.js] +---*/ + +var proto = {}; + +Object.defineProperty(proto, "configurable", { + set: function() {} +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var descObj = new ConstructFun(); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert(newObj.hasOwnProperty("prop")); +verifyNotConfigurable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-112.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-112.js new file mode 100644 index 0000000000..a40a9a1fb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-112.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.5-4-112 +description: > + Object.create - one property in 'Properties' is a Function object + which implements its own [[Get]] method to access the + 'configurable' property (8.10.5 step 4.a) +---*/ + +var descObj = function() {}; + +descObj.configurable = true; + +var newObj = Object.create({}, { + prop: descObj +}); + +var result1 = newObj.hasOwnProperty("prop"); +delete newObj.prop; +var result2 = newObj.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/create/15.2.3.5-4-113.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-113.js new file mode 100644 index 0000000000..33572fe9a1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-113.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.5-4-113 +description: > + Object.create - one property in 'Properties' is an Array object + that uses Object's [[Get]] method to access the 'configurable' + property (8.10.5 step 4.a) +---*/ + +var descObj = []; + +descObj.configurable = true; + +var newObj = Object.create({}, { + prop: descObj +}); + +var result1 = newObj.hasOwnProperty("prop"); +delete newObj.prop; +var result2 = newObj.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/create/15.2.3.5-4-114.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-114.js new file mode 100644 index 0000000000..205e9e1d42 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-114.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.5-4-114 +description: > + Object.create - one property in 'Properties' is a String object + that uses Object's [[Get]] method to access the 'configurable' + property (8.10.5 step 4.a) +---*/ + +var descObj = new String(); + +descObj.configurable = true; + +var newObj = Object.create({}, { + prop: descObj +}); +var result1 = newObj.hasOwnProperty("prop"); +delete newObj.prop; +var result2 = newObj.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/create/15.2.3.5-4-115.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-115.js new file mode 100644 index 0000000000..f944da881b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-115.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.5-4-115 +description: > + Object.create - one property in 'Properties' is a Boolean object + that uses Object's [[Get]] method to access the 'configurable' + property (8.10.5 step 4.a) +---*/ + +var descObj = new Boolean(false); + +descObj.configurable = true; + +var newObj = Object.create({}, { + prop: descObj +}); + +var result1 = newObj.hasOwnProperty("prop"); +delete newObj.prop; +var result2 = newObj.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/create/15.2.3.5-4-116.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-116.js new file mode 100644 index 0000000000..df251a783f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-116.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.5-4-116 +description: > + Object.create - one property in 'Properties' is a Number object + that uses Object's [[Get]] method to access the 'configurable' + property (8.10.5 step 4.a) +---*/ + +var descObj = new Number(-9); + +descObj.configurable = true; + +var newObj = Object.create({}, { + prop: descObj +}); + +var result1 = newObj.hasOwnProperty("prop"); +delete newObj.prop; +var result2 = newObj.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/create/15.2.3.5-4-117.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-117.js new file mode 100644 index 0000000000..0dbfd9468b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-117.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.5-4-117 +description: > + Object.create - one property in 'Properties' is the Math object + that uses Object's [[Get]] method to access the 'configurable' + property (8.10.5 step 4.a) +---*/ + +Math.configurable = true; + +var newObj = Object.create({}, { + prop: Math +}); + +var result1 = newObj.hasOwnProperty("prop"); +delete newObj.prop; +var result2 = newObj.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/create/15.2.3.5-4-118.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-118.js new file mode 100644 index 0000000000..31a9b559da --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-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.5-4-118 +description: > + Object.create - one property in 'Properties' is a Date object that + uses Object's [[Get]] method to access the 'configurable' property + (8.10.5 step 4.a) +---*/ + +var descObj = new Date(); + +descObj.configurable = true; + +var newObj = Object.create({}, { + prop: descObj +}); + +var result1 = newObj.hasOwnProperty("prop"); +delete newObj.prop; +var result2 = newObj.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/create/15.2.3.5-4-119.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-119.js new file mode 100644 index 0000000000..8ec7819b74 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-119.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.5-4-119 +description: > + Object.create - one property in 'Properties' is a Date object that + uses Object's [[Get]] method to access the 'configurable' property + (8.10.5 step 4.a) +---*/ + +var descObj = new RegExp(); + +descObj.configurable = true; + +var newObj = Object.create({}, { + prop: descObj +}); + +var result1 = newObj.hasOwnProperty("prop"); +delete newObj.prop; +var result2 = newObj.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/create/15.2.3.5-4-12.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-12.js new file mode 100644 index 0000000000..c3f751858a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-12.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.5-4-12 +description: > + Object.create - argument 'Properties' is a RegExp object (15.2.3.7 + step 2) +---*/ + +var props = new RegExp(); +var result = false; + +Object.defineProperty(props, "prop", { + get: function() { + result = this instanceof RegExp; + return {}; + }, + enumerable: true +}); +var newObj = Object.create({}, props); + +assert(result, 'result !== true'); +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-120.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-120.js new file mode 100644 index 0000000000..85241c1604 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-120.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.5-4-120 +description: > + Object.create - one property in 'Properties' is the JSON object + that uses Object's [[Get]] method to access the 'configurable' + property (8.10.5 step 4.a) +---*/ + +JSON.configurable = true; + +var newObj = Object.create({}, { + prop: JSON +}); + +var result1 = newObj.hasOwnProperty("prop"); +delete newObj.prop; +var result2 = newObj.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/create/15.2.3.5-4-121.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-121.js new file mode 100644 index 0000000000..241862ae58 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-121.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.5-4-121 +description: > + Object.create - one property in 'Properties' is an Error object + that uses Object's [[Get]] method to access the 'configurable' + property (8.10.5 step 4.a) +---*/ + +var descObj = new Error(); + +descObj.configurable = true; + +var newObj = Object.create({}, { + prop: descObj +}); + +var result1 = newObj.hasOwnProperty("prop"); +delete newObj.prop; +var result2 = newObj.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/create/15.2.3.5-4-122.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-122.js new file mode 100644 index 0000000000..438850211c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-122.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.5-4-122 +description: > + Object.create - one property in 'Properties' is an Arguments + object which implements its own [[Get]] method to access the + 'configurable' property (8.10.5 step 4.a) +---*/ + +var argObj = (function() { + return arguments; +})(); + +argObj.configurable = true; + +var newObj = Object.create({}, { + prop: argObj +}); +var result1 = newObj.hasOwnProperty("prop"); +delete newObj.prop; +var result2 = newObj.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/create/15.2.3.5-4-124.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-124.js new file mode 100644 index 0000000000..2942ca1100 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-124.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.5-4-124 +description: > + Object.create - one property in 'Properties' is the global object + that uses Object's [[Get]] method to access the 'configurable' + property (8.10.5 step 4.a) +---*/ + +this.configurable = true; + +var newObj = Object.create({}, { + prop: this +}); + +var result1 = newObj.hasOwnProperty("prop"); +delete newObj.prop; +var result2 = newObj.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/create/15.2.3.5-4-125.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-125.js new file mode 100644 index 0000000000..17eef5947c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-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.5-4-125 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is undefined (8.10.5 step 4.b) +includes: [propertyHelper.js] +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: undefined + } +}); + + +assert(newObj.hasOwnProperty("prop")); +verifyNotConfigurable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-126.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-126.js new file mode 100644 index 0000000000..489b57cf3e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-126.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.5-4-126 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is null (8.10.5 step 4.b) +includes: [propertyHelper.js] +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: null + } +}); + +assert(newObj.hasOwnProperty("prop")); +verifyNotConfigurable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-127.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-127.js new file mode 100644 index 0000000000..d497a08093 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-127.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.5-4-127 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is true (8.10.5 step 4.b) +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: true + } +}); + +var beforeDeleted = newObj.hasOwnProperty("prop"); + +delete newObj.prop; + +var afterDeleted = newObj.hasOwnProperty("prop"); + +assert.sameValue(beforeDeleted, true, 'beforeDeleted'); +assert.sameValue(afterDeleted, false, 'afterDeleted'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-128.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-128.js new file mode 100644 index 0000000000..77cb2171ae --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-128.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.5-4-128 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is false (8.10.5 step 4.b) +includes: [propertyHelper.js] +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: false + } +}); + +assert(newObj.hasOwnProperty("prop")); +verifyNotConfigurable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-129.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-129.js new file mode 100644 index 0000000000..1cf82338ee --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-129.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.5-4-129 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is 0 (8.10.5 step 4.b) +includes: [propertyHelper.js] +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: 0 + } +}); + +assert(newObj.hasOwnProperty("prop")); +verifyNotConfigurable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-13.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-13.js new file mode 100644 index 0000000000..115e3764bd --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-13.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.5-4-13 +description: > + Object.create - argument 'Properties' is the JSON object (15.2.3.7 + step 2) +---*/ + +var result = false; + +Object.defineProperty(JSON, "prop", { + get: function() { + result = (this === JSON); + return {}; + }, + enumerable: true, + configurable: true +}); + +var newObj = Object.create({}, JSON); + +assert(result, 'result !== true'); +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-130.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-130.js new file mode 100644 index 0000000000..30855dd7c6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-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.5-4-130 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is +0 (8.10.5 step 4.b) +includes: [propertyHelper.js] +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: +0 + } +}); + + +assert(newObj.hasOwnProperty("prop")); +verifyNotConfigurable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-131.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-131.js new file mode 100644 index 0000000000..a27ff05e7e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-131.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.5-4-131 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is -0 (8.10.5 step 4.b) +includes: [propertyHelper.js] +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: -0 + } +}); + +assert(newObj.hasOwnProperty("prop")); +verifyNotConfigurable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-132.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-132.js new file mode 100644 index 0000000000..0f59a2aa10 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-132.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.5-4-132 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is NaN (8.10.5 step 4.b) +includes: [propertyHelper.js] +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: NaN + } +}); + +assert(newObj.hasOwnProperty("prop")); +verifyNotConfigurable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-133.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-133.js new file mode 100644 index 0000000000..994628f470 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-133.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.5-4-133 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is a positive number (8.10.5 step 4.b) +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: 123 + } +}); + +var beforeDeleted = newObj.hasOwnProperty("prop"); + +delete newObj.prop; + +var afterDeleted = newObj.hasOwnProperty("prop"); + +assert.sameValue(beforeDeleted, true, 'beforeDeleted'); +assert.sameValue(afterDeleted, false, 'afterDeleted'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-134.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-134.js new file mode 100644 index 0000000000..ba54db1dd5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-134.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.5-4-134 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is a negative number (8.10.5 step 4.b) +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: -123 + } +}); + +var beforeDeleted = newObj.hasOwnProperty("prop"); + +delete newObj.prop; + +var afterDeleted = newObj.hasOwnProperty("prop"); + +assert.sameValue(beforeDeleted, true, 'beforeDeleted'); +assert.sameValue(afterDeleted, false, 'afterDeleted'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-135.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-135.js new file mode 100644 index 0000000000..d6aef6ae19 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-135.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.5-4-135 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is an empty string (8.10.5 step 4.b) +includes: [propertyHelper.js] +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: "" + } +}); + +assert(newObj.hasOwnProperty("prop")); +verifyNotConfigurable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-136.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-136.js new file mode 100644 index 0000000000..50401cc845 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-136.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.5-4-136 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is a non-empty string (8.10.5 step 4.b) +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: "abc" + } +}); + +var beforeDeleted = newObj.hasOwnProperty("prop"); + +delete newObj.prop; + +var afterDeleted = newObj.hasOwnProperty("prop"); + +assert.sameValue(beforeDeleted, true, 'beforeDeleted'); +assert.sameValue(afterDeleted, false, 'afterDeleted'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-137.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-137.js new file mode 100644 index 0000000000..850059b6f8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-137.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.5-4-137 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is a Function object (8.10.5 step 4.b) +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: function() {} + } +}); + +var beforeDeleted = newObj.hasOwnProperty("prop"); + +delete newObj.prop; + +var afterDeleted = newObj.hasOwnProperty("prop"); + +assert.sameValue(beforeDeleted, true, 'beforeDeleted'); +assert.sameValue(afterDeleted, false, 'afterDeleted'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-138.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-138.js new file mode 100644 index 0000000000..7ba9ff514e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-138.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.5-4-138 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is an Array object (8.10.5 step 4.b) +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: [] + } +}); + +var beforeDeleted = newObj.hasOwnProperty("prop"); + +delete newObj.prop; + +var afterDeleted = newObj.hasOwnProperty("prop"); + +assert.sameValue(beforeDeleted, true, 'beforeDeleted'); +assert.sameValue(afterDeleted, false, 'afterDeleted'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-139.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-139.js new file mode 100644 index 0000000000..722d99ec58 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-139.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.5-4-139 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is a String object (8.10.5 step 4.b) +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: new String("abc") + } +}); + +var beforeDeleted = newObj.hasOwnProperty("prop"); + +delete newObj.prop; + +var afterDeleted = newObj.hasOwnProperty("prop"); + +assert.sameValue(beforeDeleted, true, 'beforeDeleted'); +assert.sameValue(afterDeleted, false, 'afterDeleted'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-14.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-14.js new file mode 100644 index 0000000000..6b958e0a98 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-14.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.5-4-14 +description: > + Object.create - argument 'Properties' is an Error object (15.2.3.7 + step 2) +---*/ + +var props = new Error("test"); +var result = false; + +(Object.getOwnPropertyNames(props)).forEach(function(name) { + props[name] = { + value: 11, + configurable: true + } +}); + +Object.defineProperty(props, "prop15_2_3_5_4_14", { + get: function() { + result = this instanceof Error; + return {}; + }, + enumerable: true +}); +var newObj = Object.create({}, props); + +assert(result, 'result !== true'); +assert(newObj.hasOwnProperty("prop15_2_3_5_4_14"), 'newObj.hasOwnProperty("prop15_2_3_5_4_14") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-140.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-140.js new file mode 100644 index 0000000000..03933357ac --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-140.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.5-4-140 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is a Boolean object (8.10.5 step 4.b) +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: new Boolean(true) + } +}); + +var beforeDeleted = newObj.hasOwnProperty("prop"); + +delete newObj.prop; + +var afterDeleted = newObj.hasOwnProperty("prop"); + +assert.sameValue(beforeDeleted, true, 'beforeDeleted'); +assert.sameValue(afterDeleted, false, 'afterDeleted'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-141.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-141.js new file mode 100644 index 0000000000..6b4c8f931b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-141.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.5-4-141 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is a Number object (8.10.5 step 4.b) +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: new Number(123) + } +}); + +var beforeDeleted = newObj.hasOwnProperty("prop"); + +delete newObj.prop; + +var afterDeleted = newObj.hasOwnProperty("prop"); + +assert.sameValue(beforeDeleted, true, 'beforeDeleted'); +assert.sameValue(afterDeleted, false, 'afterDeleted'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-142.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-142.js new file mode 100644 index 0000000000..e8ad92b856 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-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.5-4-142 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is the Math object (8.10.5 step 4.b) +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: Math + } +}); + +var beforeDeleted = newObj.hasOwnProperty("prop"); + +delete newObj.prop; + +var afterDeleted = newObj.hasOwnProperty("prop"); + +assert.sameValue(beforeDeleted, true, 'beforeDeleted'); +assert.sameValue(afterDeleted, false, 'afterDeleted'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-143.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-143.js new file mode 100644 index 0000000000..59dd6d2083 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-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.5-4-143 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is a Date object (8.10.5 step 4.b) +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: new Date() + } +}); + +var beforeDeleted = newObj.hasOwnProperty("prop"); + +delete newObj.prop; + +var afterDeleted = newObj.hasOwnProperty("prop"); + +assert.sameValue(beforeDeleted, true, 'beforeDeleted'); +assert.sameValue(afterDeleted, false, 'afterDeleted'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-144.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-144.js new file mode 100644 index 0000000000..6e63c36b8f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-144.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.5-4-144 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is a RegExp object (8.10.5 step 4.b) +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: new RegExp() + } +}); + +var beforeDeleted = newObj.hasOwnProperty("prop"); + +delete newObj.prop; + +var afterDeleted = newObj.hasOwnProperty("prop"); + +assert.sameValue(beforeDeleted, true, 'beforeDeleted'); +assert.sameValue(afterDeleted, false, 'afterDeleted'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-145.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-145.js new file mode 100644 index 0000000000..325ef3f4bd --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-145.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.5-4-145 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is the JSON object (8.10.5 step 4.b) +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: JSON + } +}); + +var beforeDeleted = newObj.hasOwnProperty("prop"); + +delete newObj.prop; + +var afterDeleted = newObj.hasOwnProperty("prop"); + +assert.sameValue(beforeDeleted, true, 'beforeDeleted'); +assert.sameValue(afterDeleted, false, 'afterDeleted'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-146.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-146.js new file mode 100644 index 0000000000..0fad1df18d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-146.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.5-4-146 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is an Error object (8.10.5 step 4.b) +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: new Error() + } +}); + +var beforeDeleted = newObj.hasOwnProperty("prop"); + +delete newObj.prop; + +var afterDeleted = newObj.hasOwnProperty("prop"); + +assert.sameValue(beforeDeleted, true, 'beforeDeleted'); +assert.sameValue(afterDeleted, false, 'afterDeleted'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-147.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-147.js new file mode 100644 index 0000000000..97e0e71335 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-147.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.5-4-147 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is an Arguments object (8.10.5 step 4.b) +---*/ + +var argObj = (function() { + return arguments; +})(); + +var newObj = Object.create({}, { + prop: { + configurable: argObj + } +}); + +var beforeDeleted = newObj.hasOwnProperty("prop"); + +delete newObj.prop; + +var afterDeleted = newObj.hasOwnProperty("prop"); + +assert.sameValue(beforeDeleted, true, 'beforeDeleted'); +assert.sameValue(afterDeleted, false, 'afterDeleted'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-149.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-149.js new file mode 100644 index 0000000000..1798b3ec5e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-149.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.5-4-149 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is the global object (8.10.5 step 4.b) +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: this + } +}); + +var beforeDeleted = newObj.hasOwnProperty("prop"); + +delete newObj.prop; + +var afterDeleted = newObj.hasOwnProperty("prop"); + +assert.sameValue(beforeDeleted, true, 'beforeDeleted'); +assert.sameValue(afterDeleted, false, 'afterDeleted'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-15.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-15.js new file mode 100644 index 0000000000..b6e2ca0583 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-15.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.5-4-15 +description: > + Object.create - argument 'Properties' is the Aguments object + (15.2.3.7 step 2) +---*/ + +var result = false; + +var argObj = (function() { + return arguments; +})(); + +Object.defineProperty(argObj, "prop", { + get: function() { + result = ('[object Arguments]' === Object.prototype.toString.call(this)); + return {}; + }, + enumerable: true +}); + +var newObj = Object.create({}, argObj); + +assert(result, 'result !== true'); +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-150.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-150.js new file mode 100644 index 0000000000..1f5d186a04 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-150.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.5-4-150 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is a string (value is 'false') which is treated as + the value true (8.10.5 step 4.b) +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: "false" + } +}); + +var beforeDeleted = newObj.hasOwnProperty("prop"); + +delete newObj.prop; + +var afterDeleted = newObj.hasOwnProperty("prop"); + +assert.sameValue(beforeDeleted, true, 'beforeDeleted'); +assert.sameValue(afterDeleted, false, 'afterDeleted'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-151.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-151.js new file mode 100644 index 0000000000..918e4b39f5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-151.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.5-4-151 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is new Boolean(false) which is treated as the value + true (8.10.5 step 4.b) +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: new Boolean(false) + } +}); + +var beforeDeleted = newObj.hasOwnProperty("prop"); + +delete newObj.prop; + +var afterDeleted = newObj.hasOwnProperty("prop"); + +assert.sameValue(beforeDeleted, true, 'beforeDeleted'); +assert.sameValue(afterDeleted, false, 'afterDeleted'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-152.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-152.js new file mode 100644 index 0000000000..ed57f23303 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-152.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.5-4-152 +description: > + Object.create - 'value' property of one property in 'Properties' + is present (8.10.5 step 5) +---*/ + +var newObj = Object.create({}, { + prop: { + value: 100 + } +}); + +assert.sameValue(newObj.prop, 100, 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-153.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-153.js new file mode 100644 index 0000000000..7fabb43bcd --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-153.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.5-4-153 +description: > + Object.create - 'value' property of one property in 'Properties' + is not present (8.10.5 step 5) +---*/ + +var newObj = Object.create({}, { + prop: {} +}); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); +assert.sameValue(typeof(newObj.prop), "undefined", 'typeof (newObj.prop)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-154.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-154.js new file mode 100644 index 0000000000..8109c43b5a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-154.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.5-4-154 +description: > + Object.create - 'value' property of one property in 'Properties' + is own data property (8.10.5 step 5.a) +---*/ + +var newObj = Object.create({}, { + prop: { + value: "ownDataProperty" + } +}); + +assert.sameValue(newObj.prop, "ownDataProperty", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-155.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-155.js new file mode 100644 index 0000000000..a4a0381ee3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-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.5-4-155 +description: > + Object.create - 'value' property of one property in 'Properties' + is an inherited data property (8.10.5 step 5.a) +---*/ + +var proto = { + value: "inheritedDataProperty" +}; + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var descObj = new ConstructFun(); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert.sameValue(newObj.prop, "inheritedDataProperty", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-156.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-156.js new file mode 100644 index 0000000000..b5ea7390f3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-156.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.5-4-156 +description: > + Object.create - 'value' property of one property in 'Properties' + is own data property that overrides an inherited data property + (8.10.5 step 5.a) +---*/ + +var proto = { + value: "inheritedDataProperty" +}; + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var descObj = new ConstructFun(); + +descObj.value = "ownDataProperty"; + +var newObj = Object.create({}, { + prop: descObj +}); + +assert.sameValue(newObj.prop, "ownDataProperty", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-157.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-157.js new file mode 100644 index 0000000000..ebc6ba2f33 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-157.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.5-4-157 +description: > + Object.create - 'value' property of one property in 'Properties' + is own data property that overrides an inherited accessor property + (8.10.5 step 5.a) +---*/ + +var proto = {}; + +Object.defineProperty(proto, "value", { + get: function() { + return "inheritedAccessorProperty"; + } +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var descObj = new ConstructFun(); + +Object.defineProperty(descObj, "value", { + get: function() { + return "ownDataProperty"; + } +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert.sameValue(newObj.prop, "ownDataProperty", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-158.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-158.js new file mode 100644 index 0000000000..f61c1b255b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-158.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.5-4-158 +description: > + Object.create - 'value' property of one property in 'Properties' + is own accessor property (8.10.5 step 5.a) +---*/ + +var descObj = {}; + +Object.defineProperty(descObj, "value", { + get: function() { + return "ownAccessorProperty"; + } +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert.sameValue(newObj.prop, "ownAccessorProperty", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-159.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-159.js new file mode 100644 index 0000000000..0791fc477d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-159.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.5-4-159 +description: > + Object.create - 'value' property of one property in 'Properties' + is an inherited accessor property (8.10.5 step 5.a) +---*/ + +var proto = {}; + +Object.defineProperty(proto, "value", { + get: function() { + return "inheritedAccessorProperty"; + } +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var descObj = new ConstructFun(); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert.sameValue(newObj.prop, "inheritedAccessorProperty", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-16.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-16.js new file mode 100644 index 0000000000..c52c86167b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-16.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.5-4-16 +description: > + Object.create - own enumerable data property in 'Properties' is + defined in 'obj' (15.2.3.7 step 3) +---*/ + +var newObj = Object.create({}, { + prop: {} +}); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-160.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-160.js new file mode 100644 index 0000000000..213b7732ac --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-160.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.5-4-160 +description: > + Object.create - 'value' property of one property in 'Properties' + is own accessor property that overrides an inherited data property + (8.10.5 step 5.a) +---*/ + +var proto = { + value: "inheritedDataProperty" +}; + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var descObj = new ConstructFun(); + +Object.defineProperty(descObj, "value", { + get: function() { + return "ownAccessorProperty"; + } +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert.sameValue(newObj.prop, "ownAccessorProperty", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-161.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-161.js new file mode 100644 index 0000000000..558ddbd15f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-161.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.5-4-161 +description: > + Object.create - 'value' property of one property in 'Properties' + is own accessor property that overrides an inherited accessor + property (8.10.5 step 5.a) +---*/ + +var proto = {}; + +Object.defineProperty(proto, "value", { + get: function() { + return "inheritedAccessorProperty"; + } +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var descObj = new ConstructFun(); + +Object.defineProperty(descObj, "value", { + get: function() { + return "ownAccessorProperty"; + } +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert.sameValue(newObj.prop, "ownAccessorProperty", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-162.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-162.js new file mode 100644 index 0000000000..55b4241c0f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-162.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.5-4-162 +description: > + Object.create - 'value' property of one property in 'Properties' + is own accessor property without a get function (8.10.5 step 5.a) +---*/ + +var descObj = {}; + +Object.defineProperty(descObj, "value", { + set: function() {} +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); +assert.sameValue(typeof(newObj.prop), "undefined", 'typeof (newObj.prop)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-163.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-163.js new file mode 100644 index 0000000000..5f08cac138 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-163.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.5-4-163 +description: > + Object.create - 'value' property of one property in 'Properties' + is own accessor property without a get function, which overrides + an inherited accessor property (8.10.5 step 5.a) +---*/ + +var proto = {}; + +Object.defineProperty(proto, "value", { + get: function() { + return "inheritedAccessorProperty"; + } +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var descObj = new ConstructFun(); + +Object.defineProperty(descObj, "value", { + set: function() {} +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); +assert.sameValue(typeof(newObj.prop), "undefined", 'typeof (newObj.prop)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-164.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-164.js new file mode 100644 index 0000000000..459eb5b8fb --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-164.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.5-4-164 +description: > + Object.create - 'value' property of one property in 'Properties' + is an inherited accessor property without a get function (8.10.5 + step 5.a) +---*/ + +var proto = {}; + +Object.defineProperty(proto, "value", { + set: function() {} +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var descObj = new ConstructFun(); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); +assert.sameValue(typeof(newObj.prop), "undefined", 'typeof (newObj.prop)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-165.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-165.js new file mode 100644 index 0000000000..bad24248dd --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-165.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.5-4-165 +description: > + Object.create - one property in 'Properties' is a Function object + which implements its own [[Get]] method to access the 'value' + property (8.10.5 step 5.a) +---*/ + +var Func = function(a, b) { + return a + b; +}; + +var fun = new Func(); +fun.value = "FunValue"; + +var newObj = Object.create({}, { + prop: fun +}); + +assert.sameValue(newObj.prop, "FunValue", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-166.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-166.js new file mode 100644 index 0000000000..6e3abcb352 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-166.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.5-4-166 +description: > + Object.create - one property in 'Properties' is an Array object + that uses Object's [[Get]] method to access the 'value' property + (8.10.5 step 5.a) +---*/ + +var arr = [1, 2, 3]; + +arr.value = "ArrValue"; + +var newObj = Object.create({}, { + prop: arr +}); + +assert.sameValue(newObj.prop, "ArrValue", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-167.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-167.js new file mode 100644 index 0000000000..3c3b9af30a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-167.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.5-4-167 +description: > + Object.create - one property in 'Properties' is a String object + that uses Object's [[Get]] method to access the 'value' property + (8.10.5 step 5.a) +---*/ + +var str = new String("abc"); + +str.value = "StrValue"; + +var newObj = Object.create({}, { + prop: str +}); + +assert.sameValue(newObj.prop, "StrValue", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-168.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-168.js new file mode 100644 index 0000000000..620fe5180c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-168.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.5-4-168 +description: > + Object.create - one property in 'Properties' is a Boolean object + that uses Object's [[Get]] method to access the 'value' property + (8.10.5 step 5.a) +---*/ + +var booleanObj = new Boolean(false); + +booleanObj.value = "BooleanValue"; + +var newObj = Object.create({}, { + prop: booleanObj +}); + +assert.sameValue(newObj.prop, "BooleanValue", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-169.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-169.js new file mode 100644 index 0000000000..a510eadd09 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-169.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.5-4-169 +description: > + Object.create - one property in 'Properties' is a Number object + that uses Object's [[Get]] method to access the 'value' property + (8.10.5 step 5.a) +---*/ + +var numObj = new Number(123); + +numObj.value = "NumValue"; + +var newObj = Object.create({}, { + prop: numObj +}); + +assert.sameValue(newObj.prop, "NumValue", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-17.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-17.js new file mode 100644 index 0000000000..f9970d61e8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-17.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.5-4-17 +description: > + Object.create - own data property in 'Properties' which is not + enumerable is not defined in 'obj' (15.2.3.7 step 3) +---*/ + +var props = {}; +Object.defineProperty(props, "prop", { + value: {}, + enumerable: false +}); +var newObj = Object.create({}, props); + +assert.sameValue(newObj.hasOwnProperty("prop"), false, 'newObj.hasOwnProperty("prop")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-170.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-170.js new file mode 100644 index 0000000000..5ef1e5944b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-170.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.5-4-170 +description: > + Object.create - one property in 'Properties' is the Math object + that uses Object's [[Get]] method to access the 'value' property + (8.10.5 step 5.a) +---*/ + +Math.value = "MathValue"; + +var newObj = Object.create({}, { + prop: Math +}); + +assert.sameValue(newObj.prop, "MathValue", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-171.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-171.js new file mode 100644 index 0000000000..2c91ba8f1d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-171.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.5-4-171 +description: > + Object.create - one property in 'Properties' is a Date object that + uses Object's [[Get]] method to access the 'value' property + (8.10.5 step 5.a) +---*/ + +var dateObj = new Date(); + +dateObj.value = "DateValue"; + +var newObj = Object.create({}, { + prop: dateObj +}); + +assert.sameValue(newObj.prop, "DateValue", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-172.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-172.js new file mode 100644 index 0000000000..ef7f8e0b11 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-172.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.5-4-172 +description: > + Object.create - one property in 'Properties' is a RegExp object + that uses Object's [[Get]] method to access the 'value' property + (8.10.5 step 5.a) +---*/ + +var regObj = new RegExp(); + +regObj.value = "RegExpValue"; + +var newObj = Object.create({}, { + prop: regObj +}); + +assert.sameValue(newObj.prop, "RegExpValue", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-173.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-173.js new file mode 100644 index 0000000000..b88aad265d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-173.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.5-4-173 +description: > + Object.create - one property in 'Properties' is the JSON object + that uses Object's [[Get]] method to access the 'value' property + (8.10.5 step 5.a) +---*/ + +JSON.value = "JSONValue"; + +var newObj = Object.create({}, { + prop: JSON +}); + +assert.sameValue(newObj.prop, "JSONValue", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-174.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-174.js new file mode 100644 index 0000000000..670aaeb7da --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-174.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.5-4-174 +description: > + Object.create - one property in 'Properties' is an Error object + that uses Object's [[Get]] method to access the 'value' property + (8.10.5 step 5.a) +---*/ + +var errorObj = new Error(); + +errorObj.value = "ErrorValue"; + +var newObj = Object.create({}, { + prop: errorObj +}); + +assert.sameValue(newObj.prop, "ErrorValue", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-175.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-175.js new file mode 100644 index 0000000000..7dfc4b1d51 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-175.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.5-4-175 +description: > + Object.create - one property in 'Properties' is an Arguments + object which implements its own [[Get]] method to access the + 'value' property (8.10.5 step 5.a) +---*/ + +var argObj = (function() { + return arguments; +})(); + +argObj.value = "ArgValue"; + +var newObj = Object.create({}, { + prop: argObj +}); + +assert.sameValue(newObj.prop, "ArgValue", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-177.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-177.js new file mode 100644 index 0000000000..47224e6bb3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-177.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.5-4-177 +description: > + Object.create - one property in 'Properties' is the global object + that uses Object's [[Get]] method to access the 'value' property + (8.10.5 step 5.a) +---*/ + +this.value = "GlobalValue"; + +var newObj = Object.create({}, { + prop: this +}); + +assert.sameValue(newObj.prop, "GlobalValue", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-178.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-178.js new file mode 100644 index 0000000000..12909a5a53 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-178.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.5-4-178 +description: > + Object.create - 'writable' property of one property in + 'Properties' is true (8.10.5 step 6) +---*/ + +var newObj = Object.create({}, { + prop: { + writable: true + } +}); + +var beforeWrite = ((newObj.hasOwnProperty("prop") && typeof(newObj.prop) === "undefined")); + +newObj.prop = "isWritable"; + +var afterWrite = (newObj.prop === "isWritable"); + +assert.sameValue(beforeWrite, true, 'beforeWrite'); +assert.sameValue(afterWrite, true, 'afterWrite'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-179.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-179.js new file mode 100644 index 0000000000..ceb1884864 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-179.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.5-4-179 +description: > + Object.create - 'writable' property of one property in + 'Properties' is not present (8.10.5 step 6) +includes: [propertyHelper.js] +---*/ + +var newObj = Object.create({}, { + prop: { + value: 100 + } +}); + +assert.sameValue(newObj.prop, 100); +verifyNotWritable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-18.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-18.js new file mode 100644 index 0000000000..d2f40e6bb7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-18.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.5-4-18 +description: > + Object.create - an enumerable inherited data property in + 'Properties' is not defined in 'obj' (15.2.3.7 step 3) +---*/ + +var proto = {}; + +proto.prop = {}; + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var child = new ConstructFun(); + +var newObj = Object.create({}, child); + +assert.sameValue(newObj.hasOwnProperty("prop"), false, 'newObj.hasOwnProperty("prop")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-180.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-180.js new file mode 100644 index 0000000000..636acd7cb1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-180.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.5-4-180 +description: > + Object.create - 'writable' property of one property in + 'Properties' is own data property (8.10.5 step 6.a) +---*/ + +var newObj = Object.create({}, { + prop: { + writable: true + } +}); + +var beforeWrite = (newObj.hasOwnProperty("prop") && typeof(newObj.prop) === "undefined"); + +newObj.prop = "isWritable"; + +var afterWrite = (newObj.prop === "isWritable"); + +assert.sameValue(beforeWrite, true, 'beforeWrite'); +assert.sameValue(afterWrite, true, 'afterWrite'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-181.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-181.js new file mode 100644 index 0000000000..b5f479520c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-181.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.5-4-181 +description: > + Object.create - 'writable' property of one property in + 'Properties' is an inherited data property (8.10.5 step 6.a) +---*/ + +var proto = { + writable: true +}; + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var descObj = new ConstructFun(); + +var newObj = Object.create({}, { + prop: descObj +}); + +var beforeWrite = (newObj.hasOwnProperty("prop") && typeof(newObj.prop) === "undefined"); + +newObj.prop = "isWritable"; + +var afterWrite = (newObj.prop === "isWritable"); + +assert.sameValue(beforeWrite, true, 'beforeWrite'); +assert.sameValue(afterWrite, true, 'afterWrite'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-182.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-182.js new file mode 100644 index 0000000000..6411c8c6ac --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-182.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.5-4-182 +description: > + Object.create - 'writable' property of one property in + 'Properties' is own data property that overrides an inherited data + property (8.10.5 step 6.a) +---*/ + +var proto = { + writable: false +}; + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var descObj = new ConstructFun(); + +descObj.writable = true; + +var newObj = Object.create({}, { + prop: descObj +}); + +var beforeWrite = (newObj.hasOwnProperty("prop") && typeof(newObj.prop) === "undefined"); + +newObj.prop = "isWritable"; + +var afterWrite = (newObj.prop === "isWritable"); + +assert.sameValue(beforeWrite, true, 'beforeWrite'); +assert.sameValue(afterWrite, true, 'afterWrite'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-183.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-183.js new file mode 100644 index 0000000000..5b20b6b489 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-183.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.5-4-183 +description: > + Object.create - 'writable' property of one property in + 'Properties' is own data property that overrides an inherited + accessor property (8.10.5 step 6.a) +---*/ + +var proto = {}; + +Object.defineProperty(proto, "writable", { + get: function() { + return false; + } +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var descObj = new ConstructFun(); + +Object.defineProperty(descObj, "writable", { + value: true +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +var beforeWrite = (newObj.hasOwnProperty("prop") && typeof(newObj.prop) === "undefined"); + +newObj.prop = "isWritable"; + +var afterWrite = (newObj.prop === "isWritable"); + +assert.sameValue(beforeWrite, true, 'beforeWrite'); +assert.sameValue(afterWrite, true, 'afterWrite'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-184.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-184.js new file mode 100644 index 0000000000..8730b117f0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-184.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.5-4-184 +description: > + Object.create - 'writable' property of one property in + 'Properties' is own accessor property (8.10.5 step 6.a) +---*/ + +var descObj = {}; + +Object.defineProperty(descObj, "writable", { + get: function() { + return true; + } +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +var beforeWrite = (newObj.hasOwnProperty("prop") && typeof(newObj.prop) === "undefined"); + +newObj.prop = "isWritable"; + +var afterWrite = (newObj.prop === "isWritable"); + +assert.sameValue(beforeWrite, true, 'beforeWrite'); +assert.sameValue(afterWrite, true, 'afterWrite'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-185.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-185.js new file mode 100644 index 0000000000..7803262e89 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-185.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.5-4-185 +description: > + Object.create - 'writable' property of one property in + 'Properties' is an inherited accessor property (8.10.5 step 6.a) +---*/ + +var proto = {}; + +Object.defineProperty(proto, "writable", { + get: function() { + return true; + } +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var descObj = new ConstructFun(); + +var newObj = Object.create({}, { + prop: descObj +}); + +var beforeWrite = (newObj.hasOwnProperty("prop") && typeof(newObj.prop) === "undefined"); + +newObj.prop = "isWritable"; + +var afterWrite = (newObj.prop === "isWritable"); + +assert.sameValue(beforeWrite, true, 'beforeWrite'); +assert.sameValue(afterWrite, true, 'afterWrite'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-186.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-186.js new file mode 100644 index 0000000000..5ca6b121a6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-186.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.5-4-186 +description: > + Object.create - 'writable' property of one property in + 'Properties' is own accessor property that overrides an inherited + data property (8.10.5 step 6.a) +---*/ + +var proto = { + writable: false +}; + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var descObj = new ConstructFun(); + +Object.defineProperty(descObj, "writable", { + get: function() { + return true; + } +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +var beforeWrite = (newObj.hasOwnProperty("prop") && typeof(newObj.prop) === "undefined"); + +newObj.prop = "isWritable"; + +var afterWrite = (newObj.prop === "isWritable"); + +assert.sameValue(beforeWrite, true, 'beforeWrite'); +assert.sameValue(afterWrite, true, 'afterWrite'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-187.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-187.js new file mode 100644 index 0000000000..b9dc52e885 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-187.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.5-4-187 +description: > + Object.create - 'writable' property of one property in + 'Properties' is own accessor property that overrides an inherited + accessor property (8.10.5 step 6.a) +---*/ + +var proto = {}; + +Object.defineProperty(proto, "writable", { + get: function() { + return false; + } +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var descObj = new ConstructFun(); + +Object.defineProperty(descObj, "writable", { + get: function() { + return true; + } +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +var beforeWrite = (newObj.hasOwnProperty("prop") && typeof(newObj.prop) === "undefined"); + +newObj.prop = "isWritable"; + +var afterWrite = (newObj.prop === "isWritable"); + +assert.sameValue(beforeWrite, true, 'beforeWrite'); +assert.sameValue(afterWrite, true, 'afterWrite'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-188.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-188.js new file mode 100644 index 0000000000..91d8c80a52 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-188.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.5-4-188 +description: > + Object.create - 'writable' property of one property in + 'Properties' is own accessor property without a get function + (8.10.5 step 6.a) +includes: [propertyHelper.js] +---*/ + +var descObj = { + value: 100 +}; + +Object.defineProperty(descObj, "writable", { + set: function() {} +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert.sameValue(newObj.prop, 100); +verifyNotWritable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-189.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-189.js new file mode 100644 index 0000000000..13f8a80bd2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-189.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.5-4-189 +description: > + Object.create - 'writable' property of one property in + 'Properties' is own accessor property without a get function, + which overrides an inherited accessor property (8.10.5 step 6.a) +includes: [propertyHelper.js] +---*/ + +var proto = {}; + +Object.defineProperty(proto, "writable", { + get: function() { + return true; + } +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var descObj = new ConstructFun(); + +Object.defineProperty(descObj, "writable", { + set: function() {} +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert(newObj.hasOwnProperty("prop")) +assert.sameValue(typeof(newObj.prop), "undefined"); +verifyNotWritable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-19.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-19.js new file mode 100644 index 0000000000..184035110f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-19.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.5-4-19 +description: > + Object.create - own enumerable accessor property in 'Properties' + is defined in 'obj' (15.2.3.7 step 3) +---*/ + +var props = {}; + +Object.defineProperty(props, "prop", { + get: function() { + return {}; + }, + enumerable: true +}); + +var newObj = Object.create({}, props); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-190.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-190.js new file mode 100644 index 0000000000..039dd3b032 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-190.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.5-4-190 +description: > + Object.create - 'writable' property of one property in + 'Properties' is an inherited accessor property without a get + function (8.10.5 step 6.a) +includes: [propertyHelper.js] +---*/ + +var proto = { + value: 100 +}; + +Object.defineProperty(proto, "writable", { + set: function() {} +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var descObj = new ConstructFun(); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert.sameValue(newObj.prop, 100); +verifyNotWritable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-191.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-191.js new file mode 100644 index 0000000000..3dbadeb744 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-191.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.5-4-191 +description: > + Object.create - one property in 'Properties' is a Function object + which implements its own [[Get]] method to access the 'writable' + property (8.10.5 step 6.a) +---*/ + +var Func = function(a, b) { + return a + b; +}; + +var fun = new Func(); +fun.writable = true; + +var newObj = Object.create({}, { + prop: fun +}); + +var beforeWrite = (newObj.hasOwnProperty("prop") && typeof(newObj.prop) === "undefined"); + +newObj.prop = "isWritable"; + +var afterWrite = (newObj.prop === "isWritable"); + +assert.sameValue(beforeWrite, true, 'beforeWrite'); +assert.sameValue(afterWrite, true, 'afterWrite'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-192.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-192.js new file mode 100644 index 0000000000..6fe4fba7ff --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-192.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.5-4-192 +description: > + Object.create - one property in 'Properties' is an Array object + that uses Object's [[Get]] method to access the 'writable' + property (8.10.5 step 6.a) +---*/ + +var array = [1, 2, 3]; + +array.writable = true; + +var newObj = Object.create({}, { + prop: array +}); + +var beforeWrite = (newObj.hasOwnProperty("prop") && typeof(newObj.prop) === "undefined"); + +newObj.prop = "isWritable"; + +var afterWrite = (newObj.prop === "isWritable"); + +assert.sameValue(beforeWrite, true, 'beforeWrite'); +assert.sameValue(afterWrite, true, 'afterWrite'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-193.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-193.js new file mode 100644 index 0000000000..47240c4dd0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-193.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.5-4-193 +description: > + Object.create - one property in 'Properties' is a String object + that uses Object's [[Get]] method to access the 'writable' + property (8.10.5 step 6.a) +---*/ + +var str = new String("abc"); + +str.writable = true; + +var newObj = Object.create({}, { + prop: str +}); + +var beforeWrite = (newObj.hasOwnProperty("prop") && typeof(newObj.prop) === "undefined"); + +newObj.prop = "isWritable"; + +var afterWrite = (newObj.prop === "isWritable"); + +assert.sameValue(beforeWrite, true, 'beforeWrite'); +assert.sameValue(afterWrite, true, 'afterWrite'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-194.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-194.js new file mode 100644 index 0000000000..061db08d86 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-194.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.5-4-194 +description: > + Object.create - one property in 'Properties' is a Boolean object + that uses Object's [[Get]] method to access the 'writable' + property (8.10.5 step 6.a) +---*/ + +var booleanObj = new Boolean(false); + +booleanObj.writable = true; + +var newObj = Object.create({}, { + prop: booleanObj +}); + +var beforeWrite = (newObj.hasOwnProperty("prop") && typeof(newObj.prop) === "undefined"); + +newObj.prop = "isWritable"; + +var afterWrite = (newObj.prop === "isWritable"); + +assert.sameValue(beforeWrite, true, 'beforeWrite'); +assert.sameValue(afterWrite, true, 'afterWrite'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-195.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-195.js new file mode 100644 index 0000000000..ba44b9ce1b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-195.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.5-4-195 +description: > + Object.create - one property in 'Properties' is a Number object + that uses Object's [[Get]] method to access the 'writable' + property (8.10.5 step 6.a) +---*/ + +var numObj = new Number(123); + +numObj.writable = true; + +var newObj = Object.create({}, { + prop: numObj +}); + +var beforeWrite = (newObj.hasOwnProperty("prop") && typeof(newObj.prop) === "undefined"); + +newObj.prop = "isWritable"; + +var afterWrite = (newObj.prop === "isWritable"); + +assert.sameValue(beforeWrite, true, 'beforeWrite'); +assert.sameValue(afterWrite, true, 'afterWrite'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-196.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-196.js new file mode 100644 index 0000000000..126fd4d2f6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-196.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.5-4-196 +description: > + Object.create - one property in 'Properties' is the Math object + that uses Object's [[Get]] method to access the 'writable' + property (8.10.5 step 6.a) +---*/ + +Math.writable = true; + +var newObj = Object.create({}, { + prop: Math +}); + +var beforeWrite = (newObj.hasOwnProperty("prop") && typeof(newObj.prop) === "undefined"); + +newObj.prop = "isWritable"; + +var afterWrite = (newObj.prop === "isWritable"); + +assert.sameValue(beforeWrite, true, 'beforeWrite'); +assert.sameValue(afterWrite, true, 'afterWrite'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-197.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-197.js new file mode 100644 index 0000000000..f2caa7473c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-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.5-4-197 +description: > + Object.create - one property in 'Properties' is a Date object that + uses Object's [[Get]] method to access the 'writable' property + (8.10.5 step 6.a) +---*/ + +var dateObj = new Date(); + +dateObj.writable = true; + +var newObj = Object.create({}, { + prop: dateObj +}); + +var beforeWrite = (newObj.hasOwnProperty("prop") && typeof(newObj.prop) === "undefined"); + +newObj.prop = "isWritable"; + +var afterWrite = (newObj.prop === "isWritable"); + +assert.sameValue(beforeWrite, true, 'beforeWrite'); +assert.sameValue(afterWrite, true, 'afterWrite'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-198.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-198.js new file mode 100644 index 0000000000..de7de58c8c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-198.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.5-4-198 +description: > + Object.create - one property in 'Properties' is a RegExp object + that uses Object's [[Get]] method to access the 'writable' + property (8.10.5 step 6.a) +---*/ + +var regObj = new RegExp(); + +regObj.writable = true; + +var newObj = Object.create({}, { + prop: regObj +}); + +var beforeWrite = (newObj.hasOwnProperty("prop") && typeof(newObj.prop) === "undefined"); + +newObj.prop = "isWritable"; + +var afterWrite = (newObj.prop === "isWritable"); + +assert.sameValue(beforeWrite, true, 'beforeWrite'); +assert.sameValue(afterWrite, true, 'afterWrite'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-199.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-199.js new file mode 100644 index 0000000000..d63a204ed6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-199.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.5-4-199 +description: > + Object.create - one property in 'Properties' is the JSON object + that uses Object's [[Get]] method to access the 'writable' + property (8.10.5 step 6.a) +---*/ + +JSON.writable = true; + +var newObj = Object.create({}, { + prop: JSON +}); + +var beforeWrite = (newObj.hasOwnProperty("prop") && typeof(newObj.prop) === "undefined"); + +newObj.prop = "isWritable"; + +var afterWrite = (newObj.prop === "isWritable"); + +assert.sameValue(beforeWrite, true, 'beforeWrite'); +assert.sameValue(afterWrite, true, 'afterWrite'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-2.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-2.js new file mode 100644 index 0000000000..a2a0f5181f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-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.5-4-2 +description: Object.create - 'Properties' is undefined +---*/ + +var newObj = Object.create({}, undefined); + +assert((newObj instanceof Object), '(newObj instanceof Object) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-20.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-20.js new file mode 100644 index 0000000000..e74f81b160 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-20.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.5-4-20 +description: > + Object.create - own accessor property in 'Properties' which is not + enumerable is not defined in 'obj' (15.2.3.7 step 3) +---*/ + +var props = {}; + +Object.defineProperty(props, "prop", { + get: function() { + return {}; + }, + enumerable: false +}); + +var newObj = Object.create({}, props); + +assert.sameValue(newObj.hasOwnProperty("prop"), false, 'newObj.hasOwnProperty("prop")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-200.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-200.js new file mode 100644 index 0000000000..894b392422 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-200.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.5-4-200 +description: > + Object.create - one property in 'Properties' is an Error object + that uses Object's [[Get]] method to access the 'writable' + property (8.10.5 step 6.a) +---*/ + +var errorObj = new Error(); + +errorObj.writable = true; + +var newObj = Object.create({}, { + prop: errorObj +}); + +var beforeWrite = (newObj.hasOwnProperty("prop") && typeof(newObj.prop) === "undefined"); + +newObj.prop = "isWritable"; + +var afterWrite = (newObj.prop === "isWritable"); + +assert.sameValue(beforeWrite, true, 'beforeWrite'); +assert.sameValue(afterWrite, true, 'afterWrite'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-201.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-201.js new file mode 100644 index 0000000000..f1a3bc5ecb --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-201.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.5-4-201 +description: > + Object.create - one property in 'Properties' is an Arguments + object which implements its own [[Get]] method to access the + 'writable' property (8.10.5 step 6.a) +---*/ + +var argObj = (function() { + return arguments; +})(); + +argObj.writable = true; + +var newObj = Object.create({}, { + prop: argObj +}); + +var beforeWrite = (newObj.hasOwnProperty("prop") && typeof(newObj.prop) === "undefined"); + +newObj.prop = "isWritable"; + +var afterWrite = (newObj.prop === "isWritable"); + +assert.sameValue(beforeWrite, true, 'beforeWrite'); +assert.sameValue(afterWrite, true, 'afterWrite'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-203.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-203.js new file mode 100644 index 0000000000..71a827d470 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-203.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.5-4-203 +description: > + Object.create - one property in 'Properties' is the global object + that uses Object's [[Get]] method to access the 'writable' + property (8.10.5 step 6.a) +---*/ + +this.writable = true; + +var newObj = Object.create({}, { + prop: this +}); + +var beforeWrite = (newObj.hasOwnProperty("prop") && typeof(newObj.prop) === "undefined"); + +newObj.prop = "isWritable"; + +var afterWrite = (newObj.prop === "isWritable"); + +assert.sameValue(beforeWrite, true, 'beforeWrite'); +assert.sameValue(afterWrite, true, 'afterWrite'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-204.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-204.js new file mode 100644 index 0000000000..17993ba415 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-204.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.5-4-204 +description: > + Object.create - 'writable' property of one property in + 'Properties' is undefined (8.10.5 step 6.b) +includes: [propertyHelper.js] +---*/ + +var newObj = Object.create({}, { + prop: { + writable: undefined + } +}); + +assert(newObj.hasOwnProperty("prop")); +assert.sameValue(typeof newObj.prop, "undefined"); +verifyNotWritable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-205.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-205.js new file mode 100644 index 0000000000..7e414aa5dd --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-205.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.5-4-205 +description: > + Object.create - 'writable' property of one property in + 'Properties' is null (8.10.5 step 6.b) +includes: [propertyHelper.js] +---*/ + +var newObj = Object.create({}, { + prop: { + writable: null + } +}); + +assert(newObj.hasOwnProperty("prop")); +assert.sameValue(typeof newObj.prop, "undefined"); +verifyNotWritable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-206.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-206.js new file mode 100644 index 0000000000..48835ea81a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-206.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.5-4-206 +description: > + Object.create - 'writable' property of one property in + 'Properties' is true (8.10.5 step 6.b) +---*/ + +var newObj = Object.create({}, { + prop: { + writable: true + } +}); +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = 121; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(newObj.prop, 121, 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-207.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-207.js new file mode 100644 index 0000000000..40513388d8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-207.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.5-4-207 +description: > + Object.create - 'writable' property of one property in + 'Properties' is false (8.10.5 step 6.b) +includes: [propertyHelper.js] +---*/ + +var newObj = Object.create({}, { + prop: { + writable: false + } +}); + +assert(newObj.hasOwnProperty("prop")); +assert.sameValue(typeof newObj.prop, "undefined"); +verifyNotWritable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-208.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-208.js new file mode 100644 index 0000000000..864af6abf5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-208.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.5-4-208 +description: > + Object.create - 'writable' property of one property in + 'Properties' is 0 (8.10.5 step 6.b) +includes: [propertyHelper.js] +---*/ + +var newObj = Object.create({}, { + prop: { + writable: 0 + } +}); + +assert(newObj.hasOwnProperty("prop")); +assert.sameValue(typeof newObj.prop, "undefined"); +verifyNotWritable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-209.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-209.js new file mode 100644 index 0000000000..057ad51efe --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-209.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.5-4-209 +description: > + Object.create - 'writable' property of one property in + 'Properties' is +0 (8.10.5 step 6.b) +includes: [propertyHelper.js] +---*/ + +var newObj = Object.create({}, { + prop: { + writable: +0 + } +}); + +assert(newObj.hasOwnProperty("prop")); +assert.sameValue(typeof newObj.prop, "undefined"); +verifyNotWritable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-21.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-21.js new file mode 100644 index 0000000000..1b5fac19da --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-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.5-4-21 +description: > + Object.create - an enumerable inherited accessor property in + 'Properties' is not defined in 'obj' (15.2.3.7 step 3) +---*/ + +var proto = {}; + +Object.defineProperty(proto, "prop", { + get: function() { + return {}; + }, + enumerable: true +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var child = new ConstructFun(); + +var newObj = Object.create({}, child); + +assert.sameValue(newObj.hasOwnProperty("prop"), false, 'newObj.hasOwnProperty("prop")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-210.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-210.js new file mode 100644 index 0000000000..d6ff45fb8c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-210.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.5-4-210 +description: > + Object.create - 'writable' property of one property in + 'Properties' is -0 (8.10.5 step 6.b) +includes: [propertyHelper.js] +---*/ + +var newObj = Object.create({}, { + prop: { + writable: -0 + } +}); + +assert(newObj.hasOwnProperty("prop")) +assert.sameValue(typeof newObj.prop, "undefined"); +verifyNotWritable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-211.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-211.js new file mode 100644 index 0000000000..84a03d23c3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-211.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.5-4-211 +description: > + Object.create - 'writable' property of one property in + 'Properties' is NaN (8.10.5 step 6.b) +includes: [propertyHelper.js] +---*/ + +var newObj = Object.create({}, { + prop: { + writable: NaN + } +}); + +assert(newObj.hasOwnProperty("prop")); +assert.sameValue(typeof newObj.prop, "undefined") +verifyNotWritable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-212.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-212.js new file mode 100644 index 0000000000..723da90ebe --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-212.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.5-4-212 +description: > + Object.create - 'writable' property of one property in + 'Properties' is a positive number primitive (8.10.5 step 6.b) +---*/ + +var newObj = Object.create({}, { + prop: { + writable: 12 + } +}); +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = 121; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(newObj.prop, 121, 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-213.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-213.js new file mode 100644 index 0000000000..e1c301211b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-213.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.5-4-213 +description: > + Object.create - 'writable' property of one property in + 'Properties' is a negative number primitive (8.10.5 step 6.b) +---*/ + +var newObj = Object.create({}, { + prop: { + writable: -9 + } +}); +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = 121; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(newObj.prop, 121, 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-214.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-214.js new file mode 100644 index 0000000000..209db64dda --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-214.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.5-4-214 +description: > + Object.create - 'writable' property of one property in + 'Properties' is an empty string (8.10.5 step 6.b) +includes: [propertyHelper.js] +---*/ + +var descObj = { + writable: "" +}; + +var newObj = Object.create({}, { + prop: descObj +}); + +assert(newObj.hasOwnProperty("prop")) +assert.sameValue(typeof newObj.prop, "undefined"); +verifyNotWritable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-215.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-215.js new file mode 100644 index 0000000000..2016749225 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-215.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.5-4-215 +description: > + Object.create - 'writable' property of one property in + 'Properties' is a non-empty string (8.10.5 step 6.b) +---*/ + +var newObj = Object.create({}, { + prop: { + writable: "abc" + } +}); +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = 121; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(newObj.prop, 121, 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-216.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-216.js new file mode 100644 index 0000000000..09acc279db --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-216.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.5-4-216 +description: > + Object.create - 'writable' property of one property in + 'Properties' is a Function object (8.10.5 step 6.b) +---*/ + +var newObj = Object.create({}, { + prop: { + writable: function() {} + } +}); +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = 121; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(newObj.prop, 121, 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-217.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-217.js new file mode 100644 index 0000000000..300cd90726 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-217.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.5-4-217 +description: > + Object.create - 'writable' property of one property in + 'Properties' is an Array object (8.10.5 step 6.b) +---*/ + +var newObj = Object.create({}, { + prop: { + writable: [] + } +}); +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = 121; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(newObj.prop, 121, 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-218.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-218.js new file mode 100644 index 0000000000..2bb6d8008e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-218.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.5-4-218 +description: > + Object.create - 'writable' property of one property in + 'Properties' is a String object (8.10.5 step 6.b) +---*/ + +var newObj = Object.create({}, { + prop: { + writable: new String() + } +}); +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = 121; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(newObj.prop, 121, 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-219.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-219.js new file mode 100644 index 0000000000..e44bc46416 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-219.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.5-4-219 +description: > + Object.create - 'writable' property of one property in + 'Properties' is a Boolean object (8.10.5 step 6.b) +---*/ + +var newObj = Object.create({}, { + prop: { + writable: new Boolean() + } +}); +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = 121; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(newObj.prop, 121, 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-22.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-22.js new file mode 100644 index 0000000000..65bacdb035 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-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.5-4-22 +description: > + Object.create - own enumerable data property that overrides an + enumerable inherited data property in 'Properties' is defined in + 'obj' (15.2.3.7 step 5.a) +---*/ + +var proto = {}; +proto.prop = { + value: "abc" +}; + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var child = new ConstructFun(); +child.prop = { + value: "bbq" +}; +var newObj = Object.create({}, child); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); +assert.sameValue(newObj.prop, "bbq", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-220.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-220.js new file mode 100644 index 0000000000..a6d95f9c49 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-220.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.5-4-220 +description: > + Object.create - 'writable' property of one property in + 'Properties' is a Number object (8.10.5 step 6.b) +---*/ + +var newObj = Object.create({}, { + prop: { + writable: new Number() + } +}); +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = 121; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(newObj.prop, 121, 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-221.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-221.js new file mode 100644 index 0000000000..3bc9d558ee --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-221.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.5-4-221 +description: > + Object.create - 'writable' property of one property in + 'Properties' is the Math object (8.10.5 step 6.b) +---*/ + +var newObj = Object.create({}, { + prop: { + writable: Math + } +}); +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = 121; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(newObj.prop, 121, 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-222.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-222.js new file mode 100644 index 0000000000..2886c38b7e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-222.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.5-4-222 +description: > + Object.create - 'writable' property of one property in + 'Properties' is a Date object (8.10.5 step 6.b) +---*/ + +var newObj = Object.create({}, { + prop: { + writable: new Date() + } +}); +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = 121; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(newObj.prop, 121, 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-223.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-223.js new file mode 100644 index 0000000000..fb929326ee --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-223.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.5-4-223 +description: > + Object.create - 'writable' property of one property in + 'Properties' is a RegExp object (8.10.5 step 6.b) +---*/ + +var newObj = Object.create({}, { + prop: { + writable: new RegExp() + } +}); +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = 121; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(newObj.prop, 121, 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-224.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-224.js new file mode 100644 index 0000000000..0db31ebbd9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-224.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.5-4-224 +description: > + Object.create - 'writable' property of one property in + 'Properties' is the JSON object (8.10.5 step 6.b) +---*/ + +var newObj = Object.create({}, { + prop: { + writable: JSON + } +}); +var hasProperty = newObj.hasOwnProperty("prop"); +newObj.prop = 121; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(newObj.prop, 121, 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-225.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-225.js new file mode 100644 index 0000000000..41e5928dde --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-225.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.5-4-225 +description: > + Object.create - 'writable' property of one property in + 'Properties' is an Error object (8.10.5 step 6.b) +---*/ + +var newObj = Object.create({}, { + prop: { + writable: new Error() + } +}); +var hasProperty = newObj.hasOwnProperty("prop"); +newObj.prop = 121; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(newObj.prop, 121, 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-226.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-226.js new file mode 100644 index 0000000000..27f226c709 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-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.5-4-226 +description: > + Object.create - 'writable' property of one property in + 'Properties' is an Arguments object (8.10.5 step 6.b) +---*/ + +var argObj = (function() { + return arguments; +})(); + +var newObj = Object.create({}, { + prop: { + writable: argObj + } +}); +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = 121; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(newObj.prop, 121, 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-228.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-228.js new file mode 100644 index 0000000000..93a21d0e7e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-228.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.5-4-228 +description: > + Object.create - 'writable' property of one property in + 'Properties' is the global object (8.10.5 step 6.b) +---*/ + +var newObj = Object.create({}, { + prop: { + writable: this + } +}); +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = 121; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(newObj.prop, 121, 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-229.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-229.js new file mode 100644 index 0000000000..ea6c2fc911 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-229.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.5-4-229 +description: > + Object.create - 'writable' property of one property in + 'Properties' is a string (value is 'false') which is treated as + the value true (8.10.5 step 6.b) +---*/ + +var newObj = Object.create({}, { + prop: { + writable: "false" + } +}); +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = 121; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(newObj.prop, 121, 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-23.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-23.js new file mode 100644 index 0000000000..fe5269854b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-23.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.5-4-23 +description: > + Object.create - own enumerable data property that overrides an + enumerable inherited accessor property in 'Properties' is defined + in 'obj' (15.2.3.7 step 5.a) +---*/ + +var proto = {}; +Object.defineProperty(proto, "prop", { + get: function() { + return { + value: 9 + }; + }, + enumerable: true +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var child = new ConstructFun(); +Object.defineProperty(child, "prop", { + value: { + value: 12 + }, + enumerable: true +}); +var newObj = Object.create({}, child); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); +assert.sameValue(newObj.prop, 12, 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-230.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-230.js new file mode 100644 index 0000000000..812eea4192 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-230.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.5-4-230 +description: > + Object.create - 'writable' property of one property in + 'Properties' is new Boolean(false) which is treated as the value + true (8.10.5 step 6.b) +---*/ + +var newObj = Object.create({}, { + prop: { + writable: new Boolean(false) + } +}); +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = 121; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(newObj.prop, 121, 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-231.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-231.js new file mode 100644 index 0000000000..32b5ce06d6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-231.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.5-4-231 +description: > + Object.create - 'get' property of one property in 'Properties' is + present (8.10.5 step 7) +---*/ + +var newObj = Object.create({}, { + prop: { + get: function() { + return "present"; + } + } +}); + +assert.sameValue(newObj.prop, "present", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-232.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-232.js new file mode 100644 index 0000000000..95906d5e81 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-232.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.5-4-232 +description: > + Object.create - 'get' property of one property in 'Properties' is + not present (8.10.5 step 7) +---*/ + +var newObj = Object.create({}, { + prop: {} +}); + +assert.sameValue(typeof(newObj.prop), "undefined", 'typeof (newObj.prop)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-233.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-233.js new file mode 100644 index 0000000000..7ff6c0a662 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-233.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.5-4-233 +description: > + Object.create - 'get' property of one property in 'Properties' is + own data property (8.10.5 step 7.a) +---*/ + +var newObj = Object.create({}, { + prop: { + get: function() { + return "ownDataProperty"; + } + } +}); + +assert.sameValue(newObj.prop, "ownDataProperty", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-234.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-234.js new file mode 100644 index 0000000000..d09d67d856 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-234.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.5-4-234 +description: > + Object.create - 'get' property of one property in 'Properties' is + an inherited data property (8.10.5 step 7.a) +---*/ + +var proto = { + get: function() { + return "inheritedDataProperty"; + } +}; + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var descObj = new ConstructFun(); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert.sameValue(newObj.prop, "inheritedDataProperty", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-235.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-235.js new file mode 100644 index 0000000000..8ebe324a04 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-235.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.5-4-235 +description: > + Object.create - 'get' property of one property in 'Properties' is + own data property that overrides an inherited data property + (8.10.5 step 7.a) +---*/ + +var proto = { + get: function() { + return "inheritedDataProperty"; + } +}; + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var descObj = new ConstructFun(); + +Object.defineProperty(descObj, "get", { + value: function() { + return "ownDataProperty"; + } +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert.sameValue(newObj.prop, "ownDataProperty", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-236.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-236.js new file mode 100644 index 0000000000..297bba9229 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-236.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.5-4-236 +description: > + Object.create - 'get' property of one property in 'Properties' is + own data property that overrides an inherited accessor property + (8.10.5 step 7.a) +---*/ + +var proto = {}; + +Object.defineProperty(proto, "get", { + get: function() { + return function() { + return "inheritedAccessorProperty"; + }; + } +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var descObj = new ConstructFun(); + +Object.defineProperty(descObj, "get", { + value: function() { + return "ownDataProperty"; + } +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert.sameValue(newObj.prop, "ownDataProperty", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-237.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-237.js new file mode 100644 index 0000000000..8cc6d0a20f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-237.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.5-4-237 +description: > + Object.create - 'get' property of one property in 'Properties' is + own accessor property (8.10.5 step 7.a) +---*/ + +var descObj = {}; + +Object.defineProperty(descObj, "get", { + get: function() { + return function() { + return "ownAccessorProperty"; + }; + } +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert.sameValue(newObj.prop, "ownAccessorProperty", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-238.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-238.js new file mode 100644 index 0000000000..f2c870acf7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-238.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.5-4-238 +description: > + Object.create - 'get' property of one property in 'Properties' is + an inherited accessor property (8.10.5 step 7.a) +---*/ + +var proto = {}; + +Object.defineProperty(proto, "get", { + get: function() { + return function() { + return "inheritedAccessorProperty"; + }; + } +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var descObj = new ConstructFun(); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert.sameValue(newObj.prop, "inheritedAccessorProperty", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-239.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-239.js new file mode 100644 index 0000000000..64eb0180a1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-239.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.5-4-239 +description: > + Object.create - 'get' property of one property in 'Properties' is + own accessor property that overrides an inherited data property + (8.10.5 step 7.a) +---*/ + +var proto = { + get: function() { + return "inheritedDataProperty"; + } +}; + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var descObj = new ConstructFun(); + +Object.defineProperty(descObj, "get", { + get: function() { + return function() { + return "ownAccessorProperty"; + }; + } +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert.sameValue(newObj.prop, "ownAccessorProperty", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-24.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-24.js new file mode 100644 index 0000000000..77201cbe20 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-24.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.5-4-24 +description: > + Object.create - own enumerable accessor property that overrides an + enumerable inherited data property in 'Properties' is defined in + 'obj' (15.2.3.7 step 5.a) +---*/ + +var proto = {}; +proto.prop = { + value: 12 +}; + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var child = new ConstructFun(); +Object.defineProperty(child, "prop", { + get: function() { + return { + value: 9 + }; + }, + enumerable: true +}); + +var newObj = Object.create({}, child); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); +assert.sameValue(newObj.prop, 9, 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-240.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-240.js new file mode 100644 index 0000000000..5746060022 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-240.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.5-4-240 +description: > + Object.create - 'get' property of one property in 'Properties' is + own accessor property that overrides an inherited accessor + property (8.10.5 step 7.a) +---*/ + +var proto = {}; + +Object.defineProperty(proto, "get", { + get: function() { + return function() { + return "inheritedAccessorProperty"; + }; + } +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var descObj = new ConstructFun(); + +Object.defineProperty(descObj, "get", { + get: function() { + return function() { + return "ownAccessorProperty"; + }; + } +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert.sameValue(newObj.prop, "ownAccessorProperty", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-241.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-241.js new file mode 100644 index 0000000000..97e9ec83f8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-241.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.5-4-241 +description: > + Object.create - 'get' property of one property in 'Properties' is + own accessor property without a get function (8.10.5 step 7.a) +---*/ + +var descObj = {}; + +Object.defineProperty(descObj, "get", { + set: function() {} +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); +assert.sameValue(typeof(newObj.prop), "undefined", 'typeof (newObj.prop)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-242.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-242.js new file mode 100644 index 0000000000..1525f501ad --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-242.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.5-4-242 +description: > + Object.create - 'get' property of one property in 'Properties' is + own accessor property without a get function, which overrides an + inherited accessor property (8.10.5 step 7.a) +---*/ + +var proto = {}; + +Object.defineProperty(proto, "get", { + get: function() { + return function() { + return "inheritedAccessorProperty"; + }; + } +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var descObj = new ConstructFun(); + +Object.defineProperty(descObj, "get", { + set: function() {} +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); +assert.sameValue(typeof newObj.prop, "undefined", 'typeof newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-243.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-243.js new file mode 100644 index 0000000000..556d8901f1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-243.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.5-4-243 +description: > + Object.create - 'get' property of one property in 'Properties' is + an inherited accessor property without a get function (8.10.5 step + 7.a) +---*/ + +var proto = {}; + +Object.defineProperty(proto, "get", { + set: function() {} +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var descObj = new ConstructFun(); + +var newObj = Object.create({}, { + prop: descObj +}); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); +assert.sameValue(typeof(newObj.prop), "undefined", 'typeof (newObj.prop)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-244.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-244.js new file mode 100644 index 0000000000..14308de518 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-244.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.5-4-244 +description: > + Object.create - one property in 'Properties' is a Function object + which implements its own [[Get]] method to access the 'get' + property (8.10.5 step 7.a) +---*/ + +var funObj = function() {}; + +funObj.get = function() { + return "VerifyFunctionObject"; +}; + +var newObj = Object.create({}, { + prop: funObj +}); + +assert.sameValue(newObj.prop, "VerifyFunctionObject", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-245.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-245.js new file mode 100644 index 0000000000..beef095e2b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-245.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.5-4-245 +description: > + Object.create - one property in 'Properties' is an Array object + that uses Object's [[Get]] method to access the 'get' property + (8.10.5 step 7.a) +---*/ + +var arrayObj = [1, 2, 3]; + +arrayObj.get = function() { + return "VerifyArrayObject"; +}; + +var newObj = Object.create({}, { + prop: arrayObj +}); + +assert.sameValue(newObj.prop, "VerifyArrayObject", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-246.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-246.js new file mode 100644 index 0000000000..3af5d5970d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-246.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.5-4-246 +description: > + Object.create - one property in 'Properties' is a String object + that uses Object's [[Get]] method to access the 'get' property + (8.10.5 step 7.a) +---*/ + +var strObj = new String("abc"); + +strObj.get = function() { + return "VerifyStringObject"; +}; + +var newObj = Object.create({}, { + prop: strObj +}); + +assert.sameValue(newObj.prop, "VerifyStringObject", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-247.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-247.js new file mode 100644 index 0000000000..b0553230f7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-247.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.5-4-247 +description: > + Object.create - one property in 'Properties' is a Boolean object + that uses Object's [[Get]] method to access the 'get' property + (8.10.5 step 7.a) +---*/ + +var boolObj = new Boolean(true); + +boolObj.get = function() { + return "VerifyBooleanObject"; +}; + +var newObj = Object.create({}, { + prop: boolObj +}); + +assert.sameValue(newObj.prop, "VerifyBooleanObject", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-248.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-248.js new file mode 100644 index 0000000000..20063a5ad7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-248.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.5-4-248 +description: > + Object.create - one property in 'Properties' is a Number object + that uses Object's [[Get]] method to access the 'get' property + (8.10.5 step 7.a) +---*/ + +var numObj = new Number(5); + +numObj.get = function() { + return "VerifyNumberObject"; +}; + +var newObj = Object.create({}, { + prop: numObj +}); + +assert.sameValue(newObj.prop, "VerifyNumberObject", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-249.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-249.js new file mode 100644 index 0000000000..568792ba24 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-249.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.5-4-249 +description: > + Object.create - one property in 'Properties' is a Date object that + uses Object's [[Get]] method to access the 'get' property (8.10.5 + step 7.a) +---*/ + +var dateObj = new Date(); + +dateObj.get = function() { + return "VerifyDateObject"; +}; + +var newObj = Object.create({}, { + prop: dateObj +}); + +assert.sameValue(newObj.prop, "VerifyDateObject", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-25.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-25.js new file mode 100644 index 0000000000..684a076430 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-25.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.5-4-25 +description: > + Object.create - own enumerable accessor property that overrides an + enumerable inherited accessor property in 'Properties' is defined + in 'obj' (15.2.3.7 step 5.a) +---*/ + +var proto = {}; +Object.defineProperty(proto, "prop", { + get: function() { + return { + value: 9 + }; + }, + enumerable: true +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var child = new ConstructFun(); +Object.defineProperty(child, "prop", { + get: function() { + return { + value: 12 + }; + }, + enumerable: true +}); +var newObj = Object.create({}, child); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); +assert.sameValue(newObj.prop, 12, 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-250.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-250.js new file mode 100644 index 0000000000..50dcac99fb --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-250.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.5-4-250 +description: > + Object.create - one property in 'Properties' is a RegExp object + that uses Object's [[Get]] method to access the 'get' property + (8.10.5 step 7.a) +---*/ + +var regObj = new RegExp(); + +regObj.get = function() { + return "VerifyRegExpObject"; +}; + +var newObj = Object.create({}, { + prop: regObj +}); + +assert.sameValue(newObj.prop, "VerifyRegExpObject", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-251.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-251.js new file mode 100644 index 0000000000..0c6493157a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-251.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.5-4-251 +description: > + Object.create - one property in 'Properties' is the Math object + that uses Object's [[Get]] method to access the 'get' property + (8.10.5 step 7.a) +---*/ + +Math.get = function() { + return "VerifyMathObject"; +}; + +var newObj = Object.create({}, { + prop: Math +}); + +assert.sameValue(newObj.prop, "VerifyMathObject", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-252.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-252.js new file mode 100644 index 0000000000..fff0d3cb5a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-252.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.5-4-252 +description: > + Object.create - one property in 'Properties' is the JSON object + that uses Object's [[Get]] method to access the 'get' property + (8.10.5 step 7.a) +---*/ + +JSON.get = function() { + return "VerifyJSONObject"; +}; + +var newObj = Object.create({}, { + prop: JSON +}); + +assert.sameValue(newObj.prop, "VerifyJSONObject", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-253.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-253.js new file mode 100644 index 0000000000..7eee063bc8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-253.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.5-4-253 +description: > + Object.create - one property in 'Properties' is an Error object + that uses Object's [[Get]] method to access the 'get' property + (8.10.5 step 7.a) +---*/ + +var errObj = new Error("error"); + +errObj.get = function() { + return "VerifyErrorObject"; +}; + +var newObj = Object.create({}, { + prop: errObj +}); + +assert.sameValue(newObj.prop, "VerifyErrorObject", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-254.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-254.js new file mode 100644 index 0000000000..62b7957f55 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-254.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.5-4-254 +description: > + Object.create - one property in 'Properties' is an Arguments + object which implements its own [[Get]] method to access the 'get' + property (8.10.5 step 7.a) +---*/ + +var argObj = (function() { + return arguments; +})(); + +argObj.get = function() { + return "VerifyArgumentsObject"; +}; + +var newObj = Object.create({}, { + prop: argObj +}); + +assert.sameValue(newObj.prop, "VerifyArgumentsObject", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-256.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-256.js new file mode 100644 index 0000000000..d234669950 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-256.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.5-4-256 +description: > + Object.create - one property in 'Properties' is the global object + that uses Object's [[Get]] method to access the 'get' property + (8.10.5 step 7.a) +---*/ + +this.get = function() { + return "VerifyGlobalObject"; +}; + +var newObj = Object.create({}, { + prop: this +}); + +assert.sameValue(newObj.prop, "VerifyGlobalObject", 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-257.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-257.js new file mode 100644 index 0000000000..6ae2cc1099 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-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.5-4-257 +description: > + Object.create - 'get' property of one property in 'Properties' is + undefined (8.10.5 step 7.b) +---*/ + +var newObj = Object.create({}, { + prop: { + get: undefined + } +}); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); +assert.sameValue(typeof newObj.prop, "undefined", 'typeof newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-258.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-258.js new file mode 100644 index 0000000000..73c7cf311b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-258.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.5-4-258 +description: > + Object.create - 'get' property of one property in 'Properties' is + the primitive value null (8.10.5 step 7.b) +---*/ + + +assert.throws(TypeError, function() { + Object.create({}, { + prop: { + get: null + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-259.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-259.js new file mode 100644 index 0000000000..7385349362 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-259.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.5-4-259 +description: > + Object.create - 'get' property of one property in 'Properties' is + a boolean primitive (8.10.5 step 7.b) +---*/ + + +assert.throws(TypeError, function() { + Object.create({}, { + prop: { + get: false + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-26.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-26.js new file mode 100644 index 0000000000..b50040b3de --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-26.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.5-4-26 +description: > + Object.create - TypeError is thrown when own enumerable accessor + property of 'Properties' without a get function (15.2.3.7 step 5.a) +---*/ + +var props = {}; +Object.defineProperty(props, "prop", { + set: function() {}, + enumerable: true +}); +assert.throws(TypeError, function() { + Object.create({}, props); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-260.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-260.js new file mode 100644 index 0000000000..8f0889cb87 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-260.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.5-4-260 +description: > + Object.create - 'get' property of one property in 'Properties' is + a number primitive (8.10.5 step 7.b) +---*/ + + +assert.throws(TypeError, function() { + Object.create({}, { + prop: { + get: 123 + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-261.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-261.js new file mode 100644 index 0000000000..242127990c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-261.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.5-4-261 +description: > + Object.create - 'get' property of one property in 'Properties' is + a primitive string (8.10.5 step 7.b) +---*/ + + +assert.throws(TypeError, function() { + Object.create({}, { + prop: { + get: "string" + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-262.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-262.js new file mode 100644 index 0000000000..58f1c79bad --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-262.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.5-4-262 +description: > + Object.create - 'get' property of one property in 'Properties' is + an Array object (8.10.5 step 7.b) +---*/ + + +assert.throws(TypeError, function() { + Object.create({}, { + prop: { + get: [1, 2, 3] + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-263.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-263.js new file mode 100644 index 0000000000..327a60e023 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-263.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.5-4-263 +description: > + Object.create - 'get' property of one property in 'Properties' is + a function (8.10.5 step 7.b) +---*/ + +var newObj = Object.create({}, { + prop: { + get: function() {} + } +}); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); +assert.sameValue(typeof newObj.prop, "undefined", 'typeof newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-266.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-266.js new file mode 100644 index 0000000000..263ca214e6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-266.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.5-4-266 +description: > + Object.create - 'set' property of one property in 'Properties' is + present (8.10.5 step 8) +---*/ + +var data = "data"; + +var newObj = Object.create({}, { + prop: { + set: function(value) { + data = value; + } + } +}); + +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = "overrideData"; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(data, "overrideData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-267.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-267.js new file mode 100644 index 0000000000..c22b3399ed --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-267.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.5-4-267 +description: > + Object.create - 'set' property of one property in 'Properties' is + not present (8.10.5 step 8) +includes: [propertyHelper.js] +---*/ + +var newObj = Object.create({}, { + prop: { + get: function() { + return "data"; + } + } +}); + +assert(newObj.hasOwnProperty("prop")); +verifyNotWritable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-268.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-268.js new file mode 100644 index 0000000000..28c11b08e1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-268.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.5-4-268 +description: > + Object.create - 'set' property of one property in 'Properties' is + own data property (8.10.5 step 8.a) +---*/ + +var data = "data"; + +var newObj = Object.create({}, { + prop: { + set: function(value) { + data = value; + } + } +}); + +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = "overrideData"; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(data, "overrideData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-269.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-269.js new file mode 100644 index 0000000000..97ebc48265 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-269.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.5-4-269 +description: > + Object.create - 'set' property of one property in 'Properties' is + an inherited data property (8.10.5 step 8.a) +---*/ + +var data = "data"; +var proto = { + set: function(value) { + data = value; + } +}; + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var child = new ConstructFun(); + +var newObj = Object.create({}, { + prop: child +}); + +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = "overrideData"; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(data, "overrideData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-27.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-27.js new file mode 100644 index 0000000000..d8a713220d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-27.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.5-4-27 +description: > + Object.create - own enumerable accessor property in 'Properties' + without a get function that overrides an enumerable inherited + accessor property in 'Properties' is defined in 'obj' (15.2.3.7 + step 5.a) +---*/ + +var proto = {}; +Object.defineProperty(proto, "prop", { + get: function() { + return {}; + }, + enumerable: true +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var child = new ConstructFun(); +Object.defineProperty(child, "prop", { + set: function() {}, + enumerable: true +}); +assert.throws(TypeError, function() { + Object.create({}, child); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-270.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-270.js new file mode 100644 index 0000000000..217295fc0b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-270.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.5-4-270 +description: > + Object.create - 'set' property of one property in 'Properties' 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 ConstructFun = function() {}; +ConstructFun.prototype = proto; +var child = new ConstructFun(); +child.set = function(value) { + data1 = value; +}; + +var newObj = Object.create({}, { + prop: child +}); + +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = "overrideData"; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(data1, "overrideData", 'data1'); +assert.sameValue(data2, "data", 'data2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-271.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-271.js new file mode 100644 index 0000000000..e755be92f7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-271.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.5-4-271 +description: > + Object.create - 'set' property of one property in 'Properties' is + own data 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) { + data2 = value; + }; + } +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var child = new ConstructFun(); +Object.defineProperty(child, "set", { + value: function(value) { + data1 = value; + } +}); + +var newObj = Object.create({}, { + prop: child +}); + +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = "overrideData"; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(data1, "overrideData", 'data1'); +assert.sameValue(data2, "data", 'data2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-272.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-272.js new file mode 100644 index 0000000000..593e276e53 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-272.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.5-4-272 +description: > + Object.create - 'set' property of one property in 'Properties' is + own accessor property (8.10.5 step 8.a) +---*/ + +var data = "data"; +var descObj = {}; + +Object.defineProperty(descObj, "set", { + get: function() { + return function(value) { + data = value; + }; + } +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = "overrideData"; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(data, "overrideData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-273.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-273.js new file mode 100644 index 0000000000..a2914f6aa2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-273.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.5-4-273 +description: > + Object.create - 'set' property of one property in 'Properties' is + an inherited accessor property (8.10.5 step 8.a) +---*/ + +var data = "data"; +var proto = {}; + +Object.defineProperty(proto, "set", { + get: function() { + return function(value) { + data = value; + }; + } +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var child = new ConstructFun(); + +var newObj = Object.create({}, { + prop: child +}); + +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = "overrideData"; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(data, "overrideData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-274.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-274.js new file mode 100644 index 0000000000..fed642de3f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-274.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.5-4-274 +description: > + Object.create - 'set' property of one property in 'Properties' 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) { + data2 = value; +}; + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var child = new ConstructFun(); +Object.defineProperty(child, "set", { + get: function() { + return function(value) { + data1 = value; + }; + } +}); + +var newObj = Object.create({}, { + prop: child +}); + +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = "overrideData"; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(data1, "overrideData", 'data1'); +assert.sameValue(data2, "data", 'data2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-275.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-275.js new file mode 100644 index 0000000000..5d63922fc6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-275.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.5-4-275 +description: > + Object.create - 'set' property of one property in 'Properties' 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) { + data2 = value; + }; + } +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var child = new ConstructFun(); +Object.defineProperty(child, "set", { + get: function() { + return function(value) { + data1 = value; + }; + } +}); + +var newObj = Object.create({}, { + prop: child +}); + +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = "overrideData"; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(data1, "overrideData", 'data1'); +assert.sameValue(data2, "data", 'data2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-276.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-276.js new file mode 100644 index 0000000000..0b6cbebda5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-276.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.5-4-276 +description: > + Object.create - 'set' property of one property in 'Properties' is + own accessor property without a get function (8.10.5 step 8.a) +---*/ + +var descObj = {}; +Object.defineProperty(descObj, "set", { + set: function() {} +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +var hasProperty = newObj.hasOwnProperty("prop"); + +var desc = Object.getOwnPropertyDescriptor(newObj, "prop"); + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(typeof desc.set, "undefined", 'typeof desc.set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-277.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-277.js new file mode 100644 index 0000000000..634b3c68be --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-277.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.5-4-277 +description: > + Object.create - 'set' property of one property in 'Properties' is + own accessor property without a get function, which overrides an + inherited accessor property (8.10.5 step 8.a) +---*/ + +var proto = {}; +Object.defineProperty(proto, "set", { + get: function() { + return function() {}; + } +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var child = new ConstructFun(); +Object.defineProperty(child, "set", { + set: function() {} +}); + +var newObj = Object.create({}, { + prop: child +}); + +var desc = Object.getOwnPropertyDescriptor(newObj, "prop"); + +assert(newObj.hasOwnProperty("prop"), 'newObj.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/create/15.2.3.5-4-278.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-278.js new file mode 100644 index 0000000000..0d2de4deb5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-278.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.5-4-278 +description: > + Object.create - 'set' property of one property in 'Properties' is + an inherited accessor property without a get function (8.10.5 step + 8.a) +---*/ + +var proto = {}; +Object.defineProperty(proto, "set", { + set: function() {} +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var child = new ConstructFun(); + +var newObj = Object.create({}, { + prop: child +}); + +var desc = Object.getOwnPropertyDescriptor(newObj, "prop"); + +assert(newObj.hasOwnProperty("prop"), 'newObj.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/create/15.2.3.5-4-279.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-279.js new file mode 100644 index 0000000000..64ac9d7874 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-279.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.5-4-279 +description: > + Object.create - one property in 'Properties' is a Function object + which implements its own [[Get]] method to access the 'set' + property (8.10.5 step 8.a) +---*/ + +var funObj = function() {}; +var data = "data"; +funObj.set = function(value) { + data = value; +}; + +var newObj = Object.create({}, { + prop: funObj +}); + +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = "overrideData"; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(data, "overrideData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-28.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-28.js new file mode 100644 index 0000000000..ec430cbebd --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-28.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.5-4-28 +description: > + Object.create - 'Properties' is a Function object which implements + its own [[Get]] method to access own enumerable property (15.2.3.7 + step 5.a) +---*/ + +var props = function() {}; +props.prop = { + value: 12, + enumerable: true +}; +var newObj = Object.create({}, props); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-280.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-280.js new file mode 100644 index 0000000000..b0893d82ae --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-280.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.5-4-280 +description: > + Object.create - one property in 'Properties' is an Array object + that uses Object's [[Get]] method to access the 'set' property + (8.10.5 step 8.a) +---*/ + +var arrObj = []; +var data = "data"; +arrObj.set = function(value) { + data = value; +}; + +var newObj = Object.create({}, { + prop: arrObj +}); + +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = "overrideData"; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(data, "overrideData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-281.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-281.js new file mode 100644 index 0000000000..6a7d0abb11 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-281.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.5-4-281 +description: > + Object.create - one property in 'Properties' is a String object + that uses Object's [[Get]] method to access the 'set' property + (8.10.5 step 8.a) +---*/ + +var strObj = new String(); +var data = "data"; +strObj.set = function(value) { + data = value; +}; + +var newObj = Object.create({}, { + prop: strObj +}); + +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = "overrideData"; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(data, "overrideData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-282.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-282.js new file mode 100644 index 0000000000..c1f7306a19 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-282.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.5-4-282 +description: > + Object.create - one property in 'Properties' is a Boolean object + that uses Object's [[Get]] method to access the 'set' property + (8.10.5 step 8.a) +---*/ + +var boolObj = new Boolean(true); +var data = "data"; +boolObj.set = function(value) { + data = value; +}; + +var newObj = Object.create({}, { + prop: boolObj +}); + +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = "overrideData"; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(data, "overrideData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-283.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-283.js new file mode 100644 index 0000000000..724bfaaa21 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-283.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.5-4-283 +description: > + Object.create - one property in 'Properties' is a Number object + that uses Object's [[Get]] method to access the 'set' property + (8.10.5 step 8.a) +---*/ + +var numObj = new Number(5); +var data = "data"; +numObj.set = function(value) { + data = value; +}; + +var newObj = Object.create({}, { + prop: numObj +}); + +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = "overrideData"; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(data, "overrideData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-284.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-284.js new file mode 100644 index 0000000000..b502ccd881 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-284.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.5-4-284 +description: > + Object.create - one property in 'Properties' is the Math object + that uses Object's [[Get]] method to access the 'set' property + (8.10.5 step 8.a) +---*/ + +var data = "data"; + +Math.set = function(value) { + data = value; +}; + +var newObj = Object.create({}, { + prop: Math +}); + +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = "overrideData"; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(data, "overrideData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-285.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-285.js new file mode 100644 index 0000000000..72ab88384c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-285.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.5-4-285 +description: > + Object.create - one property in 'Properties' is a Date object that + uses Object's [[Get]] method to access the 'set' property (8.10.5 + step 8.a) +---*/ + +var dateObj = new Date(); +var data = "data"; +dateObj.set = function(value) { + data = value; +}; + +var newObj = Object.create({}, { + prop: dateObj +}); + +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = "overrideData"; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(data, "overrideData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-286.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-286.js new file mode 100644 index 0000000000..fea17f39ea --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-286.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.5-4-286 +description: > + Object.create - one property in 'Properties' is a RegExp object + that uses Object's [[Get]] method to access the 'set' property + (8.10.5 step 8.a) +---*/ + +var regObj = new RegExp(); +var data = "data"; +regObj.set = function(value) { + data = value; +}; + +var newObj = Object.create({}, { + prop: regObj +}); + +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = "overrideData"; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(data, "overrideData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-287.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-287.js new file mode 100644 index 0000000000..9f3700ab41 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-287.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.5-4-287 +description: > + Object.create - one property in 'Properties' is the JSON object + that uses Object's [[Get]] method to access the 'set' property + (8.10.5 step 8.a) +---*/ + +var data = "data"; + +JSON.set = function(value) { + data = value; +}; + +var newObj = Object.create({}, { + prop: JSON +}); + +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = "overrideData"; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(data, "overrideData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-288.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-288.js new file mode 100644 index 0000000000..57399ae256 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-288.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.5-4-288 +description: > + Object.create - one property in 'Properties' is an Error object + that uses Object's [[Get]] method to access the 'set' property + (8.10.5 step 8.a) +---*/ + +var errObj = new Error("error"); +var data = "data"; + +errObj.set = function(value) { + data = value; +}; + +var newObj = Object.create({}, { + prop: errObj +}); + +newObj.prop = "overrideData"; + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); +assert.sameValue(data, "overrideData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-289.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-289.js new file mode 100644 index 0000000000..bd6f47db85 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-289.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.5-4-289 +description: > + Object.create - one property in 'Properties' is an Arguments + object which implements its own [[Get]] method to access the 'set' + property (8.10.5 step 8.a) +---*/ + +var argObj = (function() { + return arguments; +})(); + +var data = "data"; + +argObj.set = function(value) { + data = value; +}; + +var newobj = Object.create({}, { + prop: argObj +}); + +var hasProperty = newobj.hasOwnProperty("prop"); + +newobj.prop = "overrideData"; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(data, "overrideData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-29.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-29.js new file mode 100644 index 0000000000..359e971adf --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-29.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.5-4-29 +description: > + Object.create - 'Properties' is an Array object that uses Object's + [[Get]] method to access own enumerable property (15.2.3.7 step + 5.a) +---*/ + +var props = []; +props.prop = { + value: {}, + enumerable: true +}; +var newObj = Object.create({}, props); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-291.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-291.js new file mode 100644 index 0000000000..b92ba9d2c7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-291.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.5-4-291 +description: > + Object.create - one property in 'Properties' is the global object + that uses Object's [[Get]] method to access the 'set' property + (8.10.5 step 8.a) +---*/ + +var data = "data"; + +this.set = function(value) { + data = value; +}; + +var newObj = Object.create({}, { + prop: this +}); + +var hasProperty = newObj.hasOwnProperty("prop"); + +newObj.prop = "overrideData"; + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(data, "overrideData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-292.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-292.js new file mode 100644 index 0000000000..8bc70ff9aa --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-292.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.5-4-292 +description: > + Object.create - 'set' property of one property in 'Properties' is + undefined (8.10.5 step 8.b) +includes: [propertyHelper.js] +---*/ + +var newObj = Object.create({}, { + prop: { + set: undefined + } +}); + +assert(newObj.hasOwnProperty("prop")); +verifyNotWritable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-293.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-293.js new file mode 100644 index 0000000000..54c5fbfdf3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-293.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.5-4-293 +description: > + Object.create - 'set' property of one property in 'Properties' is + a primitive value null (8.10.5 step 8.b) +---*/ + + +assert.throws(TypeError, function() { + Object.create({}, { + prop: { + set: null + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-294.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-294.js new file mode 100644 index 0000000000..5fbf12657b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-294.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.5-4-294 +description: > + Object.create - 'set' property of one property in 'Properties' is + a primitive boolean value true (8.10.5 step 8.b) +---*/ + + +assert.throws(TypeError, function() { + Object.create({}, { + prop: { + set: true + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-295.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-295.js new file mode 100644 index 0000000000..51a080c703 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-295.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.5-4-295 +description: > + Object.create - 'set' property of one property in 'Properties' is + a primitive number value (8.10.5 step 8.b) +---*/ + + +assert.throws(TypeError, function() { + Object.create({}, { + prop: { + set: 123 + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-296.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-296.js new file mode 100644 index 0000000000..0a9feccc52 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-296.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.5-4-296 +description: > + Object.create - 'set' property of one property in 'Properties' is + a primitive string value (8.10.5 step 8.b) +---*/ + + +assert.throws(TypeError, function() { + Object.create({}, { + prop: { + set: "abc" + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-297.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-297.js new file mode 100644 index 0000000000..7e187906a0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-297.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.5-4-297 +description: > + Object.create - 'set' property of one property in 'Properties' is + an Date object (8.10.5 step 8.b) +---*/ + + +assert.throws(TypeError, function() { + Object.create({}, { + prop: { + set: new Date() + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-298.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-298.js new file mode 100644 index 0000000000..3587a83d1c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-298.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.5-4-298 +description: > + Object.create - 'set' property of one property in 'Properties' is + a function (8.10.5 step 8.b) +---*/ + +var data = "data"; + +var newObj = Object.create({}, { + prop: { + set: function(value) { + data = value; + } + } +}); + +newObj.prop = "overrideData"; + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); +assert.sameValue(data, "overrideData", 'data'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-3.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-3.js new file mode 100644 index 0000000000..3976886d04 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-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.5-4-3 +description: > + Object.create throws TypeError if 'Properties' is null (15.2.3.7 + step 2) +---*/ + + +assert.throws(TypeError, function() { + Object.create({}, null); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-30.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-30.js new file mode 100644 index 0000000000..4441ce9a5c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-30.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.5-4-30 +description: > + Object.create - 'Properties' is a String object that uses Object's + [[Get]] method to access own enumerable property (15.2.3.7 step + 5.a) +---*/ + +var props = new String(); +props.prop = { + value: 12, + enumerable: true +}; +var newObj = Object.create({}, props); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-300.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-300.js new file mode 100644 index 0000000000..a9eb355aef --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-300.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.5-4-300 +description: > + Object.create - 'set' property of one property in 'Properties' is + a host object that isn't callable (8.10.5 step 8.b) +---*/ + +var global = this; + +assert.throws(TypeError, function() { + Object.create({}, { + prop: { + set: global + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-301.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-301.js new file mode 100644 index 0000000000..32439e99c2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-301.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.5-4-301 +description: > + Object.create - TypeError is thrown if both 'set' property and + 'value' property of one property in 'Properties' are present + (8.10.5 step 9.a) +---*/ + + +assert.throws(TypeError, function() { + Object.create({}, { + prop: { + set: function() {}, + value: 100 + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-302.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-302.js new file mode 100644 index 0000000000..c2d6c5f970 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-302.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.5-4-302 +description: > + Object.create - TypeError is thrown if both 'set' property and + 'writable' property of one property in 'Properties' are present + (8.10.5 step 9.a) +---*/ + + +assert.throws(TypeError, function() { + Object.create({}, { + prop: { + set: function() {}, + writable: true + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-303.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-303.js new file mode 100644 index 0000000000..94ae9349a3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-303.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.5-4-303 +description: > + Object.create - TypeError is thrown if both 'get' property and + 'value' property of one property in 'Properties' are present + (8.10.5 step 9.a) +---*/ + + +assert.throws(TypeError, function() { + Object.create({}, { + prop: { + get: function() {}, + value: 100 + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-304.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-304.js new file mode 100644 index 0000000000..a3b2d1bf8d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-304.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.5-4-304 +description: > + Object.create - TypeError is thrown if both 'get' property and + 'writable' property of one property in 'Properties' are present + (8.10.5 step 9.a) +---*/ + + +assert.throws(TypeError, function() { + Object.create({}, { + prop: { + get: function() {}, + writable: true + } + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-305.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-305.js new file mode 100644 index 0000000000..4bca05a95a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-305.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 15.2.3.5-4-305 +description: > + Object.create defines a data property when one property in + 'Properties' is generic descriptor (8.12.9 step 4.a) +---*/ + +var newObj = Object.create({}, { + prop: { + enumerable: true + } +}); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-306.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-306.js new file mode 100644 index 0000000000..c69b7d7982 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-306.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.5-4-306 +description: > + Object.create - [[Value]] is set as undefined if it is absent in + data descriptor of one property in 'Properties' (8.12.9 step 4.a.i) +---*/ + +var newObj = Object.create({}, { + prop: { + writable: true, + configurable: true, + enumerable: true + } +}); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); +assert.sameValue(newObj.prop, undefined, 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-307.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-307.js new file mode 100644 index 0000000000..02d1a9e465 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-307.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.5-4-307 +description: > + Object.create - [[Writable]] is set as false if it is absent in + data descriptor of one property in 'Properties' (8.12.9 step 4.a.i) +includes: [propertyHelper.js] +---*/ + +var newObj = Object.create({}, { + prop: { + value: 1001, + configurable: true, + enumerable: true + } +}); + +assert(newObj.hasOwnProperty("prop")); +verifyNotWritable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-308.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-308.js new file mode 100644 index 0000000000..e9d83221f7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-308.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.5-4-308 +description: > + Object.create - [[Enumerable]] is set as false if it is absent in + data descriptor of one property in 'Properties' (8.12.9 step 4.a.i) +---*/ + +var isEnumerable = false; + +var newObj = Object.create({}, { + prop: { + value: 1001, + writable: true, + configurable: true + } +}); + +var hasProperty = newObj.hasOwnProperty("prop"); + +for (var p in newObj) { + if (p === "prop") { + isEnumerable = true; + } +} + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(isEnumerable, false, 'isEnumerable'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-309.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-309.js new file mode 100644 index 0000000000..41f48bb638 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-309.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.5-4-309 +description: > + Object.create - [[Configurable]] is set as false if it is absent + in data descriptor of one property in 'Properties' (8.12.9 step + 4.a.i) +includes: [propertyHelper.js] +---*/ + +var newObj = Object.create({}, { + prop: { + value: 1001, + writable: true, + enumerable: true + } +}); + +assert(newObj.hasOwnProperty("prop")); +verifyNotConfigurable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-31.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-31.js new file mode 100644 index 0000000000..aa1d112091 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-31.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.5-4-31 +description: > + Object.create - 'Properties' is a Boolean object that uses + Object's [[Get]] method to access own enumerable property + (15.2.3.7 step 5.a) +---*/ + +var props = new Boolean(false); +props.prop = { + value: 12, + enumerable: true +}; +var newObj = Object.create({}, props); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-310.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-310.js new file mode 100644 index 0000000000..b771420b26 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-310.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.5-4-310 +description: > + Object.create - [[Get]] is set as undefined if it is absent in + accessor descriptor of one property in 'Properties' (8.12.9 step + 4.b) +---*/ + +var newObj = Object.create({}, { + prop: { + set: function() {}, + enumerable: true, + configurable: true + } +}); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); +assert.sameValue(newObj.prop, undefined, 'newObj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-311.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-311.js new file mode 100644 index 0000000000..169e7a69b9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-311.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.5-4-311 +description: > + Object.create - [[Set]] is set as undefined if it is absent in + accessor descriptor of one property in 'Properties' (8.12.9 step + 4.b) +---*/ + +var newObj = Object.create({}, { + prop: { + get: function() { + return "verifyCreate"; + }, + enumerable: true, + configurable: true + } +}); + +var desc = Object.getOwnPropertyDescriptor(newObj, "prop"); +var verifySet = desc.hasOwnProperty("set") && typeof desc.set === "undefined"; + +var verifyGet = false; +if (newObj.prop === "verifyCreate") { + verifyGet = true; +} + +var verifyEnumerable = false; +for (var p in newObj) { + if (p === "prop") { + verifyEnumerable = true; + } +} + +var verifyConfigurable = false; +var hasProperty = newObj.hasOwnProperty("prop"); +delete newObj.prop; +verifyConfigurable = !newObj.hasOwnProperty("prop") && hasProperty; + +assert(verifySet, 'verifySet !== true'); +assert(verifyGet, 'verifyGet !== true'); +assert(verifyEnumerable, 'verifyEnumerable !== true'); +assert(verifyConfigurable, 'verifyConfigurable !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-312.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-312.js new file mode 100644 index 0000000000..1ae12c5c48 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-312.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.5-4-312 +description: > + Object.create - [[Enumerable]] is set as false if it is absent in + accessor descriptor of one property in 'Properties' (8.12.9 step + 4.b) +---*/ + +var isEnumerable = false; +var newObj = Object.create({}, { + prop: { + set: function() {}, + get: function() {}, + configurable: true + } +}); +var hasProperty = newObj.hasOwnProperty("prop"); +for (var p in newObj) { + if (p === "prop") { + isEnumerable = true; + } +} + +assert(hasProperty, 'hasProperty !== true'); +assert.sameValue(isEnumerable, false, 'isEnumerable'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-313.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-313.js new file mode 100644 index 0000000000..b3b0299d4e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-313.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.5-4-313 +description: > + Object.create - [[Configurable]] is set as false if it is absent + in accessor descriptor of one property in 'Properties' (8.12.9 + step 4.b) +includes: [propertyHelper.js] +---*/ + +var newObj = Object.create({}, { + prop: { + set: function() {}, + get: function() {}, + enumerable: true + } +}); + +assert(newObj.hasOwnProperty("prop")); +verifyNotConfigurable(newObj, "prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-314.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-314.js new file mode 100644 index 0000000000..c6e85a09d0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-314.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.5-4-314 +description: > + Object.create - some enumerable own property in 'Properties' is + empty object (15.2.3.7 step 7) +---*/ + +var newObj = Object.create({}, { + foo: {} +}); + +assert(newObj.hasOwnProperty("foo"), 'newObj.hasOwnProperty("foo") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-315.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-315.js new file mode 100644 index 0000000000..2c381680ce --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-315.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.5-4-315 +description: > + Object.create - all properties in 'Properties' are enumerable + (data property and accessor property) (15.2.3.7 step 7) +includes: [propertyHelper.js] +---*/ + +var newObj = {}; + +function getFunc() { + return 10; +} + +function setFunc(value) { + newObj.setVerifyHelpProp = value; +} + +newObj = Object.create({}, { + foo1: { + value: 200, + enumerable: true, + writable: true, + configurable: true + }, + foo2: { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + } +}); + +verifyEqualTo(newObj, "foo1", 200); + +verifyWritable(newObj, "foo1"); + +verifyEnumerable(newObj, "foo1"); + +verifyConfigurable(newObj, "foo1"); + +verifyEqualTo(newObj, "foo2", getFunc()); + +verifyWritable(newObj, "foo2", "setVerifyHelpProp"); + +verifyEnumerable(newObj, "foo2"); + +verifyConfigurable(newObj, "foo2"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-316.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-316.js new file mode 100644 index 0000000000..a0b3e5f8e8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-316.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.5-4-316 +description: > + Object.create - enumerable properties of 'Properties' are given + numerical names (15.2.3.7 step 7) +---*/ + +function getFunc() { + return 20; +} + +function setFunc() {} + +var newObj = Object.create({}, { + 0: { + value: 100, + enumerable: true, + writable: true, + configurable: true + }, + 1: { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true + }, + 2: { + value: 200, + enumerable: true, + writable: true, + configurable: true + } +}); + +assert.sameValue(newObj[0], 100, 'newObj[0]'); +assert.sameValue(newObj[1], 20, 'newObj[1]'); +assert.sameValue(newObj[2], 200, 'newObj[2]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-32.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-32.js new file mode 100644 index 0000000000..057004cafa --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-32.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.5-4-32 +description: > + Object.create - 'Properties' is a Number object that uses Object's + [[Get]] method to access own enumerable property (15.2.3.7 step + 5.a) +---*/ + +var props = new Number(-9); +props.prop = { + value: 12, + enumerable: true +}; +var newObj = Object.create({}, props); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-33.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-33.js new file mode 100644 index 0000000000..07d99cd723 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-33.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.5-4-33 +description: > + Object.create - 'Properties' is the Math object that uses Object's + [[Get]] method to access own enumerable property (15.2.3.7 step + 5.a) +---*/ + +Math.prop = { + value: 12, + enumerable: true +}; +var newObj = Object.create({}, Math); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-34.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-34.js new file mode 100644 index 0000000000..880041edaa --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-34.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.5-4-34 +description: > + Object.create - 'Properties' is a Date object that uses Object's + [[Get]] method to access own enumerable property (15.2.3.7 step + 5.a) +---*/ + +var props = new Date(); +props.prop = { + value: 12, + enumerable: true +}; +var newObj = Object.create({}, props); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-35.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-35.js new file mode 100644 index 0000000000..2e60dc5436 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-35.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.5-4-35 +description: > + Object.create - 'Properties' is a RegExp object that uses Object's + [[Get]] method to access own enumerable property (15.2.3.7 step + 5.a) +---*/ + +var props = new RegExp(); +props.prop = { + value: 12, + enumerable: true +}; +var newObj = Object.create({}, props); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-36.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-36.js new file mode 100644 index 0000000000..d9de2b46e9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-36.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.5-4-36 +description: > + Object.create - 'Properties' is the JSON object that uses Object's + [[Get]] method to access own enumerable property (15.2.3.7 step + 5.a) +---*/ + +JSON.prop = { + value: 12, + enumerable: true +}; +var newObj = Object.create({}, JSON); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-37.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-37.js new file mode 100644 index 0000000000..b54ed3ac21 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-37.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.5-4-37 +description: > + Object.create - 'Properties' is an Error object that uses Object's + [[Get]] method to access own enumerable property (15.2.3.7 step + 5.a) +---*/ + +var props = new Error("test"); + +(Object.getOwnPropertyNames(props)).forEach(function(name) { + props[name] = { + value: 11, + configurable: true + } +}); + +props.prop15_2_3_5_4_37 = { + value: 12, + enumerable: true +}; +var newObj = Object.create({}, props); + +assert(newObj.hasOwnProperty("prop15_2_3_5_4_37"), 'newObj.hasOwnProperty("prop15_2_3_5_4_37") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-38.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-38.js new file mode 100644 index 0000000000..fd2619c125 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-38.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.5-4-38 +description: > + Object.create - 'Properties' is an Arguments object which + implements its own [[Get]] method to access own enumerable + property (15.2.3.7 step 5.a) +---*/ + +var argObj = (function() { + return arguments; +})(); + +argObj.prop = { + value: 12, + enumerable: true +}; + +var newObj = Object.create({}, argObj); + +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-39.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-39.js new file mode 100644 index 0000000000..be66c37a6a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-39.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.5-4-39 +description: > + Object.create - ensure that side-effects of gets occur in the same + order as they would for: for (P in props) props[P] (15.2.3.7 step + 5.a) +---*/ + +var props = {}; +props.prop1 = { + value: 12, + enumerable: true +}; +props.prop2 = { + value: true, + enumerable: true +}; + +var tempArray = []; +for (var p in props) { + if (props.hasOwnProperty(p)) { + tempArray.push(p); + } +} + +var newObj = Object.create({}, props); +var index = 0; +for (var q in newObj) { + assert.sameValue(tempArray[index++] !== q && newObj.hasOwnProperty(q), false, 'tempArray[index++] !== q && newObj.hasOwnProperty(q)'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-4.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-4.js new file mode 100644 index 0000000000..6d2d1d1968 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-4.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.5-4-4 +description: > + Object.create - argument 'Properties' is an object (15.2.3.7 step + 2). +---*/ + +var props = {}; +var result = false; + +Object.defineProperty(props, "prop", { + get: function() { + result = this instanceof Object; + return {}; + }, + enumerable: true +}); +Object.create({}, props); + +assert(result, 'result !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-40.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-40.js new file mode 100644 index 0000000000..ca7bdc44f9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-40.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.5-4-40 +description: > + Object.create - ensure that if an exception is thrown it occurs in + the correct order relative to prior and subsequent side-effects + (15.2.3.7 step 5.a) +---*/ + +var newObj = {}; +var props = {}; +var i = 0; + +Object.defineProperty(props, "prop1", { + get: function() { + i++; + return {}; + }, + enumerable: true +}); + +Object.defineProperty(props, "prop2", { + get: function() { + if (1 === i++) { + throw new RangeError(); + } else { + return {}; + } + }, + enumerable: true +}); +assert.throws(RangeError, function() { + newObj = Object.create({}, props); +}); +assert.sameValue(newObj.hasOwnProperty("prop1"), false, 'newObj.hasOwnProperty("prop1")'); +assert.sameValue(i, 2, 'i'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-41.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-41.js new file mode 100644 index 0000000000..505390574e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-41.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.5-4-41 +description: > + Object.create - value of one property in 'Properties' is undefined + (8.10.5 step 1) +---*/ + + +assert.throws(TypeError, function() { + Object.create({}, { + prop: undefined + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-42.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-42.js new file mode 100644 index 0000000000..612e8ce702 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-42.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.5-4-42 +description: > + Object.create - value of one property in 'Properties' is null + (8.10.5 step 1) +---*/ + + +assert.throws(TypeError, function() { + Object.create({}, { + prop: null + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-43.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-43.js new file mode 100644 index 0000000000..424835548a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-43.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.5-4-43 +description: > + Object.create - value of one property in 'Properties' is false + (8.10.5 step 1) +---*/ + + +assert.throws(TypeError, function() { + Object.create({}, { + prop: false + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-44.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-44.js new file mode 100644 index 0000000000..804b90a581 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-44.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.5-4-44 +description: > + Object.create - value of one property in 'Properties' is a number + primitive (8.10.5 step 1) +---*/ + + +assert.throws(TypeError, function() { + Object.create({}, { + prop: 12 + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-45.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-45.js new file mode 100644 index 0000000000..9dcea126ca --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-45.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.5-4-45 +description: > + Object.create - value of one property in 'Properties' is a string + (8.10.5 step 1) +---*/ + + +assert.throws(TypeError, function() { + Object.create({}, { + prop: "abc" + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-46.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-46.js new file mode 100644 index 0000000000..8ab02e849f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-46.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.5-4-46 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is true (8.10.5 step 3) +---*/ + +var accessed = false; +var newObj = Object.create({}, { + prop: { + enumerable: true + } +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-47.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-47.js new file mode 100644 index 0000000000..39911fe960 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-47.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.5-4-47 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is not present (8.10.5 step 3) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: {} +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-48.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-48.js new file mode 100644 index 0000000000..cd3e397298 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-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.5-4-48 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is own data property (8.10.5 step 3.a) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: { + enumerable: true + } +}); + +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-49.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-49.js new file mode 100644 index 0000000000..f8ad8265a9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-49.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.5-4-49 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is an inherited data property (8.10.5 step 3.a) +---*/ + +var accessed = false; + +var proto = { + enumerable: true +}; +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var descObj = new ConstructFun(); + +var newObj = Object.create({}, { + prop: descObj +}); + +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-5.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-5.js new file mode 100644 index 0000000000..3be11de8d1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-5.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.5-4-5 +description: > + Object.create - argument 'Properties' is a Function object + (15.2.3.7 step 2) +---*/ + +var props = function() {}; +var result = false; + +Object.defineProperty(props, "prop", { + get: function() { + result = this instanceof Function; + return {}; + }, + enumerable: true +}); +Object.create({}, props); + +assert(result, 'result !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-50.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-50.js new file mode 100644 index 0000000000..7e0049e69b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-50.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.5-4-50 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is own data property that overrides an inherited data + property (8.10.5 step 3.a) +---*/ + +var accessed = false; +var proto = { + enumerable: true +}; + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var descObj = new ConstructFun(); + +Object.defineProperty(descObj, "enumerable", { + value: false +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-51.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-51.js new file mode 100644 index 0000000000..0e5f679229 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-51.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.5-4-51 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is own data property that overrides an inherited + accessor property (8.10.5 step 3.a) +---*/ + +var proto = {}; +var accessed = false; + +Object.defineProperty(proto, "enumerable", { + get: function() { + return true; + } +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var descObj = new ConstructFun(); + +Object.defineProperty(descObj, "enumerable", { + value: false +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-52.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-52.js new file mode 100644 index 0000000000..0d66e032c6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-52.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.5-4-52 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is own accessor property (8.10.5 step 3.a) +---*/ + +var accessed = false; + +var descObj = {}; +Object.defineProperty(descObj, "enumerable", { + get: function() { + return true; + } +}); + +var newObj = Object.create({}, { + prop: descObj +}); + +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-53.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-53.js new file mode 100644 index 0000000000..07ee309674 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-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.5-4-53 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is an inherited accessor property (8.10.5 step 3.a) +---*/ + +var proto = {}; +var accessed = false; + +Object.defineProperty(proto, "enumerable", { + get: function() { + return true; + } +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var descObj = new ConstructFun(); + +var newObj = Object.create({}, { + prop: descObj +}); + +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-54.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-54.js new file mode 100644 index 0000000000..2b7437e7f1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-54.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.5-4-54 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is own accessor property that overrides an inherited + data property (8.10.5 step 3.a) +---*/ + +var accessed = false; +var proto = { + enumerable: true +}; + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var descObj = new ConstructFun(); + +Object.defineProperty(descObj, "enumerable", { + get: function() { + return false; + } +}); + +var newObj = Object.create({}, { + prop: descObj +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-55.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-55.js new file mode 100644 index 0000000000..d0cfc1e86c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-55.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.5-4-55 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is own accessor property that overrides an inherited + accessor property (8.10.5 step 3.a) +---*/ + +var proto = {}; +var accessed = false; +Object.defineProperty(proto, "enumerable", { + get: function() { + return true; + } +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var descObj = new ConstructFun(); + +Object.defineProperty(descObj, "enumerable", { + get: function() { + return false; + } +}); + +var newObj = Object.create({}, { + prop: descObj +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-56.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-56.js new file mode 100644 index 0000000000..c4efa79699 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-56.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.5-4-56 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is own accessor property without a get function + (8.10.5 step 3.a) +---*/ + +var accessed = false; +var descObj = {}; +Object.defineProperty(descObj, "enumerable", { + set: function() {} +}); + +var newObj = Object.create({}, { + prop: descObj +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-57.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-57.js new file mode 100644 index 0000000000..e82b65dbff --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-57.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.5-4-57 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is own accessor property without a get function, + which overrides an inherited accessor property (8.10.5 step 3.a) +---*/ + +var proto = {}; +var accessed = false; +Object.defineProperty(proto, "enumerable", { + get: function() { + return true; + } +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var descObj = new ConstructFun(); + +Object.defineProperty(descObj, "enumerable", { + set: function() {} +}); + +var newObj = Object.create({}, { + prop: descObj +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-58.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-58.js new file mode 100644 index 0000000000..0af4b2299e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-58.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.5-4-58 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is an inherited accessor property without a get + function (8.10.5 step 3.a) +---*/ + +var proto = {}; +var accessed = false; + +Object.defineProperty(proto, "enumerable", { + set: function() {} +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; +var descObj = new ConstructFun(); + +var newObj = Object.create({}, { + prop: descObj +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-59.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-59.js new file mode 100644 index 0000000000..b18f28b0e6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-59.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.5-4-59 +description: > + Object.create - one property in 'Properties' is a Function object + which implements its own [[Get]] method to access the 'enumerable' + property (8.10.5 step 3.a) +---*/ + +var accessed = false; +var descObj = function() {}; + +descObj.enumerable = true; + +var newObj = Object.create({}, { + prop: descObj +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-6.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-6.js new file mode 100644 index 0000000000..c6571f5121 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-6.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.5-4-6 +description: > + Object.create - argument 'Properties' is an Array object (15.2.3.7 + step 2). +---*/ + +var props = []; +var result = false; + +Object.defineProperty(props, "prop", { + get: function() { + result = this instanceof Array; + return {}; + }, + enumerable: true +}); +Object.create({}, props); + +assert(result, 'result !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-60.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-60.js new file mode 100644 index 0000000000..79890a88b1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-60.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.5-4-60 +description: > + Object.create - one property in 'Properties' is an Array object + that uses Object's [[Get]] method to access the 'enumerable' + property (8.10.5 step 3.a) +---*/ + +var accessed = false; +var descObj = []; + +descObj.enumerable = true; + +var newObj = Object.create({}, { + prop: descObj +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-61.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-61.js new file mode 100644 index 0000000000..0d9f02e508 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-61.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.5-4-61 +description: > + Object.create - one property in 'Properties' is a String object + that uses Object's [[Get]] method to access the 'enumerable' + property (8.10.5 step 3.a) +---*/ + +var accessed = false; +var descObj = new String(); + +descObj.enumerable = true; + +var newObj = Object.create({}, { + prop: descObj +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-62.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-62.js new file mode 100644 index 0000000000..3cbf56b070 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-62.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.5-4-62 +description: > + Object.create - one property in 'Properties' is a Boolean object + that uses Object's [[Get]] method to access the 'enumerable' + property (8.10.5 step 3.a) +---*/ + +var accessed = false; +var descObj = new Boolean(false); + +descObj.enumerable = true; + +var newObj = Object.create({}, { + prop: descObj +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-63.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-63.js new file mode 100644 index 0000000000..b97e2c07ff --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-63.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.5-4-63 +description: > + Object.create - one property in 'Properties' is a Number object + that uses Object's [[Get]] method to access the 'enumerable' + property (8.10.5 step 3.a) +---*/ + +var accessed = false; +var descObj = new Number(-9); + +descObj.enumerable = true; + +var newObj = Object.create({}, { + prop: descObj +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-64.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-64.js new file mode 100644 index 0000000000..1b9b943cce --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-64.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.5-4-64 +description: > + Object.create - one property in 'Properties' is the Math object + that uses Object's [[Get]] method to access the 'enumerable' + property (8.10.5 step 3.a) +---*/ + +var accessed = false; + +Math.enumerable = true; + +var newObj = Object.create({}, { + prop: Math +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-65.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-65.js new file mode 100644 index 0000000000..6080685872 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-65.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.5-4-65 +description: > + Object.create - one property in 'Properties' is a Date object that + uses Object's [[Get]] method to access the 'enumerable' property + (8.10.5 step 3.a) +---*/ + +var accessed = false; +var descObj = new Date(); + +descObj.enumerable = true; + +var newObj = Object.create({}, { + prop: descObj +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-66.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-66.js new file mode 100644 index 0000000000..a90a9a84fe --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-66.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.5-4-66 +description: > + Object.create - one property in 'Properties' is a RegExp object + that uses Object's [[Get]] method to access the 'enumerable' + property (8.10.5 step 3.a) +---*/ + +var accessed = false; +var descObj = new RegExp(); + +descObj.enumerable = true; + +var newObj = Object.create({}, { + prop: descObj +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-67.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-67.js new file mode 100644 index 0000000000..3b55ec2225 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-67.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.5-4-67 +description: > + Object.create - one property in 'Properties' is the JSON object + that uses Object's [[Get]] method to access the 'enumerable' + property (8.10.5 step 3.a) +---*/ + +var accessed = false; + +JSON.enumerable = true; + +var newObj = Object.create({}, { + prop: JSON +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-68.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-68.js new file mode 100644 index 0000000000..06977453d3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-68.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.5-4-68 +description: > + Object.create - one property in 'Properties' is an Error object + that uses Object's [[Get]] method to access the 'enumerable' + property (8.10.5 step 3.a) +---*/ + +var accessed = false; +var descObj = new Error(); + +descObj.enumerable = true; + +var newObj = Object.create({}, { + prop: descObj +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-69.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-69.js new file mode 100644 index 0000000000..475c2b9108 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-69.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.5-4-69 +description: > + Object.create - one property in 'Properties' is an Arguments + object which implements its own [[Get]] method to access the + 'enumerable' property (8.10.5 step 3.a) +---*/ + +var accessed = false; +var argObj = (function() { + return arguments; +})(); + +argObj.enumerable = true; + +var newObj = Object.create({}, { + prop: argObj +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-7.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-7.js new file mode 100644 index 0000000000..934b4902e1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-7.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.5-4-7 +description: > + Object.create - argument 'Properties' is a String object (15.2.3.7 + step 2) +---*/ + +var props = new String(); +var result = false; + +Object.defineProperty(props, "prop", { + get: function() { + result = this instanceof String; + return {}; + }, + enumerable: true +}); +Object.create({}, props); + +assert(result, 'result !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-71.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-71.js new file mode 100644 index 0000000000..567b68cccf --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-71.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.5-4-71 +description: > + Object.create - one property in 'Properties' is the global object + that uses Object's [[Get]] method to access the 'enumerable' + property (8.10.5 step 3.a) +---*/ + +var accessed = false; + +this.enumerable = true; + +var newObj = Object.create({}, { + prop: this +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-72.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-72.js new file mode 100644 index 0000000000..07923b63aa --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-72.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.5-4-72 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is undefined (8.10.5 step 3.b) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: { + enumerable: undefined + } +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-73.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-73.js new file mode 100644 index 0000000000..003e3e8906 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-73.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.5-4-73 +description: > + Object.create - value of 'enumerable' property of one property in + 'Properties' is null (8.10.5 step 3.b) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: { + enumerable: null + } +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-74.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-74.js new file mode 100644 index 0000000000..9b266a47c2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-74.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.5-4-74 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is true (8.10.5 step 3.b) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: { + enumerable: true + } +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-75.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-75.js new file mode 100644 index 0000000000..18e0f9317d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-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.5-4-75 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is false (8.10.5 step 3.b) +---*/ + +var accessed = false; +var descObj = { + enumerable: false +}; + +var newObj = Object.create({}, { + prop: descObj +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-76.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-76.js new file mode 100644 index 0000000000..778b0fa6c9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-76.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.5-4-76 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is 0 (8.10.5 step 3.b) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: { + enumerable: 0 + } +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-77.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-77.js new file mode 100644 index 0000000000..4a63d956a6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-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.5-4-77 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is +0 (8.10.5 step 3.b) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: { + enumerable: +0 + } +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-78.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-78.js new file mode 100644 index 0000000000..b1677c0016 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-78.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.5-4-78 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is -0 (8.10.5 step 3.b) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: { + enumerable: -0 + } +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-79.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-79.js new file mode 100644 index 0000000000..d23acdfedc --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-79.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.5-4-79 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is NaN (8.10.5 step 3.b) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: { + enumerable: NaN + } +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-8.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-8.js new file mode 100644 index 0000000000..3d4dc15a88 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-8.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.5-4-8 +description: > + Object.create - argument 'Properties' is a Boolean object whose + primitive value is true (15.2.3.7 step 2). +---*/ + +var props = new Boolean(true); +var result = false; + +Object.defineProperty(props, "prop", { + get: function() { + result = this instanceof Boolean; + return {}; + }, + enumerable: true +}); +Object.create({}, props); + +assert(result, 'result !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-80.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-80.js new file mode 100644 index 0000000000..b239ec8add --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-80.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.5-4-80 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is a positive number primitive (8.10.5 step 3.b) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: { + enumerable: 12 + } +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-81.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-81.js new file mode 100644 index 0000000000..c94967c1d8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-81.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.5-4-81 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is a negative number primitive (8.10.5 step 3.b) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: { + enumerable: -9 + } +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-82.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-82.js new file mode 100644 index 0000000000..238d87cd0c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-82.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.5-4-82 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is an empty string (8.10.5 step 3.b) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: { + enumerable: "" + } +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert.sameValue(accessed, false, 'accessed'); +assert(newObj.hasOwnProperty("prop"), 'newObj.hasOwnProperty("prop") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-83.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-83.js new file mode 100644 index 0000000000..d75ae08b10 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-83.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.5-4-83 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is a non-empty string (8.10.5 step 3.b) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: { + enumerable: "AB\n\\cd" + } +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-84.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-84.js new file mode 100644 index 0000000000..465512f852 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-84.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.5-4-84 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is a Function object (8.10.5 step 3.b) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: { + enumerable: function() {} + } +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-85.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-85.js new file mode 100644 index 0000000000..8396312eed --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-85.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.5-4-85 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is an Array object (8.10.5 step 3.b) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: { + enumerable: [] + } +}); + +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-86.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-86.js new file mode 100644 index 0000000000..6b8bf1b198 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-86.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.5-4-86 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is a String object (8.10.5 step 3.b) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: { + enumerable: new String() + } +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-87.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-87.js new file mode 100644 index 0000000000..7ce2a3eb6c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-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.5-4-87 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is a Boolean object (8.10.5 step 3.b) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: { + enumerable: new Boolean(true) + } +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-88.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-88.js new file mode 100644 index 0000000000..8568fe302b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-88.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.5-4-88 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is a Number object (8.10.5 step 3.b) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: { + enumerable: new Number(-9) + } +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-89.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-89.js new file mode 100644 index 0000000000..6bdc03c2f2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-89.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.5-4-89 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is the Math object (8.10.5 step 3.b) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: { + enumerable: Math + } +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-9.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-9.js new file mode 100644 index 0000000000..fd12a2c08e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-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.5-4-9 +description: > + Object.create - argument 'Properties' is a Number object whose + primitive value is any interesting number (15.2.3.7 step 2). +---*/ + +var props = new Number(12); +var result = false; + +Object.defineProperty(props, "prop", { + get: function() { + result = this instanceof Number; + return {}; + }, + enumerable: true +}); +Object.create({}, props); + +assert(result, 'result !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-90.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-90.js new file mode 100644 index 0000000000..07972bdf64 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-90.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.5-4-90 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is a Date object (8.10.5 step 3.b) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: { + enumerable: new Date() + } +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-91.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-91.js new file mode 100644 index 0000000000..98fd988908 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-91.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.5-4-91 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is a RegExp object (8.10.5 step 3.b) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: { + enumerable: new RegExp() + } +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-92.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-92.js new file mode 100644 index 0000000000..3b5cb1dc9a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-92.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.5-4-92 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is the JSON object (8.10.5 step 3.b) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: { + enumerable: JSON + } +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-93.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-93.js new file mode 100644 index 0000000000..031209d4d9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-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.5-4-93 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is an Error object (8.10.5 step 3.b) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: { + enumerable: new Error() + } +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-94.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-94.js new file mode 100644 index 0000000000..e8ed726a94 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-94.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.5-4-94 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is an Arguments object (8.10.5 step 3.b) +---*/ + +var accessed = false; +var argObj = (function() { + return arguments; +})(); + +var newObj = Object.create({}, { + prop: { + enumerable: argObj + } +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-96.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-96.js new file mode 100644 index 0000000000..19f6d7d7a5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-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.5-4-96 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is the global object (8.10.5 step 3.b) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: { + enumerable: this + } +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-97.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-97.js new file mode 100644 index 0000000000..77b6339504 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-97.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.5-4-97 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is a string (value is 'false'), which is treated as + the value true (8.10.5 step 3.b) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: { + enumerable: "false" + } +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-98.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-98.js new file mode 100644 index 0000000000..9950402b7a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-98.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.5-4-98 +description: > + Object.create - 'enumerable' property of one property in + 'Properties' is new Boolean(false), which is treated as the value + true (8.10.5 step 3.b) +---*/ + +var accessed = false; + +var newObj = Object.create({}, { + prop: { + enumerable: new Boolean(false) + } +}); +for (var property in newObj) { + if (property === "prop") { + accessed = true; + } +} + +assert(accessed, 'accessed !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-99.js b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-99.js new file mode 100644 index 0000000000..2aa497d673 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/15.2.3.5-4-99.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.5-4-99 +description: > + Object.create - 'configurable' property of one property in + 'Properties' is true (8.10.5 step 4) +---*/ + +var newObj = Object.create({}, { + prop: { + configurable: true + } +}); + +var result1 = newObj.hasOwnProperty("prop"); +delete newObj.prop; +var result2 = newObj.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/create/browser.js b/js/src/tests/test262/built-ins/Object/create/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/browser.js diff --git a/js/src/tests/test262/built-ins/Object/create/name.js b/js/src/tests/test262/built-ins/Object/create/name.js new file mode 100644 index 0000000000..63cfe5f126 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/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.2 +description: > + Object.create.name is "create". +info: | + Object.create ( 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.create.name, "create"); + +verifyNotEnumerable(Object.create, "name"); +verifyNotWritable(Object.create, "name"); +verifyConfigurable(Object.create, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/not-a-constructor.js b/js/src/tests/test262/built-ins/Object/create/not-a-constructor.js new file mode 100644 index 0000000000..00efa6dc33 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/not-a-constructor.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-ecmascript-standard-built-in-objects +description: > + Object.create 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.create), false, 'isConstructor(Object.create) must return false'); + +assert.throws(TypeError, () => { + new Object.create(null); +}, '`new Object.create(null)` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/properties-arg-to-object-bigint.js b/js/src/tests/test262/built-ins/Object/create/properties-arg-to-object-bigint.js new file mode 100644 index 0000000000..6b47fca302 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/properties-arg-to-object-bigint.js @@ -0,0 +1,37 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.create +description: > + The Properties argument is cast to an object if it's a BigInt value +info: | + Object.create ( O, Properties ) + + 3. If Properties is not undefined, then + a. Return ? ObjectDefineProperties(obj, Properties). + + Runtime Semantics: ObjectDefineProperties ( O, Properties ) + + 2. Let props be ? ToObject(Properties). + 3. Let keys be ? props.[[OwnPropertyKeys]](). + ... + // All enumerable keys are added to the created object. +features: [BigInt] +---*/ + +var proto = {}; + +var obj; +obj = Object.create(proto, 1n); +assert.sameValue(Object.getPrototypeOf(obj), proto, 'Properties is 1n: prototype is set'); +assert.sameValue(Object.getOwnPropertyNames(obj).length, 0, 'Properties is 1n: no keys set'); +assert.sameValue(Object.getOwnPropertySymbols(obj).length, 0, 'Properties is 1n: no symbol keys set'); + +obj = undefined; +obj = Object.create(proto, 0n); +assert.sameValue(Object.getPrototypeOf(obj), proto, 'Properties is 0n: prototype is set'); +assert.sameValue(Object.getOwnPropertyNames(obj).length, 0, 'Properties is 0n: no keys set'); +assert.sameValue(Object.getOwnPropertySymbols(obj).length, 0, 'Properties is 0n: no symbol keys set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/properties-arg-to-object-non-empty-string.js b/js/src/tests/test262/built-ins/Object/create/properties-arg-to-object-non-empty-string.js new file mode 100644 index 0000000000..d14c034557 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/properties-arg-to-object-non-empty-string.js @@ -0,0 +1,37 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.create +description: > + Throws a TypeError if the Properties argument is a non-empty string +info: | + Object.create ( O, Properties ) + + 3. If Properties is not undefined, then + a. Return ? ObjectDefineProperties(obj, Properties). + + Runtime Semantics: ObjectDefineProperties ( O, Properties ) + + 2. Let props be ? ToObject(Properties). + 3. Let keys be ? props.[[OwnPropertyKeys]](). + 4. Let descriptors be a new empty List. + 5. For each element nextKey of keys in List order, do + a. Let propDesc be ? props.[[GetOwnProperty]](nextKey). + b. If propDesc is not undefined and propDesc.[[Enumerable]] is true, then + i. Let descObj be ? Get(props, nextKey). + ii. Let desc be ? ToPropertyDescriptor(descObj). + + ToPropertyDescriptor ( Obj ) + + 1. If Type(Obj) is not Object, throw a TypeError exception. +---*/ + +// The first nextKey is 'h' and its OwnProperty in the String object is enumerable +// Get(props, nextKey) is an equivalent of Object('hello')[nextKey] +// The first descObj will be 'h', so it will throw in ToPropertyDescriptor +assert.throws(TypeError, function() { + Object.create({}, 'hello'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/properties-arg-to-object-null.js b/js/src/tests/test262/built-ins/Object/create/properties-arg-to-object-null.js new file mode 100644 index 0000000000..452230e7c8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/properties-arg-to-object-null.js @@ -0,0 +1,23 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.create +description: > + Throws a TypeError if the Properties argument is null +info: | + Object.create ( O, Properties ) + + 3. If Properties is not undefined, then + a. Return ? ObjectDefineProperties(obj, Properties). + + Runtime Semantics: ObjectDefineProperties ( O, Properties ) + + 2. Let props be ? ToObject(Properties). +---*/ + +assert.throws(TypeError, function() { + Object.create({}, null); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/properties-arg-to-object.js b/js/src/tests/test262/built-ins/Object/create/properties-arg-to-object.js new file mode 100644 index 0000000000..e8e93500f5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/properties-arg-to-object.js @@ -0,0 +1,61 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.create +description: > + The Properties argument is cast to an object if not undefined +info: | + Object.create ( O, Properties ) + + 3. If Properties is not undefined, then + a. Return ? ObjectDefineProperties(obj, Properties). + + Runtime Semantics: ObjectDefineProperties ( O, Properties ) + + 2. Let props be ? ToObject(Properties). + 3. Let keys be ? props.[[OwnPropertyKeys]](). + ... + // All enumerable keys are added to the created object. +features: [Symbol] +---*/ + +var proto = {}; + +var obj; +obj = Object.create(proto, true); +assert.sameValue(Object.getPrototypeOf(obj), proto, 'Properties is true: prototype is set'); +assert.sameValue(Object.getOwnPropertyNames(obj).length, 0, 'Properties is true: no keys set'); +assert.sameValue(Object.getOwnPropertySymbols(obj).length, 0, 'Properties is true: no symbol keys set'); + +obj = undefined; +obj = Object.create(proto, false); +assert.sameValue(Object.getPrototypeOf(obj), proto, 'Properties is false: prototype is set'); +assert.sameValue(Object.getOwnPropertyNames(obj).length, 0, 'Properties is false: no keys set'); +assert.sameValue(Object.getOwnPropertySymbols(obj).length, 0, 'Properties is false: no symbol keys set'); + +obj = undefined; +obj = Object.create(proto, 1); +assert.sameValue(Object.getPrototypeOf(obj), proto, 'Properties is 1: prototype is set'); +assert.sameValue(Object.getOwnPropertyNames(obj).length, 0, 'Properties is 1: no keys set'); +assert.sameValue(Object.getOwnPropertySymbols(obj).length, 0, 'Properties is 1: no symbol keys set'); + +obj = undefined; +obj = Object.create(proto, NaN); +assert.sameValue(Object.getPrototypeOf(obj), proto, 'Properties is NaN: prototype is set'); +assert.sameValue(Object.getOwnPropertyNames(obj).length, 0, 'Properties is NaN: no keys set'); +assert.sameValue(Object.getOwnPropertySymbols(obj).length, 0, 'Properties is NaN: no symbol keys set'); + +obj = undefined; +obj = Object.create(proto, ''); +assert.sameValue(Object.getPrototypeOf(obj), proto, 'Properties is the empty string: prototype is set'); +assert.sameValue(Object.getOwnPropertyNames(obj).length, 0, 'Properties is the empty string: no keys set'); +assert.sameValue(Object.getOwnPropertySymbols(obj).length, 0, 'Properties is the empty string: no symbol keys set'); + +obj = undefined; +obj = Object.create(proto, Symbol('s')); +assert.sameValue(Object.getPrototypeOf(obj), proto, 'Properties is symbol: prototype is set'); +assert.sameValue(Object.getOwnPropertyNames(obj).length, 0, 'Properties is symbol: no keys set'); +assert.sameValue(Object.getOwnPropertySymbols(obj).length, 0, 'Properties is symbol: no symbol keys set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/create/shell.js b/js/src/tests/test262/built-ins/Object/create/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/shell.js |