Debian Codegraph @

js/src/tests/non262/Intl/four-letter-language-codes.js

raw
1 // |reftest| skip-if(!this.hasOwnProperty("Intl"))
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 // Four letter language subtags are not allowed.
7 const languageTags = [
8 "root", // Special meaning in Unicode CLDR locale identifiers.
9 "Latn", // Unicode CLDR locale identifiers can start with a script subtag.
10 "Flob", // And now some non-sense input.
11 "ZORK",
12 "Blah-latn",
13 "QuuX-latn-us",
14 "SPAM-gb-x-Sausages-BACON-eggs",
15 ];
16
17 for (let tag of languageTags) {
18 assertThrowsInstanceOf(() => Intl.getCanonicalLocales(tag), RangeError);
19 }
20
21 if (typeof reportCompare === "function")
22 reportCompare(0, 0);