Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

402: Replace currency-digits.js Intl.NumberFormat test #4285

Merged
merged 2 commits into from
Oct 31, 2024

Conversation

ben-allen
Copy link
Contributor

This test treats ISO 4217 data on the number of minor unit digits to use when formatting currencies. ISO 4217 is no longer normative as of tc39/ecma402#922

Additionally, web reality before that PR is that some implementations already used CLDR data rather than ISO 4217.

I could write a test that only checks the digits on a few currencies for which CLDR and ISO 4217 agree, and which aren't likely to change any time soon. (i.e. USD and EUR using 2 minor digits, JPY using 0). Not sure if that's the right path, though -- any guidance welcome.

@ben-allen ben-allen requested a review from a team as a code owner October 29, 2024 08:26
@Ms2ger
Copy link
Contributor

Ms2ger commented Oct 29, 2024

Hmm, there's no other way to test those code paths, is there? I guess strictly speaking this wouldn't be in scope for test262, but I might be convinced to keep it.

@ben-allen
Copy link
Contributor Author

Yes, there's no real way to test it without appealing to some data source or another, even though for most currencies there's no difference between CLDR and ISO 4217.

@ben-allen
Copy link
Contributor Author

ben-allen commented Oct 29, 2024

Sudden thought: If CurrencyDigits is being used to set mininumFractionDigits and maximumFractionDigits, then those two values will be identical, which isn't the case if we're using the defaults for these properties. As such it's possible to test for whether currency data is being used to set these properties without testing the specific values.
on edit: just pushed a new version of PR that does the stuff above.

@ben-allen ben-allen force-pushed the 402-pr-922-remove-currency-digits branch from 990bbf6 to 8588bdc Compare October 29, 2024 17:51
@ben-allen ben-allen changed the title 402: Remove currency-digits.js Intl.NumberFormat test 402: Replace currency-digits.js Intl.NumberFormat test Oct 29, 2024
Copy link
Contributor

@ptomato ptomato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo a few minor comments. This is a nice improvement in that test.

test/intl402/NumberFormat/currency-digits.js Outdated Show resolved Hide resolved
test/intl402/NumberFormat/currency-digits.js Outdated Show resolved Hide resolved
Copy link
Contributor

@ptomato ptomato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

…for currency minor unit digits

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 tc39/ecma402#922
@ptomato ptomato force-pushed the 402-pr-922-remove-currency-digits branch from c62167c to 15b563b Compare October 31, 2024 18:36
@ptomato ptomato merged commit 38d2924 into tc39:main Oct 31, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants