Debian Codegraph @

js/src/tests/non262/Intl/RelativeTimeFormat/numbering-system.js

raw
1 // |reftest| skip-if(!this.hasOwnProperty("Intl"))
2
3 // Ensure passing the default numbering system leads to the same result as when
4 // no explicit numbering system is present.
5 //
6 // This is a regression test for the ICU issue reported at
7 // <https://unicode-org.atlassian.net/browse/ICU-20280>.
8
9 for (var requestedLocale of [undefined, "en", "de", "fr"]) {
10 var rtf = new Intl.RelativeTimeFormat(requestedLocale);
11 var {locale, numberingSystem} = rtf.resolvedOptions();
12 var rtfNu = new Intl.RelativeTimeFormat(`${locale}-u-nu-${numberingSystem}`);
13
14 for (var unit of ["year", "quarter", "month", "week", "day", "hour", "minute", "second"]) {
15 for (var value of [-10, -3, -2, -1, 0, 1, 2, 3, 10]) {
16 assertEq(rtfNu.format(value, unit), rtf.format(value, unit));
17 }
18 }
19 }
20
21 if (typeof reportCompare === "function")
22 reportCompare(0, 0);