Upload Kmake

This commit is contained in:
Gorochu
2026-05-26 23:36:42 -07:00
parent ba051b2f74
commit 555ec72358
41615 changed files with 13344630 additions and 1 deletions

View File

@ -0,0 +1,22 @@
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Make sure that locale string got canonicalized by the spec,
// keys are sorted and unique, region upper cased, script title cased and
// language lower cased.
let locale = new Intl.Locale('sr-cyrl-rs-t-ja-u-ca-islamic-x-whatever', {
calendar: 'buddhist',
caseFirst: 'true',
collation: 'phonebk',
hourCycle: 'h23',
caseFirst: 'upper',
numeric: 'true',
numberingSystem: 'roman'
});
let expected =
'sr-Cyrl-RS-t-ja-u-ca-buddhist-co-phonebk-hc-h23-kf-upper-kn-nu-roman-x-whatever';
assertEquals(expected, locale.toString());

View File

@ -0,0 +1,176 @@
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Locale constructor can't be called as function.
assertThrows(() => Intl.Locale('sr'), TypeError);
// Non-string locale.
assertThrows(() => new Intl.Locale(5), TypeError);
assertThrows(() => new Intl.Locale(Symbol()), TypeError);
assertThrows(() => new Intl.Locale(null), TypeError);
assertThrows(() => new Intl.Locale(undefined), TypeError);
assertThrows(() => new Intl.Locale(false), TypeError);
assertThrows(() => new Intl.Locale(true), TypeError);
// Invalid locale string.
assertThrows(() => new Intl.Locale('abcdefghi'), RangeError);
// Options will be force converted into Object.
assertDoesNotThrow(() => new Intl.Locale('sr', 5));
// Regression for http://bugs.icu-project.org/trac/ticket/13417.
assertDoesNotThrow(
() => new Intl.Locale(
'sr-cyrl-rs-t-ja-u-ca-islamic-cu-rsd-tz-uslax-x-whatever', {
calendar: 'buddhist',
caseFirst: 'true',
collation: 'phonebk',
hourCycle: 'h23',
caseFirst: 'upper',
numeric: 'true',
numberingSystem: 'roman',
}),
RangeError);
// Throws only once during construction.
// Check for all getters to prevent regression.
assertThrows(
() => new Intl.Locale('en-US', {
get calendar() {
throw new Error('foo');
}
}),
Error);
assertThrows(
() => new Intl.Locale('en-US', {
get caseFirst() {
throw new Error('foo');
}
}),
Error);
assertThrows(
() => new Intl.Locale('en-US', {
get collation() {
throw new Error('foo');
}
}),
Error);
assertThrows(
() => new Intl.Locale('en-US', {
get hourCycle() {
throw new Error('foo');
}
}),
Error);
assertThrows(
() => new Intl.Locale('en-US', {
get numeric() {
throw new Error('foo');
}
}),
Error);
assertThrows(
() => new Intl.Locale('en-US', {
get numberingSystem() {
throw new Error('foo');
}
}),
Error);
assertThrows(
() => new Intl.Locale('en-US', {
get language() {
throw new Error('foo');
}
}),
Error);
assertThrows(
() => new Intl.Locale('en-US', {
get script() {
throw new Error('foo');
}
}),
Error);
assertThrows(
() => new Intl.Locale('en-US', {
get region() {
throw new Error('foo');
}
}),
Error);
// There won't be an override for baseName so we don't expect it to throw.
assertDoesNotThrow(
() => new Intl.Locale('en-US', {
get baseName() {
throw new Error('foo');
}
}),
Error);
// Preserve the order of getter initialization.
let getCount = 0;
let calendar = -1;
let collation = -1;
let hourCycle = -1;
let caseFirst = -1;
let numeric = -1;
let numberingSystem = -1;
new Intl.Locale('en-US', {
get calendar() {
calendar = ++getCount;
},
get collation() {
collation = ++getCount;
},
get hourCycle() {
hourCycle = ++getCount;
},
get caseFirst() {
caseFirst = ++getCount;
},
get numeric() {
numeric = ++getCount;
},
get numberingSystem() {
numberingSystem = ++getCount;
},
});
assertEquals(1, calendar);
assertEquals(2, collation);
assertEquals(3, hourCycle);
assertEquals(4, caseFirst);
assertEquals(5, numeric);
assertEquals(6, numberingSystem);
// Check getter properties against the spec.
function checkProperties(property) {
let desc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, property);
assertEquals(`get ${property}`, desc.get.name);
assertEquals('function', typeof desc.get)
assertEquals(undefined, desc.set);
assertFalse(desc.enumerable);
assertTrue(desc.configurable);
}
checkProperties('language');
checkProperties('script');
checkProperties('region');
checkProperties('baseName');
checkProperties('calendar');
checkProperties('collation');
checkProperties('hourCycle');
checkProperties('caseFirst');
checkProperties('numeric');
checkProperties('numberingSystem');

