summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Intl/unicode-bcp47-locale-ids-extlangs.js
blob: 7e9aae5519ad3089ab469df88f6b5c583b2341db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// |reftest| skip-if(!this.hasOwnProperty("Intl"))

// Unicode BCP 47 locale identifiers don't support extlang subtags.
const invalid = [
    // Two letter language code followed by extlang subtags.
    "en-abc",
    "en-abc-def",
    "en-abc-def-ghi",

    // Three letter language code followed by extlang subtags.
    "und-abc",
    "und-abc-def",
    "und-abc-def-ghi",
];

for (let locale of invalid) {
    assertThrowsInstanceOf(() => Intl.getCanonicalLocales(locale), RangeError);
}

if (typeof reportCompare === "function")
    reportCompare(true, true);