| 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 valueOf/toString does that |
| 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 |
valueOf: function() { |
| 18 |
throw new Test262Error(); |
| 19 |
} |
| 20 |
}); |
| 21 |
}); |
| 22 |
|
| 23 |
assert.throws(Test262Error, function() { |
| 24 |
BigInt({ |
| 25 |
toString: function() { |
| 26 |
throw new Test262Error(); |
| 27 |
} |
| 28 |
}); |
| 29 |
}); |