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_6/Reflect/surfaces.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_6/Reflect/surfaces.js')
-rw-r--r-- | js/src/tests/ecma_6/Reflect/surfaces.js | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/js/src/tests/ecma_6/Reflect/surfaces.js b/js/src/tests/ecma_6/Reflect/surfaces.js new file mode 100644 index 000000000..d8486363a --- /dev/null +++ b/js/src/tests/ecma_6/Reflect/surfaces.js @@ -0,0 +1,59 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ */ + +// Check surface features of the Reflect object. +assertEq(typeof Reflect, 'object'); +assertEq(Object.getPrototypeOf(Reflect), Object.prototype); +assertEq(Reflect.toString(), '[object Object]'); +assertThrowsInstanceOf(() => new Reflect, TypeError); + +var desc = Object.getOwnPropertyDescriptor(this, "Reflect"); +assertEq(desc.enumerable, false); +assertEq(desc.configurable, true); +assertEq(desc.writable, true); + +for (var name in Reflect) + throw new Error("Reflect should not have any enumerable properties"); + +// The name and length of all the standard Reflect methods. +var methods = { + apply: 3, + construct: 2, + defineProperty: 3, + deleteProperty: 2, + get: 2, + getOwnPropertyDescriptor: 2, + getPrototypeOf: 1, + has: 2, + isExtensible: 1, + ownKeys: 1, + preventExtensions: 1, + set: 3, + setPrototypeOf: 2 +}; + +// Check that all Reflect properties are listed above. +for (var name of Reflect.ownKeys(Reflect)) { + // If this assertion fails, congratulations on implementing a new Reflect feature! + // Add it to the list of methods above. + if (name !== "parse") + assertEq(name in methods, true, `unexpected property found: Reflect.${name}`); +} + +// Check the .length and property attributes of each Reflect method. +for (var name of Object.keys(methods)) { + var desc = Object.getOwnPropertyDescriptor(Reflect, name); + assertEq(desc.enumerable, false); + assertEq(desc.configurable, true); + assertEq(desc.writable, true); + var f = desc.value; + assertEq(typeof f, "function"); + assertEq(f.length, methods[name]); +} + +// Check that the SpiderMonkey "resolve hook" mechanism does not resurrect the +// Reflect property once it is deleted. +delete this.Reflect; +assertEq("Reflect" in this, false); + +reportCompare(0, 0); |