summaryrefslogtreecommitdiffstats
path: root/js/src/tests/ecma_6/Symbol/keyFor.js
blob: 868c3bda7405d4d041c7873c915e9b402006a901 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/licenses/publicdomain/ */

assertEq(Symbol.keyFor(Symbol.for("moon")), "moon");
assertEq(Symbol.keyFor(Symbol.for("")), "");
assertEq(Symbol.keyFor(Symbol("moon")), undefined);
assertEq(Symbol.keyFor(Symbol.iterator), undefined);

assertThrowsInstanceOf(() => Symbol.keyFor(), TypeError);
assertThrowsInstanceOf(() => Symbol.keyFor(Object(Symbol("moon"))), TypeError);

assertEq(Symbol.keyFor.length, 1);

if (typeof reportCompare === "function")
    reportCompare(0, 0);