| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 for (var i in symbols) { | 76 for (var i in symbols) { |
| 77 assertSame(Symbol, symbols[i].__proto__.constructor) | 77 assertSame(Symbol, symbols[i].__proto__.constructor) |
| 78 assertSame(Symbol, Object(symbols[i]).__proto__.constructor) | 78 assertSame(Symbol, Object(symbols[i]).__proto__.constructor) |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 TestConstructor() | 81 TestConstructor() |
| 82 | 82 |
| 83 | 83 |
| 84 function TestToString() { | 84 function TestToString() { |
| 85 for (var i in symbols) { | 85 for (var i in symbols) { |
| 86 assertThrows(function() { String(symbols[i]) }, TypeError) | 86 assertThrows(function() {new String(symbols[i]) }, TypeError) |
| 87 assertEquals(symbols[i].toString(), String(symbols[i])) |
| 87 assertThrows(function() { symbols[i] + "" }, TypeError) | 88 assertThrows(function() { symbols[i] + "" }, TypeError) |
| 88 assertTrue(isValidSymbolString(symbols[i].toString())) | 89 assertTrue(isValidSymbolString(symbols[i].toString())) |
| 89 assertTrue(isValidSymbolString(Object(symbols[i]).toString())) | 90 assertTrue(isValidSymbolString(Object(symbols[i]).toString())) |
| 90 assertTrue(isValidSymbolString(Symbol.prototype.toString.call(symbols[i]))) | 91 assertTrue(isValidSymbolString(Symbol.prototype.toString.call(symbols[i]))) |
| 91 assertEquals( | 92 assertEquals( |
| 92 "[object Symbol]", Object.prototype.toString.call(symbols[i])) | 93 "[object Symbol]", Object.prototype.toString.call(symbols[i])) |
| 93 } | 94 } |
| 94 } | 95 } |
| 95 TestToString() | 96 TestToString() |
| 96 | 97 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 obj[sym] = 1 | 350 obj[sym] = 1 |
| 350 freeze(obj) | 351 freeze(obj) |
| 351 obj[sym] = 2 | 352 obj[sym] = 2 |
| 352 assertEquals(2, obj[sym]) | 353 assertEquals(2, obj[sym]) |
| 353 assertTrue(delete obj[sym]) | 354 assertTrue(delete obj[sym]) |
| 354 assertEquals(undefined, obj[sym]) | 355 assertEquals(undefined, obj[sym]) |
| 355 } | 356 } |
| 356 TestSealAndFreeze(Object.seal) | 357 TestSealAndFreeze(Object.seal) |
| 357 TestSealAndFreeze(Object.freeze) | 358 TestSealAndFreeze(Object.freeze) |
| 358 TestSealAndFreeze(Object.preventExtensions) | 359 TestSealAndFreeze(Object.preventExtensions) |
| OLD | NEW |