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,18 @@
// 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.islamic'
const calendars = [
'buddhist', 'chinese', 'coptic', 'dangi', 'ethioaa', 'ethiopic-amete-alem',
'ethiopic', 'gregory', 'hebrew', 'indian', 'islamic', 'islamic-umalqura',
'islamic-tbla', 'islamic-civil', 'islamic-rgsa', 'iso8601', 'japanese',
'persian', 'roc'
];
let en = new Intl.DisplayNames("en", {type: 'calendar'});
let zh = new Intl.DisplayNames("zh", {type: 'calendar'});
calendars.forEach(function(calendar) {
assertFalse(en.of(calendar) == zh.of(calendar),
calendar + ":" + en.of(calendar) + " == " +
zh.of(calendar));
});

View File

@ -0,0 +1,28 @@
// 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.
// Throws only once during construction.
// Check for all getters to prevent regression.
// Preserve the order of getter initialization.
let getCount = 0;
new Intl.DisplayNames(['en-US'], {
get localeMatcher() {
assertEquals(0, getCount++);
},
get style() {
assertEquals(1, getCount++);
},
get type() {
assertEquals(2, getCount++);
return 'language';
},
get fallback() {
assertEquals(3, getCount++);
},
get languageDisplay() {
assertEquals(4, getCount++);
},
});
assertEquals(5, getCount);

View File

@ -0,0 +1,25 @@
// 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.
// Throws only once during construction.
// Check for all getters to prevent regression.
// Preserve the order of getter initialization.
let getCount = 0;
new Intl.DisplayNames(['en-US'], {
get localeMatcher() {
assertEquals(0, getCount++);
},
get style() {
assertEquals(1, getCount++);
},
get type() {
assertEquals(2, getCount++);
return 'language';
},
get fallback() {
assertEquals(3, getCount++);
},
});
assertEquals(4, getCount);

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.
assertDoesNotThrow(
() => new Intl.DisplayNames(
'sr', {type: 'calendar'}));
assertDoesNotThrow(
() => new Intl.DisplayNames(
'sr', {type: 'dateTimeField'}));
assertDoesNotThrow(
() => new Intl.DisplayNames(
'sr', {type: 'language', languageDisplay: 'standard'}));
assertDoesNotThrow(
() => new Intl.DisplayNames(
'sr', {type: 'language', languageDisplay: 'dialect'}));

View File

@ -0,0 +1,114 @@
// 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.
// DisplayNames constructor can't be called as function.
assertThrows(() => Intl.DisplayNames('sr'), TypeError);
assertThrows(() => Intl.DisplayNames('sr', {}), TypeError);
assertThrows(() => Intl.DisplayNames(undefined, {}), TypeError);
assertDoesNotThrow(() =>
new Intl.DisplayNames('sr', {type: 'language'}));
assertDoesNotThrow(() =>
new Intl.DisplayNames([], {type: 'language'}));
assertDoesNotThrow(() =>
new Intl.DisplayNames(['fr', 'ar'], {type: 'language'}));
assertDoesNotThrow(() =>
new Intl.DisplayNames({0: 'ja', 1:'fr'}, {type: 'language'}));
assertDoesNotThrow(() =>
new Intl.DisplayNames({1: 'ja', 2:'fr'}, {type: 'language'}));
assertDoesNotThrow(() =>
new Intl.DisplayNames('sr', {type: 'language'}));
assertDoesNotThrow(() =>
new Intl.DisplayNames(undefined, {type: 'language'}));
assertDoesNotThrow(
() => new Intl.DisplayNames(
'sr', {
localeMatcher: 'lookup',
style: 'short',
type: 'language',
fallback: 'code',
}));
assertDoesNotThrow(
() => new Intl.DisplayNames(
'sr', {localeMatcher: 'lookup', type: 'language'}));
assertDoesNotThrow(
() => new Intl.DisplayNames(
'sr', {localeMatcher: 'best fit', type: 'language'}));
assertThrows(
() => new Intl.DisplayNames(
'sr', {localeMatcher: 'hello', type: 'language'}),
RangeError);
assertThrows(
() => new Intl.DisplayNames(
'sr', {localeMatcher: 'look up', type: 'language'}),
RangeError);
assertThrows(
() => new Intl.DisplayNames(
'sr', {localeMatcher: 'bestfit', type: 'language'}),
RangeError);
assertDoesNotThrow(
() => new Intl.DisplayNames(
'sr', {style: 'long', type: 'language'}));
assertDoesNotThrow(
() => new Intl.DisplayNames(
'sr', {style: 'short', type: 'language'}));
assertDoesNotThrow(
() => new Intl.DisplayNames(
'sr', {style: 'narrow', type: 'language'}));
assertThrows(
() => new Intl.DisplayNames(
'sr', {style: 'giant', type: 'language'}),
RangeError);
assertDoesNotThrow(
() => new Intl.DisplayNames(
'sr', {fallback: 'code', type: 'language'}));
assertDoesNotThrow(
() => new Intl.DisplayNames(
'sr', {fallback: 'none', type: 'language'}));
assertThrows(
() => new Intl.DisplayNames(
'sr', {fallback: 'never', type: 'language'}),
RangeError);
assertDoesNotThrow(
() => new Intl.DisplayNames(
'sr', {type: 'language'}));
assertDoesNotThrow(
() => new Intl.DisplayNames(
'sr', {type: 'region'}));
assertDoesNotThrow(
() => new Intl.DisplayNames(
'sr', {type: 'script'}));
assertDoesNotThrow(
() => new Intl.DisplayNames(
'sr', {type: 'currency'}));
assertThrows(
() => new Intl.DisplayNames(
'sr', {type: ''}),
RangeError);

