1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
// Copyright 2012 Mozilla Corporation. All rights reserved.
// Copyright 2019 Igalia S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-bigint.prototype.tolocalestring
description: Tests that toLocaleString handles "thisBigIntValue" correctly.
features: [BigInt]
---*/
var invalidValues = [
undefined,
null,
false,
"5",
Symbol(),
5,
-1234567.89,
NaN,
-Infinity,
{valueOf: function () { return 5; }},
{valueOf: function () { return 5n; }},
];
for (const value of invalidValues) {
assert.throws(TypeError, function() {
BigInt.prototype.toLocaleString.call(value);
}, `BigInt.prototype.toLocaleString did not throw with this = ${String(value)}.`);
}
reportCompare(0, 0);
|