tostring-throws.js (647B)
1 // Copyright (C) 2017 Caio Lima. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 description: Throws exception in BigIntConstructor if toString throws 6 esid: sec-bigint-constructor-number-value 7 info: | 8 1. If NewTarget is not undefined, throw a TypeError exception. 9 2. Let prim be ? ToPrimitive(value, hint Number). 10 3. If Type(prim) is Number, return ? NumberToBigInt(prim). 11 4. Otherwise, return ? ToBigInt(value). 12 features: [BigInt] 13 ---*/ 14 15 assert.throws(Test262Error, function() { 16 BigInt({ 17 toString: function() { 18 throw new Test262Error(); 19 } 20 }); 21 }); 22 23 reportCompare(0, 0);