View File

@ -0,0 +1,19 @@
// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-intl-locale-info-func
// Test the return items of getCalendars() fit 'type'
let a_to_z = "abcdefghijklmnopqrstuvwxyz";
let regex = /^[a-zA-Z0-9]{3,8}(-[a-zA-Z0-9]{3,8})*$/;
for (var i = 0; i < a_to_z.length; i++) {
for (var j = 0; j < a_to_z.length; j++) {
let l = a_to_z[i] + a_to_z[j];
let locale = new Intl.Locale(l);
locale.getCalendars().forEach(function(tokens) {
assertTrue(regex.test(tokens),
locale + ".getCalendars [" + locale.getCalendars() +
"] but '" + tokens + "' does not meet 'type: alphanum{3,8}(sep alphanum{3,8})*'");
});
}
}

View File

@ -0,0 +1,21 @@
// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-intl-locale-info-func
// Test the return items of getCollations() fit 'type'
let a_to_z = "abcdefghijklmnopqrstuvwxyz";
let regex = /^[a-zA-Z0-9]{3,8}(-[a-zA-Z0-9]{3,8})*$/;
for (var i = 0; i < a_to_z.length; i++) {
for (var j = 0; j < a_to_z.length; j++) {
let l = a_to_z[i] + a_to_z[j];
let locale = new Intl.Locale(l);
print(locale);
locale.getCollations().forEach(function(tokens) {
assertTrue(regex.test(tokens),
locale + ".collations [" + locale.getCollations() +
"] does not meet 'type: alphanum{3,8}(sep alphanum{3,8})*'");
});
assertArrayEquals(locale.getCollations(), locale.getCollations().sort());
}
}

View File

@ -0,0 +1,20 @@
// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-intl-locale-info-func
// Check function properties against the spec.
function checkProperties(property) {
let desc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, property);
assertEquals('function', typeof desc.value)
assertFalse(desc.enumerable);
assertTrue(desc.configurable);
assertTrue(desc.writable);
}
checkProperties('getCalendars');
checkProperties('getCollations');
checkProperties('getHourCycles');
checkProperties('getNumberingSystems');
checkProperties('getTextInfo');
checkProperties('getTimeZones');
checkProperties('getWeekInfo');

View File

@ -0,0 +1,47 @@
// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-intl-locale-info-func
function checkLocale(locale) {
let l = new Intl.Locale(locale);
assertTrue(Array.isArray(l.getCalendars()));
assertTrue(Array.isArray(l.getCollations()));
assertTrue(Array.isArray(l.getHourCycles()));
assertTrue(Array.isArray(l.getNumberingSystems()));
if (l.region == undefined) {
assertEquals(undefined, l.getTimeZones());
} else {
assertTrue(Array.isArray(l.getTimeZones()));
}
assertEquals("object", typeof(l.getTextInfo()));
assertEquals(1, Object.keys(l.getTextInfo()).length);
assertEquals("string", typeof(l.getTextInfo().direction));
assertEquals("object", typeof(l.getWeekInfo()));
assertEquals(2, Object.keys(l.getWeekInfo()).length);
assertEquals("number", typeof(l.getWeekInfo().firstDay));
assertTrue(l.getWeekInfo().firstDay >= 1);
assertTrue(l.getWeekInfo().firstDay <= 7);
assertEquals("object", typeof(l.getWeekInfo().weekend));
let last = 0;
l.getWeekInfo().weekend.forEach((we) => {
// In right range
assertTrue(we >= 1);
assertTrue(we <= 7);
// In order
assertTrue(we >= last);
last = we;
});
// The proposal removed minimalDays in PR99
assertEquals(undefined, l.getWeekInfo().minimalDays);
}
checkLocale("ar");
checkLocale("en");
checkLocale("fr");
checkLocale("en-GB");

