Lines Matching refs:Symbol

25  * JDK-8141702: Add support for Symbol property keys
32 Assert.assertTrue(typeof Symbol === 'function');
33 Assert.assertTrue(typeof Symbol() === 'symbol');
35 Assert.assertTrue(Symbol().toString() === 'Symbol()');
36 Assert.assertTrue(Symbol('foo').toString() === 'Symbol(foo)');
37 Assert.assertTrue(Symbol(1).toString() === 'Symbol(1)');
38 Assert.assertTrue(Symbol(true).toString() === 'Symbol(true)');
39 Assert.assertTrue(Symbol([1, 2, 3]).toString() === 'Symbol(1,2,3)');
40 Assert.assertTrue(Symbol(null).toString() === 'Symbol(null)');
41 Assert.assertTrue(Symbol(undefined).toString() === 'Symbol()');
43 const s1 = Symbol();
44 const s2 = Symbol("s2");
45 Assert.assertFalse(s1 instanceof Symbol); // not an object
86 // Symbol called as constructor
88 new Symbol();
89 Assert.fail("Symbol invoked as constructor");
91 if (e.name !== "TypeError" || e.message !== "Symbol is not a constructor.") {
99 Assert.fail("Symbol converted to string");
101 if (e.name !== "TypeError" || e.message !== "Can not convert Symbol value to string.") {
108 Assert.fail("Symbol converted to number");
110 if (e.name !== "TypeError" || e.message !== "Can not convert Symbol value to number.") {
115 // Symbol.for and Symbol.keyFor
117 const uncached = Symbol('foo');
118 const cached = Symbol.for('foo');
121 Assert.assertTrue(Symbol.keyFor(uncached) === undefined);
122 Assert.assertTrue(Symbol.keyFor(cached) === 'foo');
123 Assert.assertTrue(cached === Symbol.for('foo'));
124 Assert.assertTrue(cached === Symbol.for('f' + 'oo'));
127 Symbol.prototype.foo = 123;
128 Symbol.prototype[s2] = s2;
140 Assert.assertTrue(o instanceof Symbol);
148 Assert.assertFalse(0 == Symbol());
149 Assert.assertFalse(1 == Symbol(1));
150 Assert.assertFalse(null == Symbol());
151 Assert.assertFalse(undefined == Symbol);
152 Assert.assertFalse('Symbol()' == Symbol());
153 Assert.assertFalse('Symbol(foo)' == Symbol('foo'));