Debian Codegraph @

js/src/tests/test262/intl402/Intl/getCanonicalLocales/main.js

raw
1 // Copyright 2016 Mozilla Corporation. All rights reserved.
2 // This code is governed by the license found in the LICENSE file.
3
4 /*---
5 esid: sec-intl.getcanonicallocales
6 description: Tests for existance and behavior of Intl.getCanonicalLocales
7 info: |
8 8.2.1 Intl.getCanonicalLocales (locales)
9 1. Let ll be ? CanonicalizeLocaleList(locales).
10 2. Return CreateArrayFromList(ll).
11 includes: [compareArray.js]
12 ---*/
13
14 var gCL = Intl.getCanonicalLocales;
15
16 function assertArray(l, r) {
17 assert.compareArray(l, r, r);
18 }
19
20 assertArray(gCL(), []);
21
22 assertArray(gCL('ab-cd'), ['ab-CD']);
23
24 assertArray(gCL(['ab-cd']), ['ab-CD']);
25
26 assertArray(gCL(['ab-cd', 'FF']), ['ab-CD', 'ff']);
27
28 assertArray(gCL({'a': 0}), []);
29
30 assertArray(gCL({}), []);
31
32 assertArray(gCL(['th-th-u-nu-thai']), ['th-TH-u-nu-thai']);
33
34 reportCompare(0, 0);