View File

@ -0,0 +1,25 @@
// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-intl-locale-info-func
// Test Unicode extension.
function testExt(base, ukey, uvalue, property) {
let baseLocale = new Intl.Locale(base);
let extLocale = new Intl.Locale(base + "-u-" + ukey + "-" + uvalue);
let baseActual = baseLocale[property]();
assertTrue(Array.isArray(baseActual));
assertTrue(baseActual.length > 0);
assertFalse(uvalue == baseActual[0]);
let extActual = extLocale[property]();
assertTrue(Array.isArray(extActual));
assertEquals(1, extActual.length);
assertEquals(uvalue, extActual[0]);
}
testExt("ar", "ca", "roc", "getCalendars");
testExt("fr", "nu", "thai", "getNumberingSystems");
testExt("th", "co", "pinyin", "getCollations");
testExt("ko", "hc", "h11", "getHourCycles");

View File

@ -0,0 +1,22 @@
// Copyright 2023 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-intl-locale-info-func
// Check direction of minority right-to-left languages
assertEquals('rtl', (new Intl.Locale("ar")).getTextInfo().direction, "ar");
assertEquals('rtl', (new Intl.Locale("fa")).getTextInfo().direction, "fa");
assertEquals('rtl', (new Intl.Locale("ae")).getTextInfo().direction, "ae");
assertEquals('rtl', (new Intl.Locale("arc")).getTextInfo().direction, "arc");
assertEquals('rtl', (new Intl.Locale("bcc")).getTextInfo().direction, "bcc");
assertEquals('rtl', (new Intl.Locale("bqi")).getTextInfo().direction, "bqi");
assertEquals('rtl', (new Intl.Locale("dv")).getTextInfo().direction, "dv");
assertEquals('rtl', (new Intl.Locale("glk")).getTextInfo().direction, "glk");
assertEquals('rtl', (new Intl.Locale("mzn")).getTextInfo().direction, "mzn");
assertEquals('rtl', (new Intl.Locale("nqo")).getTextInfo().direction, "nqo");
assertEquals('rtl', (new Intl.Locale("pnb")).getTextInfo().direction, "pnb");
assertEquals('rtl', (new Intl.Locale("sd")).getTextInfo().direction, "sd");
assertEquals('rtl', (new Intl.Locale("ug")).getTextInfo().direction, "ug");
assertEquals('rtl', (new Intl.Locale("yi")).getTextInfo().direction, "yi");
assertEquals('ltr', (new Intl.Locale("ku")).getTextInfo().direction, "ku");
assertEquals('rtl', (new Intl.Locale("ku-Arab")).getTextInfo().direction, "ku-Arab");

View File

@ -0,0 +1,29 @@
// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-intl-locale-info-func
// Check the return array has no undefined
function checkNoUndefined(l, items) {
items.forEach( function(item) {
assertNotUndefined(item, l + ": [" +items + "] should not have undefined");
});
}
function checkLocale(locale) {
let l = new Intl.Locale(locale)
checkNoUndefined(l, l.getCalendars());
checkNoUndefined(l, l.getCollations());
checkNoUndefined(l, l.getHourCycles());
checkNoUndefined(l, l.getNumberingSystems());
if (l.region != undefined) {
checkNoUndefined(l, l.getTimeZones());
}
}
checkLocale("ar");
checkLocale("en");
checkLocale("fr");
checkLocale("en-GB");
checkLocale("en-US");
checkLocale("zh-TW");
checkLocale("zh-CN");

View File

@ -0,0 +1,26 @@
// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-intl-locale-info-func
// Check the return array are sorted
function checkSortedArray(l, name, items) {
assertEquals([...items].sort(), items,
"return value of " + l + "." + name + "should be sorted");
}
function checkLocale(locale) {
let l = new Intl.Locale(locale)
checkSortedArray(l, "getTimeZones", l.getTimeZones());
}
checkLocale("ar-EG");
checkLocale("fr-FR");
checkLocale("en-GB");
checkLocale("en-US");
checkLocale("en-AU");
checkLocale("en-CA");
checkLocale("zh-TW");
checkLocale("zh-CN");
checkLocale("ja-JP");
checkLocale("in-IN");
checkLocale("ru-RU");

View File

