mirror of
https://github.com/tc39/test262.git
synced 2025-07-23 22:15:24 +02:00
Fix bugs for PluralRules notation
This commit is contained in:
parent
3316c0aaf6
commit
7d0984ba52
@ -11,15 +11,26 @@ info: |
|
||||
...
|
||||
---*/
|
||||
|
||||
const validValues = ["standard", "compact", "scientific", "engineering", new String("standard"), new String("compact"), new String("scientific"), new String("engineering")];
|
||||
const invalidValues = ["COMPACT", "ståndard", 123, false, Symbol("foo"), null, {}, [], ""];
|
||||
const validValues = ["standard", "compact", "scientific", "engineering"];
|
||||
const invalidValues = ["COMPACT", "ståndard", 123, false, null, {}, [], ""];
|
||||
|
||||
for (const value of validValues) {
|
||||
const pr = new Intl.PluralRules("en", { notation: value });
|
||||
assert(pr.resolvedOptions().notation === value, `Resolved options should have notation ${value}`);
|
||||
}
|
||||
|
||||
// Also test with String wrappers.
|
||||
for (const value of validValues) {
|
||||
const pr = new Intl.PluralRules("en", { notation: new String(value) });
|
||||
assert(pr.resolvedOptions().notation === value, `Resolved options should have notation ${value}`);
|
||||
}
|
||||
|
||||
for (const value of invalidValues) {
|
||||
assert.throws(RangeError, () => {
|
||||
new Intl.PluralRules("en", { notation: value });
|
||||
}, `Exception should be thrown for ${value}`);
|
||||
}
|
||||
|
||||
assert.throws(TypeError, () => {
|
||||
new Intl.PluralRules("en", { notation: Symbol("foo") });
|
||||
}, `Exception should be thrown for symbol`);
|
||||
|
Loading…
x
Reference in New Issue
Block a user