tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

getCanonicalLocales.js (1007B)


      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 // Tests the getCanonicalLocales function with a diverse set of arguments.
      7 
      8 let gCL = Intl.getCanonicalLocales;
      9 
     10 assertEq(Intl.getCanonicalLocales.length, 1);
     11 
     12 assertEqArray(gCL(), []);
     13 
     14 assertEqArray(gCL('ab-cd'), ['ab-CD']);
     15 
     16 assertEqArray(gCL(['ab-cd']), ['ab-CD']);
     17 
     18 assertEqArray(gCL(['ab-cd', 'FF']), ['ab-CD', 'ff']);
     19 
     20 assertEqArray(gCL({'a': 0}), []);
     21 
     22 assertEqArray(gCL({}), []);
     23 
     24 assertEqArray(gCL(['ar-ma-u-ca-islamicc']), ['ar-MA-u-ca-islamic-civil']);
     25 
     26 assertEqArray(gCL(['th-th-u-nu-thai']), ['th-TH-u-nu-thai']);
     27 
     28 assertEqArray(gCL(NaN), []);
     29 
     30 assertEqArray(gCL(1), []);
     31 
     32 Number.prototype[0] = "en-US";
     33 Number.prototype.length = 1;
     34 assertEqArray(gCL(NaN), ["en-US"]);
     35 
     36 if (typeof reportCompare === 'function')
     37    reportCompare(0, 0);