Add tests for calling Intl.PluralRules with BigInts#4912
Add tests for calling Intl.PluralRules with BigInts#4912
Conversation
|
cc @ben-allen |
|
The String tests already pass in JSC/V8/SM, only the BigInt tests require implementation work. I didn't add tests for large BigInt inputs, because ICU4C internally coerces everything to js> new Intl.PluralRules("fr").select(20000000000000001n)
"many"
( ICU4X gets this correctly (Output: use icu::locale::locale;
use icu::plurals::{PluralOperands, PluralRules};
fn main() {
let pr = PluralRules::try_new(
locale!("fr").into(),
Default::default()
).expect("locale should be present");
let operands: PluralOperands = "20000000000000001".parse().expect("Failed to parse to operands.");
println!("category: {:?}", pr.category_for(operands));
} |
When a rounding mode is set, there's an observable difference in implementations when <tc39/ecma402#1026> is not supported.
|
Probably best to still add large BigInt tests, even if they're in a separate file so that ICU4C-using implementations can skip them? |
|
It looks like even ICU4X supports at most 18 digits, so larger BigInts can't be tested there either. PluralRuleSelect doesn't require any specific minimum digits limit, so I'm not even sure test262 can/should have tests for this. |
|
Maybe someone more familiar with the API could weigh in, but that sounds like a limitation not present in the spec that would be fine to have a failing test for — just because no engine implements it correctly isn't a reason not to test it. (OTOH, if it's something more equivalent to "strings longer than 4 GB" then it's probably diminishing returns to have tests for it.) |
…s. r=spidermonkey-reviewers,dminor Implements the changes from <tc39/ecma402#1026>. Test262 tests: <tc39/test262#4912>. Differential Revision: https://phabricator.services.mozilla.com/D281991
Tests for tc39/ecma402#1026