[Intl] Reland tests of "Validate u extension type"
This is a PARTIAL reland of 8d0942499c
Only land the newly added tests files
Original change's description:
> [Intl] Validate u extension type
>
> Fix intl402/*/ignore-invalid-unicode-ext-values
> Add tests for other valid/invalid -u- ext values.
>
> Bug: v8:7481
> Change-Id: I429effd071bb03599a1e767bb2a9e9918a91b850
> Reviewed-on: https://chromium-review.googlesource.com/c/1351307
> Commit-Queue: Frank Tang <ftang@chromium.org>
> Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#58173}
Bug: v8:7481
Change-Id: I0a1c5701ade330026e2cf7eb554c6390b048a68d
Reviewed-on: https://chromium-review.googlesource.com/c/1396737
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58604}
This commit is contained in:
parent
4365bf23aa
commit
75eed9af71
33
test/intl/collator/check-co-option.js
Normal file
33
test/intl/collator/check-co-option.js
Normal 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.
|
||||
|
||||
let invalid_co = [
|
||||
"invalid",
|
||||
"search",
|
||||
"standard",
|
||||
"abce",
|
||||
];
|
||||
|
||||
let valid_locales = [
|
||||
"zh-u-co-zhuyin",
|
||||
"zh-u-co-stroke",
|
||||
"ar-u-co-compat",
|
||||
"en-u-co-emoji",
|
||||
"en-u-co-eor",
|
||||
"zh-Hant-u-co-pinyin",
|
||||
"ko-u-co-searchjl",
|
||||
"ja-u-co-unihan",
|
||||
];
|
||||
|
||||
invalid_co.forEach(function(co) {
|
||||
let col = new Intl.Collator(["en-u-co-" + co]);
|
||||
assertEquals("en", col.resolvedOptions().locale);
|
||||
}
|
||||
);
|
||||
|
||||
valid_locales.forEach(function(l) {
|
||||
let col = new Intl.Collator([l + "-fo-obar"]);
|
||||
assertEquals(l, col.resolvedOptions().locale);
|
||||
}
|
||||
);
|
36
test/intl/collator/check-kf-option.js
Normal file
36
test/intl/collator/check-kf-option.js
Normal file
@ -0,0 +1,36 @@
|
||||
// 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.
|
||||
|
||||
let invalid_kf = [
|
||||
"invalid",
|
||||
"abce",
|
||||
"none",
|
||||
"true",
|
||||
];
|
||||
|
||||
let valid_kf= [
|
||||
"false",
|
||||
"upper",
|
||||
"lower",
|
||||
];
|
||||
|
||||
let locales = [
|
||||
"en",
|
||||
"fr",
|
||||
];
|
||||
|
||||
invalid_kf.forEach(function(kf) {
|
||||
let col = new Intl.Collator(["en-u-kf-" + kf + "-fo-obar"]);
|
||||
assertEquals("en", col.resolvedOptions().locale);
|
||||
}
|
||||
);
|
||||
|
||||
valid_kf.forEach(function(kf) {
|
||||
locales.forEach(function(base) {
|
||||
let l = base + "-u-kf-" + kf;
|
||||
let col = new Intl.Collator([l + "-fo-obar"]);
|
||||
assertEquals(l, col.resolvedOptions().locale);
|
||||
});
|
||||
}
|
||||
);
|
29
test/intl/collator/check-kn-option.js
Normal file
29
test/intl/collator/check-kn-option.js
Normal file
@ -0,0 +1,29 @@
|
||||
// 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.
|
||||
|
||||
let invalid_kn = [
|
||||
"invalid",
|
||||
"search",
|
||||
"standard",
|
||||
"abce",
|
||||
];
|
||||
|
||||
let valid_kn = [
|
||||
["en-u-kn", true, "en-u-kn"],
|
||||
["en-u-kn-true", true, "en-u-kn"],
|
||||
["en-u-kn-false",false, "en-u-kn-false"],
|
||||
];
|
||||
|
||||
invalid_kn.forEach(function(kn) {
|
||||
let col = new Intl.Collator(["en-u-kn-" + kn]);
|
||||
assertEquals("en", col.resolvedOptions().locale);
|
||||
}
|
||||
);
|
||||
|
||||
valid_kn.forEach(function(l) {
|
||||
let col = new Intl.Collator([l[0] + "-fo-obar"]);
|
||||
assertEquals(l[1], col.resolvedOptions().numeric);
|
||||
assertEquals(l[2], col.resolvedOptions().locale);
|
||||
}
|
||||
);
|
51
test/intl/date-format/check-ca-option.js
Normal file
51
test/intl/date-format/check-ca-option.js
Normal file
@ -0,0 +1,51 @@
|
||||
// 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.
|
||||
|
||||
|
||||
let invalid_ca = [
|
||||
"invalid",
|
||||
"abce",
|
||||
];
|
||||
|
||||
// https://www.unicode.org/repos/cldr/tags/latest/common/bcp47/calendar.xml
|
||||
let valid_ca= [
|
||||
"buddhist",
|
||||
"chinese",
|
||||
"coptic",
|
||||
"dangi",
|
||||
"ethioaa",
|
||||
"ethiopic",
|
||||
"gregory",
|
||||
"hebrew",
|
||||
"indian",
|
||||
"islamic",
|
||||
"islamic-umalqura",
|
||||
"islamic-tbla",
|
||||
"islamic-civil",
|
||||
"islamic-rgsa",
|
||||
"iso8601",
|
||||
"japanese",
|
||||
"persian",
|
||||
"roc",
|
||||
];
|
||||
|
||||
let locales = [
|
||||
"en",
|
||||
"ar",
|
||||
];
|
||||
|
||||
invalid_ca.forEach(function(ca) {
|
||||
let df = new Intl.DateTimeFormat(["en-u-ca-" + ca + "-fo-obar"]);
|
||||
assertEquals("en", df.resolvedOptions().locale);
|
||||
}
|
||||
);
|
||||
|
||||
valid_ca.forEach(function(ca) {
|
||||
locales.forEach(function(base) {
|
||||
let l = base + "-u-ca-" + ca;
|
||||
let df = new Intl.DateTimeFormat([l + "-fo-obar"]);
|
||||
assertEquals(l, df.resolvedOptions().locale);
|
||||
});
|
||||
}
|
||||
);
|
59
test/intl/date-format/check-nu-option.js
Normal file
59
test/intl/date-format/check-nu-option.js
Normal file
@ -0,0 +1,59 @@
|
||||
// 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.
|
||||
|
||||
|
||||
let invalid_nu = [
|
||||
"invalid",
|
||||
"abce",
|
||||
"finance",
|
||||
"native",
|
||||
"traditio",
|
||||
];
|
||||
|
||||
// https://tc39.github.io/ecma402/#table-numbering-system-digits
|
||||
let valid_nu= [
|
||||
"arab",
|
||||
"arabext",
|
||||
"bali",
|
||||
"beng",
|
||||
"deva",
|
||||
"fullwide",
|
||||
"gujr",
|
||||
"guru",
|
||||
"hanidec",
|
||||
"khmr",
|
||||
"knda",
|
||||
"laoo",
|
||||
"latn",
|
||||
"limb",
|
||||
"mlym",
|
||||
"mong",
|
||||
"mymr",
|
||||
"orya",
|
||||
"tamldec",
|
||||
"telu",
|
||||
"thai",
|
||||
"tibt",
|
||||
];
|
||||
|
||||
let locales = [
|
||||
"en",
|
||||
"ar",
|
||||
];
|
||||
|
||||
|
||||
invalid_nu.forEach(function(nu) {
|
||||
let df = new Intl.DateTimeFormat(["en-u-nu-" + nu + "-fo-obar"]);
|
||||
assertEquals("en", df.resolvedOptions().locale);
|
||||
}
|
||||
);
|
||||
|
||||
valid_nu.forEach(function(nu) {
|
||||
locales.forEach(function(base) {
|
||||
let l = base + "-u-nu-" + nu;
|
||||
let df = new Intl.DateTimeFormat([l + "-fo-obar"]);
|
||||
assertEquals(l, df.resolvedOptions().locale);
|
||||
});
|
||||
}
|
||||
);
|
@ -27,10 +27,18 @@
|
||||
|
||||
[
|
||||
[ALWAYS, {
|
||||
# TODO(jochen): The following test is flaky.
|
||||
# TODO(jochen): The following test is flaky.
|
||||
'overrides/caching': [PASS, FAIL],
|
||||
|
||||
# https://code.google.com/p/v8/issues/detail?id=7481
|
||||
'regress-7481': [FAIL],
|
||||
'collator/check-kf-option': [FAIL],
|
||||
'collator/check-kn-option': [FAIL],
|
||||
'date-format/check-ca-option': [FAIL],
|
||||
'date-format/check-hc-option': [FAIL],
|
||||
'date-format/check-nu-option': [FAIL],
|
||||
'number-format/check-nu-option': [FAIL],
|
||||
'segmenter/check-lb-option': [FAIL],
|
||||
}], # ALWAYS
|
||||
|
||||
['variant == no_wasm_traps', {
|
||||
|
59
test/intl/number-format/check-nu-option.js
Normal file
59
test/intl/number-format/check-nu-option.js
Normal file
@ -0,0 +1,59 @@
|
||||
// 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.
|
||||
|
||||
|
||||
let invalid_nu = [
|
||||
"invalid",
|
||||
"abce",
|
||||
"finance",
|
||||
"native",
|
||||
"traditio",
|
||||
];
|
||||
|
||||
// https://tc39.github.io/ecma402/#table-numbering-system-digits
|
||||
let valid_nu= [
|
||||
"arab",
|
||||
"arabext",
|
||||
"bali",
|
||||
"beng",
|
||||
"deva",
|
||||
"fullwide",
|
||||
"gujr",
|
||||
"guru",
|
||||
"hanidec",
|
||||
"khmr",
|
||||
"knda",
|
||||
"laoo",
|
||||
"latn",
|
||||
"limb",
|
||||
"mlym",
|
||||
"mong",
|
||||
"mymr",
|
||||
"orya",
|
||||
"tamldec",
|
||||
"telu",
|
||||
"thai",
|
||||
"tibt",
|
||||
];
|
||||
|
||||
let locales = [
|
||||
"en",
|
||||
"ar",
|
||||
];
|
||||
|
||||
|
||||
invalid_nu.forEach(function(nu) {
|
||||
let nf = new Intl.NumberFormat(["en-u-nu-" + nu + "-fo-obar"]);
|
||||
assertEquals("en", nf.resolvedOptions().locale);
|
||||
}
|
||||
);
|
||||
|
||||
valid_nu.forEach(function(nu) {
|
||||
locales.forEach(function(base) {
|
||||
let l = base + "-u-nu-" + nu;
|
||||
let nf = new Intl.NumberFormat([l + "-fo-obar"]);
|
||||
assertEquals(l, nf.resolvedOptions().locale);
|
||||
});
|
||||
}
|
||||
);
|
39
test/intl/regress-7481.js
Normal file
39
test/intl/regress-7481.js
Normal file
@ -0,0 +1,39 @@
|
||||
// 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.
|
||||
assertEquals(
|
||||
"en-u-hc-h11-nu-arab",
|
||||
new Intl.DateTimeFormat(["en-u-hc-h11-nu-arab"]).resolvedOptions().locale
|
||||
);
|
||||
assertEquals(
|
||||
"en-u-hc-h12-nu-arab",
|
||||
new Intl.DateTimeFormat(["en-u-hc-h12-nu-arab"]).resolvedOptions().locale
|
||||
);
|
||||
assertEquals(
|
||||
"en-u-hc-h23-nu-arab",
|
||||
new Intl.DateTimeFormat(["en-u-hc-h23-nu-arab"]).resolvedOptions().locale
|
||||
);
|
||||
assertEquals(
|
||||
"en-u-hc-h24-nu-arab",
|
||||
new Intl.DateTimeFormat(["en-u-hc-h24-nu-arab"]).resolvedOptions().locale
|
||||
);
|
||||
|
||||
// https://tc39.github.io/ecma402/#sec-intl.datetimeformat-internal-slots
|
||||
// invalid hc should be removed
|
||||
// [[LocaleData]][locale].hc must be « null, "h11", "h12", "h23", "h24" » for all locale values.
|
||||
assertEquals(
|
||||
"en-u-nu-arab",
|
||||
new Intl.DateTimeFormat(["en-u-hc-h10-nu-arab"]).resolvedOptions().locale
|
||||
);
|
||||
assertEquals(
|
||||
"en-u-nu-arab",
|
||||
new Intl.DateTimeFormat(["en-u-hc-h13-nu-arab"]).resolvedOptions().locale
|
||||
);
|
||||
assertEquals(
|
||||
"en-u-nu-arab",
|
||||
new Intl.DateTimeFormat(["en-u-hc-h22-nu-arab"]).resolvedOptions().locale
|
||||
);
|
||||
assertEquals(
|
||||
"en-u-nu-arab",
|
||||
new Intl.DateTimeFormat(["en-u-hc-h25-nu-arab"]).resolvedOptions().locale
|
||||
);
|
41
test/intl/segmenter/check-lb-option.js
Normal file
41
test/intl/segmenter/check-lb-option.js
Normal file
@ -0,0 +1,41 @@
|
||||
// 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.
|
||||
|
||||
// Flags: --harmony-intl-segmenter
|
||||
|
||||
let invalid_lb = [
|
||||
"invalid",
|
||||
"abce",
|
||||
"breakall",
|
||||
"keepall",
|
||||
"none",
|
||||
"standard",
|
||||
];
|
||||
|
||||
let valid_lb= [
|
||||
"strict",
|
||||
"normal",
|
||||
"loose",
|
||||
];
|
||||
|
||||
let locales = [
|
||||
"en",
|
||||
"ja",
|
||||
"zh",
|
||||
];
|
||||
|
||||
invalid_lb.forEach(function(lb) {
|
||||
let df = new Intl.Segmenter(["en-u-lb-" + lb + "-fo-obar"]);
|
||||
assertEquals("en", df.resolvedOptions().locale);
|
||||
}
|
||||
);
|
||||
|
||||
valid_lb.forEach(function(lb) {
|
||||
locales.forEach(function(base) {
|
||||
let l = base + "-u-lb-" + lb;
|
||||
let df = new Intl.Segmenter([l + "-fo-obar"]);
|
||||
assertEquals(l, df.resolvedOptions().locale);
|
||||
});
|
||||
}
|
||||
);
|
Loading…
Reference in New Issue
Block a user