uniqueness.js (805B)
1 // Copyright (C) 2016 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 esid: sec-symbol-constructor 5 description: The Symbol constructor returns a unique value 6 info: | 7 1. If NewTarget is not undefined, throw a TypeError exception. 8 2. If description is undefined, let descString be undefined. 9 2. Else, let descString be ? ToString(description). 10 3. Return a new unique Symbol value whose [[Description]] value is 11 descString. 12 features: [Symbol] 13 ---*/ 14 15 assert.notSameValue(Symbol(''), Symbol(''), 'empty string'); 16 assert.notSameValue(Symbol(), Symbol(), 'undefined'); 17 assert.notSameValue(Symbol(null), Symbol(null), 'null value'); 18 assert.notSameValue(Symbol('x'), Symbol('x'), 'string "x"'); 19 20 reportCompare(0, 0);