test262/test/intl402/NumberFormat/currency-digits.js
Ben Allen 38d2924fb6
402: Replace currency-digits.js Intl.NumberFormat test (#4285)
ISO 4217 no longer normative for currency minor digits. New test verifies that
currency data (from whatever source) is used by verifying that `maximumFractionDigits` and `minimumFractionDigits`
are identical. See https://github.com/tc39/ecma402/pull/922
2024-10-31 11:39:44 -07:00

24 lines
891 B
JavaScript

// Copyright 2024 Igalia S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-intl.numberformat
description: >
Tests that data for the number of fractional digits when formatting currency is used.
info: |
15.1.1 Intl.NumberFormat ([ locales [ , options ]])
19. If style is "currency" and "notation" is "standard", then
a. Let currency be numberFormat.[[Currency]].
b. Let cDigits be CurrencyDigits(currency).
c. Let mnfdDefault be cDigits.
d. Let mxfdDefault be cDigits.
author: Ben Allen
---*/
const nf = Intl.NumberFormat([], {style: "currency", currency: "USD"});
const max = nf.resolvedOptions().maximumFractionDigits;
const min = nf.resolvedOptions().minimumFractionDigits;
assert.sameValue(min, max, "Currency data not used; maximumFractionDigits should match minimumFractionDigits");