View File

@ -0,0 +1,16 @@
// 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.
const dateTimeFields = [
'era', 'year', 'quarter', 'month', 'weekOfYear', 'weekday', 'day',
'dayPeriod', 'hour', 'minute', 'second', 'timeZoneName'
];
let en = new Intl.DisplayNames("en", {type: 'dateTimeField'});
let zh = new Intl.DisplayNames("zh", {type: 'dateTimeField'});
dateTimeFields.forEach(function(dateTimeField) {
assertFalse(en.of(dateTimeField) == zh.of(dateTimeField),
dateTimeField + ":" + en.of(dateTimeField) + " == " +
zh.of(dateTimeField));
});

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.
// Test Intl.DisplayNames call GetOptionsObject instead of ToObject
// https://tc39.es/ecma402/#sec-getoptionsobject
// https://tc39.es/ecma262/#sec-toobject
let testCases = [
null, // Null
true, // Boolean
false, // Boolean
1234, // Number
"string", // String
Symbol('foo'), // Symbol
9007199254740991n // BigInt
];
testCases.forEach(function (testCase) {
assertThrows(() => new Intl.DisplayNames("en", testCase), TypeError);
});

View File

@ -0,0 +1,71 @@
// 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.
// Test the calling of the effect of CanonicalizeUnicodeLocaleId(code).
// in step 1.c of
// https://tc39.es/ecma402/#sec-canonicalcodefordisplaynames
//
// The following Data generated by
// METAFILE="third_party/icu/source/data/misc/metadata.txt"
// egrep "^[ ]{12}[a-z]{2,3}(_[a-z]{4})?(_[A-Za-z]{2})?(_[a-z]{5,8})*{" $METAFILE | \
// sed -e "s/^ */ \"/g" | tr "_{\n" "-\"," |fold -s -w 70
//
let testCases = [
"aa-saaho", "aam", "aar", "abk", "adp", "afr", "agp", "ais", "aju",
"aka", "alb", "als", "amh", "ara", "arb", "arg", "arm", "art-lojban",
"asd", "asm", "aue", "ava", "ave", "aym", "ayr", "ayx", "aze", "azj",
"bak", "bam", "baq", "baz", "bcc", "bcl", "bel", "ben", "bgm", "bh",
"bhk", "bih", "bis", "bjd", "bjq", "bkb", "bod", "bos", "bre", "btb",
"bul", "bur", "bxk", "bxr", "cat", "ccq", "cel-gaulish", "ces",
"cha", "che", "chi", "chu", "chv", "cjr", "cka", "cld", "cmk", "cmn",
"cnr", "cor", "cos", "coy", "cqu", "cre", "cwd", "cym", "cze", "daf",
"dan", "dap", "deu", "dgo", "dhd", "dik", "diq", "dit", "div", "djl",
"dkl", "drh", "drr", "drw", "dud", "duj", "dut", "dwl", "dzo", "ekk",
"ell", "elp", "emk", "eng", "epo", "esk", "est", "eus", "ewe", "fao",
"fas", "fat", "fij", "fin", "fra", "fre", "fry", "fuc", "ful", "gav",
"gaz", "gbc", "gbo", "geo", "ger", "gfx", "ggn", "ggo", "ggr", "gio",
"gla", "gle", "glg", "gli", "glv", "gno", "gre", "grn", "gti", "gug",
"guj", "guv", "gya", "hat", "hau", "hbs", "hdn", "hea", "heb", "her",
"him", "hin", "hmo", "hrr", "hrv", "hun", "hy-arevmda", "hye", "ibi",
"ibo", "ice", "ido", "iii", "ike", "iku", "ile", "ill", "ilw", "in",
"ina", "ind", "ipk", "isl", "ita", "iw", "izi", "jar", "jav", "jeg",
"ji", "jpn", "jw", "kal", "kan", "kas", "kat", "kau", "kaz", "kdv",
"kgc", "kgd", "kgh", "khk", "khm", "kik", "kin", "kir", "kmr", "knc",
"kng", "knn", "koj", "kom", "kon", "kor", "kpp", "kpv", "krm", "ktr",
"kua", "kur", "kvs", "kwq", "kxe", "kxl", "kzh", "kzj", "kzt", "lao",
"lat", "lav", "lbk", "leg", "lii", "lim", "lin", "lit", "llo", "lmm",
"ltz", "lub", "lug", "lvs", "mac", "mah", "mal", "mao", "mar", "may",
"meg", "mgx", "mhr", "mkd", "mlg", "mlt", "mnk", "mnt", "mo", "mof",
"mol", "mon", "mri", "msa", "mst", "mup", "mwd", "mwj", "mya", "myd",
"myt", "nad", "nau", "nav", "nbf", "nbl", "nbx", "ncp", "nde", "ndo",
"nep", "nld", "nln", "nlr", "nno", "nns", "nnx", "no", "no-bokmal",
"no-nynorsk", "nob", "noo", "nor", "npi", "nts", "nxu", "nya", "oci",
"ojg", "oji", "ori", "orm", "ory", "oss", "oun", "pan", "pbu", "pcr",
"per", "pes", "pli", "plt", "pmc", "pmu", "pnb", "pol", "por", "ppa",
"ppr", "prs", "pry", "pus", "puz", "que", "quz", "rmr", "rmy", "roh",
"ron", "rum", "run", "rus", "sag", "san", "sap", "sca", "scc", "scr",
"sgl", "sgn-BR", "sgn-CO", "sgn-DE", "sgn-DK", "sgn-ES", "sgn-FR",
"sgn-GB", "sgn-GR", "sgn-IE", "sgn-IT", "sgn-JP", "sgn-MX", "sgn-NI",
"sgn-NL", "sgn-NO", "sgn-PT", "sgn-SE", "sgn-US", "sgn-ZA", "sh",
"sin", "skk", "slk", "slo", "slv", "sme", "smo", "sna", "snd", "som",
"sot", "spa", "spy", "sqi", "src", "srd", "srp", "ssw", "sul", "sum",
"sun", "swa", "swc", "swe", "swh", "tah", "tam", "tat", "tdu", "tel",
"tgg", "tgk", "tgl", "tha", "thc", "thw", "thx", "tib", "tid", "tie",
"tir", "tkk", "tl", "tlw", "tmp", "tne", "tnf", "ton", "tsf", "tsn",
"tso", "ttq", "tuk", "tur", "tw", "twi", "uig", "ukr", "umu",
"und-aaland", "und-arevela", "und-arevmda", "und-bokmal",
"und-hakka", "und-hepburn-heploc", "und-lojban", "und-nynorsk",
"und-saaho", "und-xiang", "unp", "uok", "urd", "uzb", "uzn", "ven",
"vie", "vol", "wel", "wgw", "wit", "wiw", "wln", "wol", "xba", "xho",
"xia", "xkh", "xpe", "xrq", "xsj", "xsl", "ybd", "ydd", "yen", "yid",
"yiy", "yma", "ymt", "yor", "yos", "yuu", "zai", "zh-guoyu",
"zh-hakka", "zh-xiang", "zha", "zho", "zir", "zsm", "zul", "zyb",
"fra", "frb", "frc", "frd", "fre", "frf", "frg", "frh", "fri", "frj",
"frk", "frl", "frm", "frn", "fro", "frp", "frq", "frr", "frs", "frt",
"fru", "frv", "lud", "lug", "lul", "nzn", "nzs",
];
let dn = new Intl.DisplayNames("en", {type: "language"})
testCases.forEach(function(locale) {
assertEquals(dn.of(new Intl.Locale(locale)), dn.of(locale))
})

