1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/locale/tests/unit/test_pluralForm_english.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,26 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +/** 1.9 + * This unit test makes sure the plural form for the default language (by 1.10 + * development), English, is working for the PluralForm javascript module. 1.11 + */ 1.12 + 1.13 +Components.utils.import("resource://gre/modules/PluralForm.jsm"); 1.14 + 1.15 +function run_test() 1.16 +{ 1.17 + // English has 2 plural forms 1.18 + do_check_eq(2, PluralForm.numForms()); 1.19 + 1.20 + // Make sure for good inputs, things work as expected 1.21 + for (var num = 0; num <= 200; num++) 1.22 + do_check_eq(num == 1 ? "word" : "words", PluralForm.get(num, "word;words")); 1.23 + 1.24 + // Not having enough plural forms defaults to the first form 1.25 + do_check_eq("word", PluralForm.get(2, "word")); 1.26 + 1.27 + // Empty forms defaults to the first form 1.28 + do_check_eq("word", PluralForm.get(2, "word;")); 1.29 +}