Debian Codegraph @

js/src/tests/non262/Intl/unicode-bcp47-locale-ids-extlangs.js

raw
1 // |reftest| skip-if(!this.hasOwnProperty("Intl"))
2
3 // Unicode BCP 47 locale identifiers don't support extlang subtags.
4 const invalid = [
5 // Two letter language code followed by extlang subtags.
6 "en-abc",
7 "en-abc-def",
8 "en-abc-def-ghi",
9
10 // Three letter language code followed by extlang subtags.
11 "und-abc",
12 "und-abc-def",
13 "und-abc-def-ghi",
14 ];
15
16 for (let locale of invalid) {
17 assertThrowsInstanceOf(() => Intl.getCanonicalLocales(locale), RangeError);
18 }
19
20 if (typeof reportCompare === "function")
21 reportCompare(true, true);