Debian Codegraph @

js/src/tests/test262/intl402/NumberFormat/currency-digits.js

raw
1 // Copyright 2024 Igalia S.L. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-intl.numberformat
6 description: >
7 Tests that data for the number of fractional digits when formatting currency is used.
8 info: |
9 15.1.1 Intl.NumberFormat ([ locales [ , options ]])
10
11 19. If style is "currency" and "notation" is "standard", then
12 a. Let currency be numberFormat.[[Currency]].
13 b. Let cDigits be CurrencyDigits(currency).
14 c. Let mnfdDefault be cDigits.
15 d. Let mxfdDefault be cDigits.
16 author: Ben Allen
17 ---*/
18
19 const nf = Intl.NumberFormat([], {style: "currency", currency: "USD"});
20 const max = nf.resolvedOptions().maximumFractionDigits;
21 const min = nf.resolvedOptions().minimumFractionDigits;
22
23 assert.sameValue(min, max, "Currency data not used; maximumFractionDigits should match minimumFractionDigits");
24
25 reportCompare(0, 0);