View File

@ -0,0 +1,56 @@
// 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.
let displayNames = new Intl.DisplayNames(undefined, {type: 'language'});
// The default languageDisplay is 'dialect' if type is 'language'
assertEquals('dialect', displayNames.resolvedOptions().languageDisplay);
['region', 'script', 'calendar', 'dateTimeField', 'currency'].forEach(
function(type) {
let dn = new Intl.DisplayNames(undefined, {type});
assertEquals(undefined, dn.resolvedOptions().languageDisplay);
});
const styles = ["long", "short", "narrow"];
const types = ["calendar", "dateTimeField"];
const fallbacks = ["code", "none"];
styles.forEach(function(style) {
types.forEach(function(type) {
assertEquals(style,
(new Intl.DisplayNames(['sr'], {style, type})).resolvedOptions().style);
assertEquals(type,
(new Intl.DisplayNames(['sr'], {style, type})).resolvedOptions().type);
assertEquals(fallbacks[0],
(new Intl.DisplayNames(
['sr'], {style, type})).resolvedOptions().fallback);
fallbacks.forEach(function(fallback) {
assertEquals(style,
(new Intl.DisplayNames(
['sr'], {style, type, fallback})).resolvedOptions().style);
assertEquals(type,
(new Intl.DisplayNames(
['sr'], {style, type, fallback})).resolvedOptions().type);
assertEquals(fallback,
(new Intl.DisplayNames(
['sr'], {style, type, fallback})).resolvedOptions().fallback);
});
});
});
const languageDisplays = ["dialect", "standard"];
styles.forEach(function(style) {
let type = 'language';
languageDisplays.forEach(function(languageDisplay) {
assertEquals(style,
(new Intl.DisplayNames(['sr'], {style, type, languageDisplay}))
.resolvedOptions().style);
assertEquals(type,
(new Intl.DisplayNames(['sr'], {style, type, languageDisplay}))
.resolvedOptions().type);
assertEquals(languageDisplay,
(new Intl.DisplayNames(['sr'], {style, type, languageDisplay}))
.resolvedOptions().languageDisplay);
});
});

