Skip to content

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

Merged
ptomato merged 2 commits intotc39:mainfrom
ben-allen:402-pr-922-remove-currency-digits
Oct 31, 2024
Merged

402: Replace currency-digits.js Intl.NumberFormat test#4285
ptomato merged 2 commits intotc39:mainfrom
ben-allen:402-pr-922-remove-currency-digits

Conversation

@ben-allen
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread test/intl402/NumberFormat/currency-digits.js Outdated
Comment thread test/intl402/NumberFormat/currency-digits.js Outdated
Copy link
Copy Markdown
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
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