summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/BigInt/prototype/toLocaleString/this-value-invalid.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/intl402/BigInt/prototype/toLocaleString/this-value-invalid.js')
-rw-r--r--js/src/tests/test262/intl402/BigInt/prototype/toLocaleString/this-value-invalid.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/BigInt/prototype/toLocaleString/this-value-invalid.js b/js/src/tests/test262/intl402/BigInt/prototype/toLocaleString/this-value-invalid.js
new file mode 100644
index 0000000000..cfc9053033
--- /dev/null
+++ b/js/src/tests/test262/intl402/BigInt/prototype/toLocaleString/this-value-invalid.js
@@ -0,0 +1,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);