diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/tests/ecma_5/Object/15.2.3.5-01.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/tests/ecma_5/Object/15.2.3.5-01.js')
-rw-r--r-- | js/src/tests/ecma_5/Object/15.2.3.5-01.js | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/js/src/tests/ecma_5/Object/15.2.3.5-01.js b/js/src/tests/ecma_5/Object/15.2.3.5-01.js new file mode 100644 index 000000000..70cfd64f5 --- /dev/null +++ b/js/src/tests/ecma_5/Object/15.2.3.5-01.js @@ -0,0 +1,60 @@ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 492840; +var summary = 'ES5 Object.create(O [, Properties])'; + +print(BUGNUMBER + ": " + summary); + +/************** + * BEGIN TEST * + **************/ + +assertEq("create" in Object, true); +assertEq(Object.create.length, 2); + +var o, desc, props, proto; + +o = Object.create(null); +assertEq(Object.getPrototypeOf(o), null, "bad null-proto"); + +o = Object.create(null, { a: { value: 17, enumerable: false } }); +assertEq(Object.getPrototypeOf(o), null, "bad null-proto"); +assertEq("a" in o, true); +desc = Object.getOwnPropertyDescriptor(o, "a"); +assertEq(desc !== undefined, true, "no descriptor?"); +assertEq(desc.value, 17); +assertEq(desc.enumerable, false); +assertEq(desc.configurable, false); +assertEq(desc.writable, false); + +props = Object.create({ bar: 15 }); +Object.defineProperty(props, "foo", { enumerable: false, value: 42 }); +proto = { baz: 12 }; +o = Object.create(proto, props); +assertEq(Object.getPrototypeOf(o), proto); +assertEq(Object.getOwnPropertyDescriptor(o, "foo"), undefined); +assertEq("foo" in o, false); +assertEq(Object.getOwnPropertyDescriptor(o, "bar"), undefined); +assertEq("bar" in o, false); +assertEq(Object.getOwnPropertyDescriptor(o, "baz"), undefined); +assertEq(o.baz, 12); +assertEq(o.hasOwnProperty("baz"), false); + +try { + var actual = + Object.create(Object.create({}, + { boom: { get: function() { return "base"; }}}), + { boom: { get: function() { return "overridden"; }}}).boom +} catch (e) { +} +assertEq(actual, "overridden"); + +/******************************************************************************/ + +reportCompare(true, true); + +print("All tests passed!"); |