Debian Codegraph @

js/src/tests/test262/intl402/NumberFormat/throws-for-minimumFractionDigits-under-limit.js

raw
1 // Copyright 2023 Google Inc. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-initializenumberformat
6 description: >
7 Tests that the options minimumFractionDigits limit to the range 0 - 100.
8 info: |
9 InitializeNumberFormat ( numberFormat, locales, options )
10
11 25.a.ii. Set mxfd to ? DefaultNumberOption(mxfd, 0, 100, undefined).
12
13 DefaultNumberOption ( value, minimum, maximum, fallback )
14
15 3. If value is NaN or less than minimum or greater than maximum, throw a RangeError exception.
16 ---*/
17
18 let wontThrow = new Intl.NumberFormat(undefined, {minimumFractionDigits: 0});
19
20 assert.throws(RangeError, function () {
21 return new Intl.NumberFormat(undefined, {minimumFractionDigits: -1});
22 }, "Throws RangeError when minimumFractionDigits is less than 0.");
23
24 reportCompare(0, 0);