tc39 / test262

Official ECMAScript Conformance Test Suite
Other
2.4k stars 467 forks source link

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

Closed ben-allen closed 4 weeks ago

ben-allen commented 1 month ago

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 https://github.com/tc39/ecma402/pull/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.

Ms2ger commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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.