js/src/tests/test262/intl402/ch06/6.2/6.2.2_a.js

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

michael@0 1 // Copyright 2012 Mozilla Corporation. All rights reserved.
michael@0 2 // This code is governed by the BSD license found in the LICENSE file.
michael@0 3
michael@0 4 /**
michael@0 5 * @description Tests that structurally valid language tags are accepted.
michael@0 6 * @author Norbert Lindenberg
michael@0 7 */
michael@0 8
michael@0 9 $INCLUDE("testIntl.js");
michael@0 10
michael@0 11 var validLanguageTags = [
michael@0 12 "de", // ISO 639 language code
michael@0 13 "de-DE", // + ISO 3166-1 country code
michael@0 14 "DE-de", // tags are case-insensitive
michael@0 15 "cmn", // ISO 639 language code
michael@0 16 "cmn-Hans", // + script code
michael@0 17 "CMN-hANS", // tags are case-insensitive
michael@0 18 "cmn-hans-cn", // + ISO 3166-1 country code
michael@0 19 "es-419", // + UN M.49 region code
michael@0 20 "es-419-u-nu-latn-cu-bob", // + Unicode locale extension sequence
michael@0 21 "i-klingon", // grandfathered tag
michael@0 22 "cmn-hans-cn-t-ca-u-ca-x-t-u", // singleton subtags can also be used as private use subtags
michael@0 23 "enochian-enochian", // language and variant subtags may be the same
michael@0 24 "de-gregory-u-ca-gregory", // variant and extension subtags may be the same
michael@0 25 "aa-a-foo-x-a-foo-bar", // variant subtags can also be used as private use subtags
michael@0 26 "x-en-US-12345", // anything goes in private use tags
michael@0 27 "x-12345-12345-en-US",
michael@0 28 "x-en-US-12345-12345",
michael@0 29 "x-en-u-foo",
michael@0 30 "x-en-u-foo-u-bar"
michael@0 31 ];
michael@0 32
michael@0 33 testWithIntlConstructors(function (Constructor) {
michael@0 34 validLanguageTags.forEach(function (tag) {
michael@0 35 // this must not throw an exception for a valid language tag
michael@0 36 var obj = new Constructor([tag]);
michael@0 37 });
michael@0 38 return true;
michael@0 39 });
michael@0 40

mercurial