propertyhelper-verifynotenumerable-enumerable-symbol.js (806B)
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 /*--- 5 description: > 6 Objects whose specified symbol property is enumerable do not satisfy the 7 assertion. 8 includes: [propertyHelper.js] 9 features: [Symbol] 10 ---*/ 11 var threw = false; 12 var obj = {}; 13 var s = Symbol('1'); 14 Object.defineProperty(obj, s, { 15 enumerable: true 16 }); 17 18 try { 19 verifyNotEnumerable(obj, s); 20 } catch(err) { 21 threw = true; 22 if (err.constructor !== Test262Error) { 23 throw new Test262Error( 24 'Expected a Test262Error, but a "' + err.constructor.name + 25 '" was thrown.' 26 ); 27 } 28 } 29 30 if (threw === false) { 31 throw new Test262Error( 32 'Expected a Test262Error, but no error was thrown for symbol key.' 33 ); 34 } 35 36 reportCompare(0, 0);