Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / BigInt / tostring-throws.js
blobe476803d12039e9003ce8ce64382cb5b3b04748b
1 // Copyright (C) 2017 Caio Lima. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
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 ---*/
15 assert.throws(Test262Error, function() {
16   BigInt({
17     toString: function() {
18       throw new Test262Error();
19     }
20   });
21 });
23 reportCompare(0, 0);