michael@0: // Copyright 2012 Mozilla Corporation. All rights reserved. michael@0: // This code is governed by the BSD license found in the LICENSE file. michael@0: michael@0: /** michael@0: * @description Tests that LookupSupportedLocales includes the default locale michael@0: * and doesn't include the "no linguistic content" locale. michael@0: * @author Norbert Lindenberg michael@0: */ michael@0: michael@0: $INCLUDE("testIntl.js"); michael@0: michael@0: testWithIntlConstructors(function (Constructor) { michael@0: // this test should work equally for both matching algorithms michael@0: ["lookup", "best fit"].forEach(function (matcher) { michael@0: var defaultLocale = new Constructor().resolvedOptions().locale; michael@0: var noLinguisticContent = "zxx"; michael@0: var supported = Constructor.supportedLocalesOf([defaultLocale, noLinguisticContent], michael@0: {localeMatcher: matcher}); michael@0: if (supported.indexOf(defaultLocale) === -1) { michael@0: $ERROR("SupportedLocales didn't return default locale with matcher " + matcher + "."); michael@0: } michael@0: if (supported.indexOf(noLinguisticContent) !== -1) { michael@0: $ERROR("SupportedLocales returned the \"no linguistic content\" locale with matcher " + matcher + "."); michael@0: } michael@0: if (supported.length > 1) { michael@0: $ERROR("SupportedLocales returned stray locales: " + supported.join(", ") + " with matcher " + matcher + "."); michael@0: } michael@0: }); michael@0: michael@0: return true; michael@0: }); michael@0: