symbol-logical-not-evaluation.js (621B)
1 // Copyright (C) 2013 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 es6id: 12.5.12.1 5 description: > 6 "Logical Not" coercion operation on Symbols 7 features: [Symbol] 8 ---*/ 9 var sym = Symbol(); 10 11 assert.sameValue(!sym, false, "`!sym` is `false`"); 12 assert.sameValue(!!sym, true, "`!!sym` is `true`"); 13 14 if (!sym) { 15 throw new Test262Error("ToBoolean(Symbol) always returns `true`"); 16 } else if (sym) { 17 assert(true, "`sym` evaluates to `true`"); 18 } else { 19 throw new Test262Error("ToBoolean(Symbol) always returns `true`"); 20 } 21 22 reportCompare(0, 0);