| OLD | NEW | 
|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. | 
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without | 
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are | 
| 4 // met: | 4 // met: | 
| 5 // | 5 // | 
| 6 //     * Redistributions of source code must retain the above copyright | 6 //     * Redistributions of source code must retain the above copyright | 
| 7 //       notice, this list of conditions and the following disclaimer. | 7 //       notice, this list of conditions and the following disclaimer. | 
| 8 //     * Redistributions in binary form must reproduce the above | 8 //     * Redistributions in binary form must reproduce the above | 
| 9 //       copyright notice, this list of conditions and the following | 9 //       copyright notice, this list of conditions and the following | 
| 10 //       disclaimer in the documentation and/or other materials provided | 10 //       disclaimer in the documentation and/or other materials provided | 
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 105     assertTrue(symbols[i] === symbols[i].valueOf()) | 105     assertTrue(symbols[i] === symbols[i].valueOf()) | 
| 106     assertTrue(Symbol.prototype.valueOf.call(Object(symbols[i])) === symbols[i]) | 106     assertTrue(Symbol.prototype.valueOf.call(Object(symbols[i])) === symbols[i]) | 
| 107     assertTrue(Symbol.prototype.valueOf.call(symbols[i]) === symbols[i]) | 107     assertTrue(Symbol.prototype.valueOf.call(symbols[i]) === symbols[i]) | 
| 108   } | 108   } | 
| 109 } | 109 } | 
| 110 TestValueOf() | 110 TestValueOf() | 
| 111 | 111 | 
| 112 | 112 | 
| 113 function TestToString() { | 113 function TestToString() { | 
| 114   for (var i in symbols) { | 114   for (var i in symbols) { | 
| 115     assertThrows(function() { String(symbols[i]) }, TypeError) | 115     assertThrows(function() { new String(symbols[i]) }, TypeError) | 
|  | 116     assertEquals(symbols[i].toString(), String(symbols[i])) | 
| 116     assertThrows(function() { symbols[i] + "" }, TypeError) | 117     assertThrows(function() { symbols[i] + "" }, TypeError) | 
| 117     assertThrows(function() { String(Object(symbols[i])) }, TypeError) | 118     assertThrows(function() { String(Object(symbols[i])) }, TypeError) | 
| 118     assertTrue(isValidSymbolString(symbols[i].toString())) | 119     assertTrue(isValidSymbolString(symbols[i].toString())) | 
| 119     assertTrue(isValidSymbolString(Object(symbols[i]).toString())) | 120     assertTrue(isValidSymbolString(Object(symbols[i]).toString())) | 
| 120     assertTrue( | 121     assertTrue( | 
| 121       isValidSymbolString(Symbol.prototype.toString.call(symbols[i]))) | 122       isValidSymbolString(Symbol.prototype.toString.call(symbols[i]))) | 
| 122     assertEquals( | 123     assertEquals( | 
| 123       "[object Symbol]", Object.prototype.toString.call(symbols[i])) | 124       "[object Symbol]", Object.prototype.toString.call(symbols[i])) | 
| 124   } | 125   } | 
| 125 } | 126 } | 
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 493   Realm.shared = symbol1 | 494   Realm.shared = symbol1 | 
| 494   assertSame("x1", Realm.eval(realm, "Symbol.keyFor(Realm.shared)")) | 495   assertSame("x1", Realm.eval(realm, "Symbol.keyFor(Realm.shared)")) | 
| 495 | 496 | 
| 496   var symbol3 = Realm.eval(realm, "Symbol.for('x3')") | 497   var symbol3 = Realm.eval(realm, "Symbol.for('x3')") | 
| 497   assertFalse(symbol1 === symbol3) | 498   assertFalse(symbol1 === symbol3) | 
| 498   assertFalse(symbol2 === symbol3) | 499   assertFalse(symbol2 === symbol3) | 
| 499   assertSame(symbol3, Symbol.for("x3")) | 500   assertSame(symbol3, Symbol.for("x3")) | 
| 500   assertSame("x3", Symbol.keyFor(symbol3)) | 501   assertSame("x3", Symbol.keyFor(symbol3)) | 
| 501 } | 502 } | 
| 502 TestRegistry() | 503 TestRegistry() | 
| OLD | NEW | 
|---|