Debian Codegraph @

js/src/tests/non262/Intl/getCanonicalLocales-weird-cases.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 // Locale processing is supposed to internally remove any Unicode extension
7 // sequences in the locale. Test that various weird testcases invoking
8 // algorithmic edge cases don't assert or throw exceptions.
9
10 var weirdCases =
11 [
12 "en-x-u-foo",
13 "en-a-bar-x-u-foo",
14 "en-x-u-foo-a-bar",
15 "en-a-bar-u-baz-x-u-foo",
16 ];
17
18 for (let weird of weirdCases)
19 assertEqArray(Intl.getCanonicalLocales(weird), [weird]);
20
21 assertThrowsInstanceOf(() => Intl.getCanonicalLocales("x-u-foo"), RangeError);
22
23 if (typeof reportCompare === 'function')
24 reportCompare(0, 0);
25