summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/object/getPrototypeOf.js
blob: 71cd30c62cb93c6bf0476a40c63a25505ca75985 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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);