| 1 |
// Copyright (C) 2017 Robin Templeton. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
description: Throws a TypeError if BigInt is called with a new target |
| 6 |
esid: sec-bigint-constructor |
| 7 |
info: | |
| 8 |
1. If NewTarget is not undefined, throw a TypeError exception. |
| 9 |
... |
| 10 |
features: [BigInt] |
| 11 |
---*/ |
| 12 |
|
| 13 |
assert.throws(TypeError, function() { |
| 14 |
new BigInt(); |
| 15 |
}); |
| 16 |
|
| 17 |
assert.throws(TypeError, function() { |
| 18 |
new BigInt({ |
| 19 |
valueOf: function() { |
| 20 |
throw new Test262Error("unreachable"); |
| 21 |
} |
| 22 |
}); |
| 23 |
}); |