@ -0,0 +1,19 @@
// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-intl-locale-info-func
// Test the return items of numberingSystems fit 'type'
let a_to_z = "abcdefghijklmnopqrstuvwxyz";
let regex = /^[a-zA-Z0-9]{3,8}(-[a-zA-Z0-9]{3,8})*$/;
for (var i = 0; i < a_to_z.length; i++) {
for (var j = 0; j < a_to_z.length; j++) {
let l = a_to_z[i] + a_to_z[j];
let locale = new Intl.Locale(l);
locale.getNumberingSystems().forEach(function(tokens) {
assertTrue(regex.test(tokens),
locale + ".numberingSystems [" + locale.getNumberingSystems() +
"] does not meet 'type: alphanum{3,8}(sep alphanum{3,8})*'");
});
}
}

View File

@ -0,0 +1,33 @@
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Make sure that locale exposes all required properties. Those not specified
// should have undefined value.
let locale = new Intl.Locale('sr-cyrl-rs-t-ja-u-ca-islamic-x-whatever', {
calendar: 'buddhist',
caseFirst: 'true',
collation: 'phonebk',
hourCycle: 'h23',
caseFirst: 'upper',
numeric: 'true',
numberingSystem: 'roman'
});
assertEquals('sr', locale.language);
assertEquals('Cyrl', locale.script);
assertEquals('RS', locale.region);
assertEquals('sr-Cyrl-RS', locale.baseName);
assertEquals('buddhist', locale.calendar);
assertEquals('phonebk', locale.collation);
assertEquals('h23', locale.hourCycle);
assertEquals('upper', locale.caseFirst);
assertEquals(true, locale.numeric);
assertEquals('roman', locale.numberingSystem);
// Not defined, expected to undefined.
assertEquals(undefined, locale.currency);
assertEquals(undefined, locale.timeZone);
// Test property defined in spec, but not specified in locale.
let missing_property = new Intl.Locale('sr');
assertEquals(undefined, missing_property.script);

19
deps/v8/test/intl/locale/locale.js vendored Normal file
View File

@ -0,0 +1,19 @@
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
assertEquals("id", (new Intl.Locale("in")).toString());
assertEquals("he", (new Intl.Locale("iw")).toString());
assertEquals("yi", (new Intl.Locale("ji")).toString());
assertEquals("jv", (new Intl.Locale("jw")).toString());
assertEquals("ro", (new Intl.Locale("mo")).toString());
assertEquals("sr", (new Intl.Locale("scc")).toString());
assertEquals("hr", (new Intl.Locale("scr")).toString());
assertEquals("sr-Latn", (new Intl.Locale("sh")).toString());
assertEquals("sr-ME", (new Intl.Locale("cnr")).toString());
assertEquals("no", (new Intl.Locale("no")).toString());
assertEquals("fil", (new Intl.Locale("tl")).toString());
assertEquals("hy-AM", (new Intl.Locale("hy-SU")).toString());
assertEquals("lv-LV", (new Intl.Locale("lv-SU")).toString());

View File

