tor-browser

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

test_pluralForm-japanese.js (935B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 /**
      8 * This unit test makes sure the plural form for Japanese works.
      9 * Japanese uses a legacy locale on gecko ja-JP-mac, which is not a valid locale
     10 * for Intl.Locale, so make sure PluralForm doesn't throw for this locale.
     11 * See Bug 1997708.
     12 */
     13 
     14 const { PluralForm } = require("resource://devtools/shared/plural-form.js");
     15 
     16 function run_test() {
     17  const origAvLocales = Services.locale.availableLocales;
     18  registerCleanupFunction(() => {
     19    Services.locale.availableLocales = origAvLocales;
     20  });
     21 
     22  Services.locale.availableLocales = ["ja-JP-mac", "en-US"];
     23  Services.locale.requestedLocales = ["ja-JP-mac"];
     24  PluralForm.init();
     25 
     26  // Japanese has 1 plural form
     27  Assert.equal(1, PluralForm.numForms());
     28 }