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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 assertSame(Symbol.prototype, Symbol().__proto__) | 79 assertSame(Symbol.prototype, Symbol().__proto__) |
80 assertSame(Symbol.prototype, Object(Symbol()).__proto__) | 80 assertSame(Symbol.prototype, Object(Symbol()).__proto__) |
81 for (var i in symbols) { | 81 for (var i in symbols) { |
82 assertSame(Symbol.prototype, symbols[i].__proto__) | 82 assertSame(Symbol.prototype, symbols[i].__proto__) |
83 } | 83 } |
84 } | 84 } |
85 TestPrototype() | 85 TestPrototype() |
86 | 86 |
87 | 87 |
88 function TestConstructor() { | 88 function TestConstructor() { |
| 89 assertEquals(0, Symbol.length); |
89 assertSame(Function.prototype, Symbol.__proto__) | 90 assertSame(Function.prototype, Symbol.__proto__) |
90 assertFalse(Object === Symbol.prototype.constructor) | 91 assertFalse(Object === Symbol.prototype.constructor) |
91 assertFalse(Symbol === Object.prototype.constructor) | 92 assertFalse(Symbol === Object.prototype.constructor) |
92 assertSame(Symbol, Symbol.prototype.constructor) | 93 assertSame(Symbol, Symbol.prototype.constructor) |
93 assertSame(Symbol, Symbol().__proto__.constructor) | 94 assertSame(Symbol, Symbol().__proto__.constructor) |
94 assertSame(Symbol, Object(Symbol()).__proto__.constructor) | 95 assertSame(Symbol, Object(Symbol()).__proto__.constructor) |
95 for (var i in symbols) { | 96 for (var i in symbols) { |
96 assertSame(Symbol, symbols[i].__proto__.constructor) | 97 assertSame(Symbol, symbols[i].__proto__.constructor) |
97 } | 98 } |
98 } | 99 } |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 assertEquals(expected, JSON.stringify(input)); | 557 assertEquals(expected, JSON.stringify(input)); |
557 assertEquals(expected, JSON.stringify(input, null, 0)); | 558 assertEquals(expected, JSON.stringify(input, null, 0)); |
558 } | 559 } |
559 | 560 |
560 TestStringify(undefined, Symbol("a")); | 561 TestStringify(undefined, Symbol("a")); |
561 TestStringify('[{}]', [Object(Symbol())]); | 562 TestStringify('[{}]', [Object(Symbol())]); |
562 var symbol_wrapper = Object(Symbol("a")) | 563 var symbol_wrapper = Object(Symbol("a")) |
563 TestStringify('{}', symbol_wrapper); | 564 TestStringify('{}', symbol_wrapper); |
564 symbol_wrapper.a = 1; | 565 symbol_wrapper.a = 1; |
565 TestStringify('{"a":1}', symbol_wrapper); | 566 TestStringify('{"a":1}', symbol_wrapper); |
OLD | NEW |