michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /** michael@0: * This unit test makes sure the plural form for the default language (by michael@0: * development), English, is working for the PluralForm javascript module. michael@0: */ michael@0: michael@0: Components.utils.import("resource://gre/modules/PluralForm.jsm"); michael@0: michael@0: function run_test() michael@0: { michael@0: // English has 2 plural forms michael@0: do_check_eq(2, PluralForm.numForms()); michael@0: michael@0: // Make sure for good inputs, things work as expected michael@0: for (var num = 0; num <= 200; num++) michael@0: do_check_eq(num == 1 ? "word" : "words", PluralForm.get(num, "word;words")); michael@0: michael@0: // Not having enough plural forms defaults to the first form michael@0: do_check_eq("word", PluralForm.get(2, "word")); michael@0: michael@0: // Empty forms defaults to the first form michael@0: do_check_eq("word", PluralForm.get(2, "word;")); michael@0: }