diff options
Diffstat (limited to '')
-rw-r--r-- | js/src/tests/non262/object/getPrototypeOf.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/js/src/tests/non262/object/getPrototypeOf.js b/js/src/tests/non262/object/getPrototypeOf.js new file mode 100644 index 0000000000..71cd30c62c --- /dev/null +++ b/js/src/tests/non262/object/getPrototypeOf.js @@ -0,0 +1,22 @@ +/* + * Any copyright is dedicated to the Public Domain. + * https://creativecommons.org/publicdomain/zero/1.0/ + */ + +var BUGNUMBER = 1079090; +var summary = "Coerce the argument passed to Object.getPrototypeOf using ToObject"; +print(BUGNUMBER + ": " + summary); + +assertThrowsInstanceOf(() => Object.getPrototypeOf(), TypeError); +assertThrowsInstanceOf(() => Object.getPrototypeOf(undefined), TypeError); +assertThrowsInstanceOf(() => Object.getPrototypeOf(null), TypeError); + +assertEq(Object.getPrototypeOf(1), Number.prototype); +assertEq(Object.getPrototypeOf(true), Boolean.prototype); +assertEq(Object.getPrototypeOf("foo"), String.prototype); +if (typeof Symbol === "function") { + assertEq(Object.getPrototypeOf(Symbol("foo")), Symbol.prototype); +} + +if (typeof reportCompare === "function") + reportCompare(true, true); |