Lines Matching full:symbols

30 var symbols = []  variable
34 // serialization of Symbols added to the 'symbols'
35 // array. Adjust if you extend 'symbols' with other
48 symbols.push(Symbol())
49 symbols.push(Symbol(undefined))
50 symbols.push(Symbol("66"))
51 symbols.push(Symbol(66))
52 symbols.push(Symbol().valueOf())
53 symbols.push(indirect())
57 gc() // Promote existing symbols and then allocate some more.
66 for (var i in symbols) {
67 assertEquals("symbol", typeof symbols[i])
68 assertTrue(typeof symbols[i] === "symbol")
69 assertFalse(%SymbolIsPrivate(symbols[i]))
70 assertEquals(null, %_ClassOf(symbols[i]))
71 assertEquals("Symbol", %_ClassOf(Object(symbols[i])))
81 for (var i in symbols) {
82 assertSame(Symbol.prototype, symbols[i].__proto__)
95 for (var i in symbols) {
96 assertSame(Symbol, symbols[i].__proto__.constructor)
103 for (var i in symbols) {
104 assertTrue(symbols[i] === Object(symbols[i]).valueOf())
105 assertTrue(symbols[i] === symbols[i].valueOf())
106 assertTrue(Symbol.prototype.valueOf.call(Object(symbols[i])) === symbols[i])
107 assertTrue(Symbol.prototype.valueOf.call(symbols[i]) === symbols[i])
114 for (var i in symbols) {
115 assertThrows(function() { new String(symbols[i]) }, TypeError)
116 assertEquals(symbols[i].toString(), String(symbols[i]))
117 assertThrows(function() { symbols[i] + "" }, TypeError)
118 assertThrows(function() { String(Object(symbols[i])) }, TypeError)
119 assertTrue(isValidSymbolString(symbols[i].toString()))
120 assertTrue(isValidSymbolString(Object(symbols[i]).toString()))
122 isValidSymbolString(Symbol.prototype.toString.call(symbols[i])))
124 "[object Symbol]", Object.prototype.toString.call(symbols[i]))
131 for (var i in symbols) {
132 assertTrue(Boolean(Object(symbols[i])))
133 assertFalse(!Object(symbols[i]))
134 assertTrue(Boolean(symbols[i]).valueOf())
135 assertFalse(!symbols[i])
136 assertTrue(!!symbols[i])
137 assertTrue(symbols[i] && true)
138 assertFalse(!symbols[i] && false)
139 assertTrue(!symbols[i] || true)
140 assertEquals(1, symbols[i] ? 1 : 2)
141 assertEquals(2, !symbols[i] ? 1 : 2)
142 if (!symbols[i]) assertUnreachable();
143 if (symbols[i]) {} else assertUnreachable();
150 for (var i in symbols) {
151 assertThrows(function() { Number(Object(symbols[i])) }, TypeError)
152 assertThrows(function() { +Object(symbols[i]) }, TypeError)
153 assertThrows(function() { Number(symbols[i]) }, TypeError)
154 assertThrows(function() { symbols[i] + 0 }, TypeError)
162 for (var i in symbols) {
163 assertSame(symbols[i], symbols[i])
164 assertEquals(symbols[i], symbols[i])
165 assertTrue(Object.is(symbols[i], symbols[i]))
166 assertTrue(symbols[i] === symbols[i])
167 assertTrue(symbols[i] == symbols[i])
168 assertFalse(symbols[i] === Object(symbols[i]))
169 assertFalse(Object(symbols[i]) === symbols[i])
170 assertFalse(symbols[i] == Object(symbols[i]))
171 assertFalse(Object(symbols[i]) == symbols[i])
172 assertTrue(symbols[i] === symbols[i].valueOf())
173 assertTrue(symbols[i].valueOf() === symbols[i])
174 assertTrue(symbols[i] == symbols[i].valueOf())
175 assertTrue(symbols[i].valueOf() == symbols[i])
176 assertFalse(Object(symbols[i]) === Object(symbols[i]))
177 assertEquals(Object(symbols[i]).valueOf(), Object(symbols[i]).valueOf())
180 // All symbols should be distinct.
181 for (var i = 0; i < symbols.length; ++i) {
182 for (var j = i + 1; j < symbols.length; ++j) {
183 assertFalse(Object.is(symbols[i], symbols[j]))
184 assertFalse(symbols[i] === symbols[j])
185 assertFalse(symbols[i] == symbols[j])
189 // Symbols should not be equal to any other value (and the test terminates).
191 for (var i in symbols) {
193 assertFalse(symbols[i] === values[j])
194 assertFalse(values[j] === symbols[i])
195 assertFalse(symbols[i] == values[j])
196 assertFalse(values[j] == symbols[i])
204 for (var i in symbols) {
205 assertTrue(isValidSymbolString(symbols[i].toString()))
206 assertEquals(symbols[i], symbols[i].valueOf())
207 assertEquals(undefined, symbols[i].a)
208 assertEquals(undefined, symbols[i]["a" + "b"])
209 assertEquals(undefined, symbols[i]["" + "1"])
210 assertEquals(undefined, symbols[i][62])
217 for (var i in symbols) {
218 symbols[i].toString = 0
219 assertTrue(isValidSymbolString(symbols[i].toString()))
220 symbols[i].valueOf = 0
221 assertEquals(symbols[i], symbols[i].valueOf())
222 symbols[i].a = 0
223 assertEquals(undefined, symbols[i].a)
224 symbols[i]["a" + "b"] = 0
225 assertEquals(undefined, symbols[i]["a" + "b"])
226 symbols[i][62] = 0
227 assertEquals(undefined, symbols[i][62])
238 for (var i in symbols) {
239 assertTrue(symbols[i].getThisProto() === Symbol.prototype)
249 for (var i in symbols) {
250 set.add(symbols[i])
251 map.set(symbols[i], i)
252 weakmap.set(symbols[i], i)
254 assertEquals(symbols.length, set.size)
255 assertEquals(symbols.length, map.size)
256 for (var i in symbols) {
257 assertTrue(set.has(symbols[i]))
258 assertTrue(map.has(symbols[i]))
259 assertTrue(weakmap.has(symbols[i]))
260 assertEquals(i, map.get(symbols[i]))
261 assertEquals(i, weakmap.get(symbols[i]))
263 for (var i in symbols) {
264 assertTrue(set.delete(symbols[i]))
265 assertTrue(map.delete(symbols[i]))
266 assertTrue(weakmap.delete(symbols[i]))
277 // Set the even symbols via assignment.
278 for (var i = 0; i < symbols.length; i += 2) {
279 obj[symbols[i]] = i
287 // Set the odd symbols via defineProperty (as non-enumerable).
288 for (var i = 1; i < symbols.length; i += 2) {
289 Object.defineProperty(obj, symbols[i], {value: i, configurable: true})
296 for (var i in symbols) {
297 assertEquals(i|0, obj[symbols[i]])
298 assertEquals(i|0, obj2[symbols[i]])
304 for (var i in symbols) {
305 assertTrue(symbols[i] in obj)
306 assertTrue(Object.hasOwnProperty.call(obj, symbols[i]))
330 assertEquals(syms.length, symbols.length)
338 for (var i in symbols) {
339 var desc = Object.getOwnPropertyDescriptor(obj, symbols[i])
345 Object.prototype.propertyIsEnumerable.call(obj, symbols[i]))
351 for (var i in symbols) {
352 delete obj[symbols[i]]
354 for (var i in symbols) {
355 assertEquals(undefined, Object.getOwnPropertyDescriptor(obj, symbols[i]))
378 for (var i in symbols) {
380 properties, symbols[i], {value: {value: i}, enumerable: i % 2 === 0})
383 for (var i in symbols) {
384 assertEquals(i % 2 === 0, symbols[i] in o)
392 for (var i in symbols) {
394 properties, symbols[i], {value: {value: i}, enumerable: i % 2 === 0})
397 for (var i in symbols) {
398 assertEquals(i % 2 === 0, symbols[i] in o)
423 var syms = symbols.slice(0, 30);
448 var symbols = [
454 for (var i in symbols) {
455 var name = symbols[i]