summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/NumberFormat/throws-for-minimumFractionDigits-under-limit.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/intl402/NumberFormat/throws-for-minimumFractionDigits-under-limit.js')
-rw-r--r--js/src/tests/test262/intl402/NumberFormat/throws-for-minimumFractionDigits-under-limit.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/NumberFormat/throws-for-minimumFractionDigits-under-limit.js b/js/src/tests/test262/intl402/NumberFormat/throws-for-minimumFractionDigits-under-limit.js
new file mode 100644
index 0000000000..d12e2502ed
--- /dev/null
+++ b/js/src/tests/test262/intl402/NumberFormat/throws-for-minimumFractionDigits-under-limit.js
@@ -0,0 +1,24 @@
+// Copyright 2023 Google Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-initializenumberformat
+description: >
+ Tests that the options minimumFractionDigits limit to the range 0 - 100.
+info: |
+ InitializeNumberFormat ( numberFormat, locales, options )
+
+ 25.a.ii. Set mxfd to ? DefaultNumberOption(mxfd, 0, 100, undefined).
+
+ DefaultNumberOption ( value, minimum, maximum, fallback )
+
+ 3. If value is NaN or less than minimum or greater than maximum, throw a RangeError exception.
+---*/
+
+let wontThrow = new Intl.NumberFormat(undefined, {minimumFractionDigits: 0});
+
+assert.throws(RangeError, function () {
+ return new Intl.NumberFormat(undefined, {minimumFractionDigits: -1});
+}, "Throws RangeError when minimumFractionDigits is less than 0.");
+
+reportCompare(0, 0);