View File

@ -0,0 +1,39 @@
// 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.
let displayNames = new Intl.DisplayNames(undefined, {type: 'language'});
// The default style is 'long'
assertEquals('long', displayNames.resolvedOptions().style);
assertEquals('language', displayNames.resolvedOptions().type);
// The default fallback is 'code'
assertEquals('code', displayNames.resolvedOptions().fallback);
const styles = ["long", "short", "narrow"];
const types = ["language", "region", "script", "currency"];
const fallbacks = ["code", "none"];
styles.forEach(function(style) {
types.forEach(function(type) {
assertEquals(style,
(new Intl.DisplayNames(['sr'], {style, type})).resolvedOptions().style);
assertEquals(type,
(new Intl.DisplayNames(['sr'], {style, type})).resolvedOptions().type);
assertEquals(fallbacks[0],
(new Intl.DisplayNames(
['sr'], {style, type})).resolvedOptions().fallback);
fallbacks.forEach(function(fallback) {
assertEquals(style,
(new Intl.DisplayNames(
['sr'], {style, type, fallback})).resolvedOptions().style);
assertEquals(type,
(new Intl.DisplayNames(
['sr'], {style, type, fallback})).resolvedOptions().type);
assertEquals(fallback,
(new Intl.DisplayNames(
['sr'], {style, type, fallback})).resolvedOptions().fallback);
});
});
});

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.
assertEquals(typeof Intl.DisplayNames.supportedLocalesOf, "function",
"Intl.DisplayNames.supportedLocalesOf should be a function");
var undef = Intl.DisplayNames.supportedLocalesOf();
assertEquals([], undef);
var empty = Intl.DisplayNames.supportedLocalesOf([]);
assertEquals([], empty);
var strLocale = Intl.DisplayNames.supportedLocalesOf('sr');
assertEquals('sr', strLocale[0]);
var multiLocale = ['sr-Thai-RS', 'de', 'zh-CN'];
assertEquals(multiLocale,
Intl.DisplayNames.supportedLocalesOf(multiLocale,
{localeMatcher: "lookup"}));