@ -0,0 +1,136 @@
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Make sure that maximize and minimize of all locales work reasonbly.
assertEquals(new Intl.Locale("zh-TW").maximize().toString(), "zh-Hant-TW",
"zh-TW should maximize to zh-Hant-TW");
assertEquals(new Intl.Locale("zh-Hant-TW").minimize().toString(), "zh-TW",
"zh-Hant-TW should minimize to zh-TW");
assertEquals(new Intl.Locale("zh-Hans-CN").minimize().toString(), "zh",
"zh-Hans-CN should minimize to zh");
assertEquals(new Intl.Locale("zh-CN").minimize().toString(), "zh",
"zh-CN should minimize to zh");
assertEquals(new Intl.Locale("zh-Hans").minimize().toString(), "zh",
"zh-Hans should minimize to zh");
function assertExpandRoundTrip(loc) {
assertEquals(
loc.toString(), loc.maximize().minimize().toString(), loc.toString());
assertEquals(
loc.toString(), loc.minimize().toString(), loc.toString());
assertTrue(
loc.maximize().toString().length > loc.toString().length, loc.toString());
}
var simpleLocales = [
"af", "agq", "ak", "am", "ar", "asa", "ast", "as", "az", "bas", "bem", "be",
"bez", "bg", "bm", "bn", "bo", "br", "brx", "bs", "ca", "ccp", "ce", "cgg",
"chr", "ckb", "cs", "cu", "cy", "dav", "da", "de", "dje", "dsb", "dua", "dyo",
"dz", "ebu", "ee", "el", "en", "eo", "es", "et", "eu", "ewo", "fa", "ff",
"fil", "fi", "fo", "fr", "fur", "fy", "ga", "gd", "gl", "gsw", "gu", "guz",
"gv", "haw", "ha", "he", "hi", "hr", "hsb", "hu", "hy", "id", "ig", "ii",
"is", "it", "ja", "jgo", "jmc", "kab", "kam", "ka", "kde", "kea", "khq", "ki",
"kkj", "kk", "kln", "kl", "km", "kn", "kok", "ko", "ksb", "ksf", "ksh", "ks",
"kw", "ky", "lag", "lb", "lg", "lkt", "ln", "lo", "lrc", "lt", "luo", "lu",
"luy", "lv", "mas", "mer", "mfe", "mgh", "mgo", "mg", "mk", "ml", "mn", "mr",
"ms", "mt", "mua", "my", "mzn", "naq", "nb", "nds", "nd", "ne", "nl", "nmg",
"nnh", "nn", "nus", "nyn", "om", "or", "os", "pa", "pl", "prg", "ps", "pt",
"qu", "rm", "rn", "rof", "ro", "ru", "rwk", "rw", "sah", "saq", "sbp", "sd",
"seh", "ses", "se", "sg", "shi", "si", "sk", "sl", "smn", "sn", "so", "sq",
"sr", "sv", "sw", "ta", "teo", "te", "tg", "th", "ti", "tk", "to", "tr", "tt",
"twq", "tzm", "ug", "uk", "ur", "uz", "vai", "vi", "vo", "vun", "wae", "wo",
"xog", "yav", "yi", "yo", "yue", "zgh", "zh", "zu"];
for (var i = 0; i < simpleLocales.length; i++) {
assertExpandRoundTrip(new Intl.Locale(simpleLocales[i]));
}
function assertReduceRoundTrip(loc) {
assertEquals(
loc.minimize().toString(), loc.maximize().minimize().toString(),
loc.toString());
assertEquals(
loc.maximize().toString(), loc.minimize().maximize().toString(),
loc.toString());
assertTrue(
loc.maximize().toString().length >= loc.toString().length, loc.toString());
assertTrue(
loc.minimize().toString().length <= loc.toString().length, loc.toString());
}
var complexLocales = [
"af-NA", "af-ZA", "agq-CM", "ak-GH", "am-ET", "ar-001", "ar-AE", "ar-BH",
"ar-DJ", "ar-DZ", "ar-EG", "ar-EH", "ar-ER", "ar-IL", "ar-IQ", "ar-JO",
"ar-KM", "ar-KW", "ar-LB", "ar-LY", "ar-MA", "ar-MR", "ar-OM", "ar-PS",
"ar-QA", "ar-SA", "ar-SD", "ar-SO", "ar-SS", "ar-SY", "ar-TD", "ar-TN",
"ar-YE", "asa-TZ", "as-IN", "ast-ES", "az-Cyrl-AZ", "az-Cyrl", "az-Latn-AZ",
"az-Latn", "bas-CM", "be-BY", "bem-ZM", "bez-TZ", "bg-BG", "bm-ML", "bn-BD",
"bn-IN", "bo-CN", "bo-IN", "br-FR", "brx-IN", "bs-Cyrl-BA", "bs-Cyrl",
"bs-Latn-BA", "bs-Latn", "ca-AD", "ca-ES", "ca-FR", "ca-IT",
"ccp-BD", "ccp-IN", "ce-RU", "cgg-UG", "chr-US", "ckb-Arab-IQ", "ckb-Arab-IR",
"ckb-Arab", "ckb-IQ", "ckb-IR", "ckb-Latn-IQ", "ckb-Latn", "cs-CZ", "cu-RU",
"cy-GB", "da-DK", "da-GL", "dav-KE", "de-AT", "de-BE", "de-CH", "de-DE",
"de-IT", "de-LI", "de-LU", "dje-NE", "dsb-DE", "dua-CM", "dyo-SN", "dz-BT",
"ebu-KE", "ee-GH", "ee-TG", "el-CY", "el-GR", "en-001", "en-150", "en-AG",
"en-AI", "en-AS", "en-AT", "en-AU", "en-BB", "en-BE", "en-BI", "en-BM",
"en-BS", "en-BW", "en-BZ", "en-CA", "en-CC", "en-CH", "en-CK", "en-CM",
"en-CX", "en-CY", "en-DE", "en-DG", "en-DK", "en-DM", "en-ER", "en-FI",
"en-FJ", "en-FK", "en-FM", "en-GB", "en-GD", "en-GG", "en-GH", "en-GI",
"en-GM", "en-GU", "en-GY", "en-HK", "en-IE", "en-IL", "en-IM", "en-IN",
"en-IO", "en-JE", "en-JM", "en-KE", "en-KI", "en-KN", "en-KY", "en-LC",
"en-LR", "en-LS", "en-MG", "en-MH", "en-MO", "en-MP", "en-MS", "en-MT",
"en-MU", "en-MW", "en-MY", "en-NA", "en-NF", "en-NG", "en-NL", "en-NR",
"en-NU", "en-NZ", "en-PG", "en-PH", "en-PK", "en-PN", "en-PR", "en-PW",
"en-RW", "en-SB", "en-SC", "en-SD", "en-SE", "en-SG", "en-SH", "en-SI",
"en-SL", "en-SS", "en-SX", "en-SZ", "en-TC", "en-TK", "en-TO", "en-TT",
"en-TV", "en-TZ", "en-UG", "en-UM", "en-US", "en-VC",
"en-VG", "en-VI", "en-VU", "en-WS", "en-ZA", "en-ZM", "en-ZW", "eo-001",
"es-419", "es-AR", "es-BO", "es-BR", "es-BZ", "es-CL", "es-CO", "es-CR",
"es-CU", "es-DO", "es-EA", "es-EC", "es-ES", "es-GQ", "es-GT", "es-HN",
"es-IC", "es-MX", "es-NI", "es-PA", "es-PE", "es-PH", "es-PR", "es-PY",
"es-SV", "es-US", "es-UY", "es-VE", "et-EE", "eu-ES", "ewo-CM", "fa-AF",
"fa-IR", "ff-CM", "ff-GN", "ff-MR", "ff-SN", "fi-FI", "fil-PH", "fo-DK",
"fo-FO", "fr-BE", "fr-BF", "fr-BI", "fr-BJ", "fr-BL", "fr-CA", "fr-CD",
"fr-CF", "fr-CG", "fr-CH", "fr-CI", "fr-CM", "fr-DJ", "fr-DZ", "fr-FR",
"fr-GA", "fr-GF", "fr-GN", "fr-GP", "fr-GQ", "fr-HT", "fr-KM", "fr-LU",
"fr-MA", "fr-MC", "fr-MF", "fr-MG", "fr-ML", "fr-MQ", "fr-MR", "fr-MU",
"fr-NC", "fr-NE", "fr-PF", "fr-PM", "fr-RE", "fr-RW", "fr-SC", "fr-SN",
"fr-SY", "fr-TD", "fr-TG", "fr-TN", "fr-VU", "fr-WF", "fr-YT", "fur-IT",
"fy-NL", "ga-IE", "gd-GB", "gl-ES", "gsw-CH", "gsw-FR", "gsw-LI", "gu-IN",
"guz-KE", "gv-IM", "ha-GH", "ha-NE", "ha-NG", "haw-US", "he-IL", "hi-IN",
"hr-BA", "hr-HR", "hsb-DE", "hu-HU", "hy-AM", "id-ID", "ig-NG", "ii-CN",
"is-IS", "it-CH", "it-IT", "it-SM", "it-VA", "ja-JP", "jgo-CM", "jmc-TZ",
"kab-DZ", "ka-GE", "kam-KE", "kde-TZ", "kea-CV", "khq-ML", "ki-KE",
"kkj-CM", "kk-KZ", "kl-GL", "kln-KE", "km-KH", "kn-IN", "kok-IN", "ko-KP",
"ko-KR", "ksb-TZ", "ksf-CM", "ksh-DE", "ks-IN", "kw-GB", "ky-KG", "lag-TZ",
"lb-LU", "lg-UG", "lkt-US", "ln-AO", "ln-CD", "ln-CF", "ln-CG", "lo-LA",
"lrc-IQ", "lrc-IR", "lt-LT", "lu-CD", "luo-KE", "luy-KE", "lv-LV", "mas-KE",
"mas-TZ", "mer-KE", "mfe-MU", "mgh-MZ", "mg-MG", "mgo-CM", "mk-MK", "ml-IN",
"mn-MN", "mr-IN", "ms-BN", "ms-MY", "ms-SG", "mt-MT", "mua-CM", "my-MM",
"mzn-IR", "naq-NA", "nb-NO", "nb-SJ", "nds-DE", "nds-NL", "nd-ZW", "ne-IN",
"ne-NP", "nl-AW", "nl-BE", "nl-BQ", "nl-CW", "nl-NL", "nl-SR", "nl-SX",
"nmg-CM", "nnh-CM", "nn-NO", "nus-SS", "nyn-UG", "om-ET", "om-KE",
"or-IN", "os-GE", "os-RU", "pa-Arab-PK", "pa-Guru-IN", "pa-Guru",
"pl-PL", "prg-001", "ps-AF", "pt-AO", "pt-BR", "pt-CH", "pt-CV", "pt-GQ",
"pt-GW", "pt-LU", "pt-MO", "pt-MZ", "pt-PT", "pt-ST", "pt-TL", "qu-BO",
"qu-EC", "qu-PE", "rm-CH", "rn-BI", "rof-TZ", "ro-MD", "ro-RO", "ru-BY",
"ru-KG", "ru-KZ", "ru-MD", "ru-RU", "ru-UA", "rwk-TZ", "rw-RW", "sah-RU",
"saq-KE", "sbp-TZ", "sd-PK", "se-FI", "seh-MZ", "se-NO", "se-SE", "ses-ML",
"sg-CF", "shi-Latn-MA", "shi-Latn", "shi-Tfng-MA", "shi-Tfng", "si-LK",
"sk-SK", "sl-SI", "smn-FI", "sn-ZW", "so-DJ", "so-ET", "so-KE", "so-SO",
"sq-AL", "sq-MK", "sq-XK", "sr-Cyrl-BA", "sr-Cyrl-ME", "sr-Cyrl-RS",
"sr-Cyrl-XK", "sr-Cyrl", "sr-Latn-BA", "sr-Latn-ME", "sr-Latn-RS",
"sr-Latn-XK", "sr-Latn", "sv-AX", "sv-FI", "sv-SE", "sw-CD", "sw-KE",
"sw-TZ", "sw-UG", "ta-IN", "ta-LK", "ta-MY", "ta-SG", "te-IN", "teo-KE",
"teo-UG", "tg-TJ", "th-TH", "ti-ER", "ti-ET", "tk-TM", "to-TO", "tr-CY",
"tr-TR", "tt-RU", "twq-NE", "tzm-MA", "ug-CN", "uk-UA", "ur-IN", "ur-PK",
"uz-Arab-AF", "uz-Cyrl-UZ", "uz-Cyrl", "uz-Latn-UZ", "uz-Latn",
"vai-Latn-LR", "vai-Latn", "vai-Vaii-LR", "vai-Vaii", "vi-VN", "vo-001",
"vun-TZ", "wae-CH", "wo-SN", "xog-UG", "yav-CM", "yi-001", "yo-BJ", "yo-NG",
"yue-Hans-CN", "yue-Hant-HK", "yue-Hant", "zgh-MA", "zh-Hans-CN",
"zh-Hans-HK", "zh-Hans-MO", "zh-Hans-SG", "zh-Hans", "zh-Hant-HK",
"zh-Hant-MO", "zh-Hant-TW", "zu-ZA"];
for (var i = 0; i < complexLocales.length; i++) {
assertReduceRoundTrip(new Intl.Locale(complexLocales[i]));
}

20
deps/v8/test/intl/locale/property.js vendored Normal file
View File

@ -0,0 +1,20 @@
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Make sure that accessing locale property will return undefined instead of
// crash.
let locale = new Intl.Locale('sr');
assertEquals('sr', locale.toString());
assertEquals('sr', locale.baseName);
assertEquals('sr', locale.language);
assertEquals(undefined, locale.script);
assertEquals(undefined, locale.region);
assertEquals(false, locale.numeric);
assertEquals(undefined, locale.calendar);
assertEquals(undefined, locale.collation);
assertEquals(undefined, locale.hourCycle);
assertEquals(undefined, locale.caseFirst);
assertEquals(undefined, locale.numberingSystem);

View File

@ -0,0 +1,5 @@
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
assertThrows(() => new Intl.Locale(''), RangeError);