diff options
Diffstat (limited to 'js/src/tests/test262/intl402/ch09/9.1')
-rw-r--r-- | js/src/tests/test262/intl402/ch09/9.1/9.1_a.js | 18 | ||||
-rw-r--r-- | js/src/tests/test262/intl402/ch09/9.1/9.1_b.js | 32 | ||||
-rw-r--r-- | js/src/tests/test262/intl402/ch09/9.1/browser.js | 0 | ||||
-rw-r--r-- | js/src/tests/test262/intl402/ch09/9.1/shell.js | 0 |
4 files changed, 50 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/ch09/9.1/9.1_a.js b/js/src/tests/test262/intl402/ch09/9.1/9.1_a.js new file mode 100644 index 000000000..b7358304b --- /dev/null +++ b/js/src/tests/test262/intl402/ch09/9.1/9.1_a.js @@ -0,0 +1,18 @@ +// Copyright 2012 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @description Tests that default locale is available. + * @author Norbert Lindenberg + */ + +$INCLUDE("testIntl.js"); + +testWithIntlConstructors(function (Constructor) { + var defaultLocale = new Constructor().resolvedOptions().locale; + var supportedLocales = Constructor.supportedLocalesOf([defaultLocale]); + if (supportedLocales.indexOf(defaultLocale) === -1) { + $ERROR("Default locale is not reported as available."); + } +}); + diff --git a/js/src/tests/test262/intl402/ch09/9.1/9.1_b.js b/js/src/tests/test262/intl402/ch09/9.1/9.1_b.js new file mode 100644 index 000000000..a0abc7fc1 --- /dev/null +++ b/js/src/tests/test262/intl402/ch09/9.1/9.1_b.js @@ -0,0 +1,32 @@ +// Copyright 2012 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @description Tests that appropriate fallback locales are provided for + * supported locales. + * @author Norbert Lindenberg + */ + +$INCLUDE("testIntl.js"); + +testWithIntlConstructors(function (Constructor) { + var info = getLocaleSupportInfo(Constructor); + var fallback; + info.supported.forEach(function (locale) { + var pos = locale.lastIndexOf("-"); + if (pos !== -1) { + fallback = locale.substring(0, pos); + if (info.supported.indexOf(fallback) === -1) { + $ERROR("Locale " + locale + " is supported, but fallback " + fallback + " isn't."); + } + } + var match = /([a-z]{2,3})(-[A-Z][a-z]{3})(-[A-Z]{2})/.exec(locale); + if (match !== null) { + fallback = match[1] + match[3]; + if (info.supported.indexOf(fallback) === -1) { + $ERROR("Locale " + locale + " is supported, but fallback " + fallback + " isn't."); + } + } + }); +}); + diff --git a/js/src/tests/test262/intl402/ch09/9.1/browser.js b/js/src/tests/test262/intl402/ch09/9.1/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/intl402/ch09/9.1/browser.js diff --git a/js/src/tests/test262/intl402/ch09/9.1/shell.js b/js/src/tests/test262/intl402/ch09/9.1/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/intl402/ch09/9.1/shell.js |