mirror of https://github.com/tc39/test262.git
Merge pull request #2097 from anba/canonical-jan2019
Fix various test issues (Was: Unicode BCP 47 Locale Identifier changes)
This commit is contained in:
commit
1cb241cf36
|
@ -298,7 +298,7 @@ Consumers that violate the spec by throwing exceptions for parsing errors at run
|
|||
|
||||
## Writing Asynchronous Tests
|
||||
|
||||
An asynchronous test is any test that include the `async` frontmatter flag. When executing such tests, the runner expects that the global `$DONE()` function will be called to signal test completion.
|
||||
An asynchronous test is any test that include the `async` frontmatter flag. When executing such tests, the runner expects that the global `$DONE()` function will be called **exactly once** to signal test completion.
|
||||
|
||||
* If the argument to `$DONE` is omitted, is `undefined`, or is any other falsy value, the test is considered to have passed.
|
||||
|
||||
|
|
1223
harness/testIntl.js
1223
harness/testIntl.js
File diff suppressed because it is too large
Load Diff
|
@ -1,14 +0,0 @@
|
|||
// Copyright (C) 2019 Jaideep Bhoosreddy (Bloomberg LP). All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: prod-ClassElement
|
||||
name: class declaration module default export
|
||||
path: language/statements/class/elements/syntax/valid/export-default-
|
||||
flags: [module]
|
||||
features: [class]
|
||||
---*/
|
||||
|
||||
export default class /*{ heritage }*/{
|
||||
/*{ elements }*/
|
||||
}
|
|
@ -43,5 +43,4 @@ Promise.allSettled([thenable])
|
|||
assert.sameValue(settleds.length, 1);
|
||||
assert.sameValue(settleds[0].status, 'rejected');
|
||||
assert.sameValue(settleds[0].reason, simulation);
|
||||
$DONE();
|
||||
}).then($DONE, $DONE);
|
||||
|
|
|
@ -49,5 +49,4 @@ Promise.allSettled([fulfiller, rejector])
|
|||
assert.sameValue(settleds[0].value, 42);
|
||||
assert.sameValue(settleds[1].status, 'fulfilled');
|
||||
assert.sameValue(settleds[1].value, simulation);
|
||||
$DONE();
|
||||
}).then($DONE, $DONE);
|
||||
|
|
|
@ -40,5 +40,4 @@ Promise.allSettled([fulfiller, lateRejector])
|
|||
assert.sameValue(settleds[0].value, 42);
|
||||
assert.sameValue(settleds[1].status, 'fulfilled');
|
||||
assert.sameValue(settleds[1].value, simulation);
|
||||
$DONE();
|
||||
}).then($DONE, $DONE);
|
||||
|
|
|
@ -27,5 +27,4 @@ var thenable = {
|
|||
Promise.allSettled([thenable])
|
||||
.then((settleds) => {
|
||||
checkSettledPromises(settleds, [{ status: 'rejected', reason: simulation }]);
|
||||
$DONE();
|
||||
}).then($DONE, $DONE);
|
||||
}).then($DONE, $DONE);
|
||||
|
|
|
@ -30,25 +30,20 @@ var canonicalizedTags = {
|
|||
"de": "de",
|
||||
"DE-de": "de-DE",
|
||||
"de-DE": "de-DE",
|
||||
"cmn": "cmn",
|
||||
"CMN-hANS": "cmn-Hans",
|
||||
"cmn-hans-cn": "cmn-Hans-CN",
|
||||
"cmn": "zh",
|
||||
"CMN-hANS": "zh-Hans",
|
||||
"cmn-hans-cn": "zh-Hans-CN",
|
||||
"es-419": "es-419",
|
||||
"es-419-u-nu-latn": "es-419-u-nu-latn",
|
||||
"cmn-hans-cn-u-ca-t-ca-x-t-u": "cmn-Hans-CN-t-ca-u-ca-x-t-u",
|
||||
"cmn-hans-cn-u-ca-t-ca-x-t-u": "zh-Hans-CN-t-ca-u-ca-x-t-u",
|
||||
"de-gregory-u-ca-gregory": "de-gregory-u-ca-gregory",
|
||||
"no-nyn": "nn",
|
||||
"i-klingon": "tlh",
|
||||
"sgn-GR": "gss",
|
||||
"sgn-GR": "sgn-GR",
|
||||
"ji": "yi",
|
||||
"de-DD": "de-DE",
|
||||
"zh-hak-CN": "hak-CN",
|
||||
"sgn-ils": "ils",
|
||||
"in": "id",
|
||||
"x-foo": "x-foo",
|
||||
"sr-cyrl-ekavsk": "sr-Cyrl-ekavsk",
|
||||
"en-ca-newfound": "en-CA-newfound",
|
||||
"sl-rozaj-biske-1994": "sl-rozaj-biske-1994",
|
||||
"sl-rozaj-biske-1994": "sl-1994-biske-rozaj",
|
||||
"da-u-attr": "da-u-attr",
|
||||
"da-u-attr-co-search": "da-u-attr-co-search",
|
||||
};
|
||||
|
|
|
@ -16,7 +16,7 @@ const regularGrandfathered = [
|
|||
},
|
||||
{
|
||||
tag: "zh-guoyu",
|
||||
canonical: "cmn",
|
||||
canonical: "zh",
|
||||
},
|
||||
{
|
||||
tag: "zh-hakka",
|
||||
|
|
|
@ -20,67 +20,77 @@ info: |
|
|||
...
|
||||
|
||||
6.2.3 CanonicalizeLanguageTag ( locale )
|
||||
The CanonicalizeLanguageTag abstract operation returns the canonical and case-regularized
|
||||
form of the locale argument (which must be a String value that is a structurally valid
|
||||
BCP 47 language tag as verified by the IsStructurallyValidLanguageTag abstract operation).
|
||||
A conforming implementation shall take the steps specified in RFC 5646 section 4.5, or
|
||||
successor, to bring the language tag into canonical form, and to regularize the case of
|
||||
the subtags. Furthermore, a conforming implementation shall not take the steps to bring
|
||||
a language tag into "extlang form", nor shall it reorder variant subtags.
|
||||
|
||||
The specifications for extensions to BCP 47 language tags, such as RFC 6067, may include
|
||||
canonicalization rules for the extension subtag sequences they define that go beyond the
|
||||
canonicalization rules of RFC 5646 section 4.5. Implementations are allowed, but not
|
||||
required, to apply these additional rules.
|
||||
The CanonicalizeLanguageTag abstract operation returns the canonical and case-regularized form
|
||||
of the locale argument (which must be a String value that is a structurally valid Unicode
|
||||
BCP 47 Locale Identifier as verified by the IsStructurallyValidLanguageTag abstract operation).
|
||||
A conforming implementation shall take the steps specified in the “BCP 47 Language Tag to
|
||||
Unicode BCP 47 Locale Identifier” algorithm, from Unicode Technical Standard #35 LDML
|
||||
§ 3.3.1 BCP 47 Language Tag Conversion.
|
||||
|
||||
includes: [testIntl.js]
|
||||
---*/
|
||||
|
||||
// Generated from http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
|
||||
// File-Date: 2017-08-15
|
||||
var canonicalizedTags = {
|
||||
// Irregular tags.
|
||||
"en-gb-oed": "en-GB-oxendict",
|
||||
"i-ami": "ami",
|
||||
"i-bnn": "bnn",
|
||||
"i-default": "i-default",
|
||||
"i-enochian": "i-enochian",
|
||||
"i-hak": "hak",
|
||||
"i-klingon": "tlh",
|
||||
"i-lux": "lb",
|
||||
"i-mingo": "i-mingo",
|
||||
"i-navajo": "nv",
|
||||
"i-pwn": "pwn",
|
||||
"i-tao": "tao",
|
||||
"i-tay": "tay",
|
||||
"i-tsu": "tsu",
|
||||
"sgn-be-fr": "sfb",
|
||||
"sgn-be-nl": "vgt",
|
||||
"sgn-ch-de": "sgg",
|
||||
|
||||
// Regular tags.
|
||||
var irregularGrandfathered = [
|
||||
"en-gb-oed",
|
||||
"i-ami",
|
||||
"i-bnn",
|
||||
"i-default",
|
||||
"i-enochian",
|
||||
"i-hak",
|
||||
"i-klingon",
|
||||
"i-lux",
|
||||
"i-mingo",
|
||||
"i-navajo",
|
||||
"i-pwn",
|
||||
"i-tao",
|
||||
"i-tay",
|
||||
"i-tsu",
|
||||
"sgn-be-fr",
|
||||
"sgn-be-nl",
|
||||
"sgn-ch-de",
|
||||
];
|
||||
|
||||
var regularGrandfatheredNonUTS35 = [
|
||||
"no-bok",
|
||||
"no-nyn",
|
||||
"zh-min",
|
||||
"zh-min-nan",
|
||||
];
|
||||
|
||||
var regularGrandfatheredUTS35 = {
|
||||
"art-lojban": "jbo",
|
||||
"cel-gaulish": "cel-gaulish",
|
||||
"no-bok": "nb",
|
||||
"no-nyn": "nn",
|
||||
"zh-guoyu": "cmn",
|
||||
"cel-gaulish": "xtg-x-cel-gaulish",
|
||||
"zh-guoyu": "zh",
|
||||
"zh-hakka": "hak",
|
||||
"zh-min": "zh-min",
|
||||
"zh-min-nan": "nan",
|
||||
"zh-xiang": "hsn",
|
||||
};
|
||||
|
||||
// make sure the data above is correct
|
||||
Object.getOwnPropertyNames(canonicalizedTags).forEach(function (tag) {
|
||||
var canonicalizedTag = canonicalizedTags[tag];
|
||||
irregularGrandfathered.forEach(function (tag) {
|
||||
assert.sameValue(
|
||||
isCanonicalizedStructurallyValidLanguageTag(tag), false,
|
||||
"Test data \"" + tag + "\" is not a structurally valid language tag."
|
||||
);
|
||||
});
|
||||
regularGrandfatheredNonUTS35.forEach(function (tag) {
|
||||
assert.sameValue(
|
||||
isCanonicalizedStructurallyValidLanguageTag(tag), false,
|
||||
"Test data \"" + tag + "\" is not a structurally valid language tag."
|
||||
);
|
||||
});
|
||||
Object.getOwnPropertyNames(regularGrandfatheredUTS35).forEach(function (tag) {
|
||||
var canonicalizedTag = regularGrandfatheredUTS35[tag];
|
||||
assert(
|
||||
isCanonicalizedStructurallyValidLanguageTag(canonicalizedTag),
|
||||
"Test data \"" + canonicalizedTag + "\" is not canonicalized and structurally valid language tag."
|
||||
"Test data \"" + canonicalizedTag + "\" is a canonicalized and structurally valid language tag."
|
||||
);
|
||||
});
|
||||
|
||||
Object.getOwnPropertyNames(canonicalizedTags).forEach(function (tag) {
|
||||
Object.getOwnPropertyNames(regularGrandfatheredUTS35).forEach(function (tag) {
|
||||
var canonicalLocales = Intl.getCanonicalLocales(tag);
|
||||
assert.sameValue(canonicalLocales.length, 1);
|
||||
assert.sameValue(canonicalLocales[0], canonicalizedTags[tag]);
|
||||
assert.sameValue(canonicalLocales[0], regularGrandfatheredUTS35[tag]);
|
||||
});
|
||||
|
|
|
@ -39,7 +39,9 @@ includes: [testIntl.js]
|
|||
// Generated from http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
|
||||
// File-Date: 2017-08-15
|
||||
var canonicalizedTags = {
|
||||
"ja-latn-hepburn-heploc": "ja-Latn-alalc97",
|
||||
// ECMA-402 currently requires that variant subtags are not canonicalized.
|
||||
// https://github.com/tc39/ecma402/issues/330
|
||||
"ja-latn-hepburn-heploc": "ja-Latn-hepburn-heploc",
|
||||
};
|
||||
|
||||
// make sure the data above is correct
|
||||
|
|
|
@ -13,7 +13,6 @@ includes: [compareArray.js]
|
|||
|
||||
var weirdCases =
|
||||
[
|
||||
"x-u-foo",
|
||||
"en-x-u-foo",
|
||||
"en-a-bar-x-u-foo",
|
||||
"en-x-u-foo-a-bar",
|
||||
|
|
|
@ -17,17 +17,28 @@ const tests = [
|
|||
[undefined, defaultLocale, "undefined"],
|
||||
["EN", "en", "Single value"],
|
||||
[[], defaultLocale, "Empty array"],
|
||||
[["en-GB-oed"], "en-GB", "Grandfathered"],
|
||||
[["x-private"], defaultLocale, "Private", ["lookup"]],
|
||||
[["en", "EN"], "en", "Duplicate value (canonical first)"],
|
||||
[["EN", "en"], "en", "Duplicate value (canonical last)"],
|
||||
[{ 0: "DE", length: 0 }, defaultLocale, "Object with zero length"],
|
||||
[{ 0: "DE", length: 1 }, "de", "Object with length"],
|
||||
];
|
||||
|
||||
const errorTests = [
|
||||
[["en-GB-oed"], "Grandfathered"],
|
||||
[["x-private"], "Private", ["lookup"]],
|
||||
];
|
||||
|
||||
for (const [locales, expected, name, matchers = ["lookup", "best fit"]] of tests) {
|
||||
for (const matcher of matchers) {
|
||||
const rtf = new Intl.ListFormat(locales, {localeMatcher: matcher});
|
||||
assert.sameValue(rtf.resolvedOptions().locale, expected, name);
|
||||
}
|
||||
}
|
||||
|
||||
for (const [locales, name, matchers = ["lookup", "best fit"]] of errorTests) {
|
||||
for (const matcher of matchers) {
|
||||
assert.throws(RangeError, function() {
|
||||
new Intl.ListFormat(locales, {localeMatcher: matcher})
|
||||
}, name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,13 +79,18 @@ var testData = [
|
|||
maximized: "cs-Latn-CZ",
|
||||
},
|
||||
{
|
||||
// ECMA-402 currently requires that variant subtags are not canonicalized.
|
||||
// https://github.com/tc39/ecma402/issues/330
|
||||
tag: "hy-arevela",
|
||||
canonical: "hy",
|
||||
maximized: "hy-Armn-AM",
|
||||
canonical: "hy-arevela",
|
||||
maximized: "hy-Armn-AM-arevela",
|
||||
},
|
||||
{
|
||||
// ECMA-402 currently requires that variant subtags are not canonicalized.
|
||||
// https://github.com/tc39/ecma402/issues/330
|
||||
tag: "hy-arevmda",
|
||||
canonical: "hyw",
|
||||
canonical: "hy-arevmda",
|
||||
maximized: "hy-Armn-AM-arevmda",
|
||||
},
|
||||
];
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ features: [Intl.Locale]
|
|||
const validRegionOptions = [
|
||||
[undefined, undefined],
|
||||
['FR', 'en-FR'],
|
||||
['554', 'en-554'],
|
||||
[554, 'en-554'],
|
||||
['554', 'en-NZ'],
|
||||
[554, 'en-NZ'],
|
||||
];
|
||||
for (const [region, expected] of validRegionOptions) {
|
||||
let options = { region };
|
||||
|
|
|
@ -25,7 +25,7 @@ const validLanguageTags = {
|
|||
"DE-1996": "de-1996", // unicode_language_subtag sep unicode_variant_subtag
|
||||
|
||||
// unicode_language_subtag (sep unicode_variant_subtag)*
|
||||
"sl-ROZAJ-BISKE-1994": "sl-rozaj-biske-1994",
|
||||
"sl-ROZAJ-BISKE-1994": "sl-1994-biske-rozaj",
|
||||
"zh-latn-pinyin-pinyin2": "zh-Latn-pinyin-pinyin2",
|
||||
};
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ assert.sameValue(loc.calendar, "gregory");
|
|||
assert.sameValue(loc.collation, "phonebk");
|
||||
assert.sameValue(loc.hourCycle, "h23");
|
||||
if ("caseFirst" in loc) {
|
||||
assert.sameValue(loc.caseFirst, "true");
|
||||
assert.sameValue(loc.caseFirst, "");
|
||||
}
|
||||
if ("numeric" in loc) {
|
||||
assert.sameValue(loc.numeric, false);
|
||||
|
|
|
@ -68,7 +68,8 @@ const regularGrandfathered = [
|
|||
},
|
||||
{
|
||||
tag: "zh-guoyu",
|
||||
canonical: "cmn",
|
||||
canonical: "zh",
|
||||
maximized: "zh-Hans-CN",
|
||||
},
|
||||
{
|
||||
tag: "zh-hakka",
|
||||
|
@ -107,7 +108,7 @@ for (const tag of regularGrandfatheredWithExtLang) {
|
|||
assert.throws(RangeError, () => new Intl.Locale(tag));
|
||||
}
|
||||
|
||||
// Add constiants, extensions, and privateuse subtags to regular grandfathered
|
||||
// Add variants, extensions, and privateuse subtags to regular grandfathered
|
||||
// language tags and ensure it produces the "expected" result.
|
||||
const extras = [
|
||||
"fonipa",
|
||||
|
@ -126,14 +127,71 @@ for (const {tag} of regularGrandfathered) {
|
|||
for (const extra of extras) {
|
||||
const loc = new Intl.Locale(tag + "-" + extra);
|
||||
|
||||
assert.sameValue(loc.maximize().toString(), tagMax + "-" + extra);
|
||||
assert.sameValue(loc.maximize().maximize().toString(), tagMax + "-" + extra);
|
||||
let canonical = tag + "-" + extra;
|
||||
let canonicalMax = tagMax + "-" + extra;
|
||||
let canonicalMin = tagMin + "-" + extra;
|
||||
|
||||
assert.sameValue(loc.minimize().toString(), tagMin + "-" + extra);
|
||||
assert.sameValue(loc.minimize().minimize().toString(), tagMin + "-" + extra);
|
||||
// Ensure the added variant subtag is correctly sorted in the canonical tag.
|
||||
if (/^[a-z0-9]{5,8}|[0-9][a-z0-9]{3}$/i.test(extra)) {
|
||||
const sorted = s => s.replace(/(-([a-z0-9]{5,8}|[0-9][a-z0-9]{3}))+$/i,
|
||||
m => m.split("-").sort().join("-"));
|
||||
canonical = sorted(canonical);
|
||||
canonicalMax = sorted(canonicalMax);
|
||||
canonicalMin = sorted(canonicalMin);
|
||||
}
|
||||
|
||||
assert.sameValue(loc.maximize().minimize().toString(), tagMin + "-" + extra);
|
||||
assert.sameValue(loc.minimize().maximize().toString(), tagMax + "-" + extra);
|
||||
// Adding extra subtags to grandfathered tags can have "interesting" results. Take for
|
||||
// example "art-lojban" when "fonipa" is added, so we get "art-lojban-fonipa". The first
|
||||
// step when canonicalising the language tag is to bring it in 'canonical syntax', that
|
||||
// means among other things sorting variants in alphabetical order. So "art-lojban-fonipa"
|
||||
// is transformed to "art-fonipa-lojban", because "fonipa" is sorted before "lojban". And
|
||||
// only after that has happened, we replace aliases with their preferred form.
|
||||
//
|
||||
// Now the usual problems arise when doing silly things like adding subtags to
|
||||
// grandfathered subtags, nobody, neither RFC 5646 nor UTS 35, provides a clear description
|
||||
// what needs to happen next.
|
||||
//
|
||||
// From <http://unicode.org/reports/tr35/#Language_Tag_to_Locale_Identifier>:
|
||||
//
|
||||
// > If the BCP 47 primary language subtag matches the type attribute of a languageAlias
|
||||
// > element in Supplemental Data, replace the language subtag with the replacement value.
|
||||
// > 1. ...
|
||||
// > 2. Five special deprecated grandfathered codes (such as i-default) are in type
|
||||
// attributes, and are also replaced.
|
||||
// > 3. ...
|
||||
//
|
||||
// So let's assume grandfathered tags are treated as 'primary language subtag' if and only
|
||||
// if no additional subtags are present. Because in all other cases, we don't really have a
|
||||
// grandfathered tag, but only some arbitrary combination of random subtags.
|
||||
//
|
||||
// Basically what we expect here is that only grandfathered without any additional subtags
|
||||
// are canonicalised to their modern form and in all other cases they're left as is.
|
||||
//
|
||||
// Not all language tag processor will pass this test, for example because they don't order
|
||||
// variant subtags in alphabetical order or they're too eager when detecting grandfathered
|
||||
// tags. For example "zh-hakka-hakka" is accepted in some language tag processors, because
|
||||
// the language tag starts with a prefix which matches a grandfathered tag, and that prefix
|
||||
// is then canonicalised to "hak" and the second "hakka" is simply appended to it, so the
|
||||
// resulting tag is "hak-hakka". This is clearly wrong as far as ECMA-402 compliance is
|
||||
// concerned, because language tags are parsed and validated before any canonicalisation
|
||||
// happens. And during the validation step an error should be emitted, because the input
|
||||
// "zh-hakka-hakka" contains two identical variant subtags.
|
||||
//
|
||||
// From <https://tc39.es/ecma402/#sec-isstructurallyvalidlanguagetag>:
|
||||
//
|
||||
// > does not include duplicate variant subtags
|
||||
//
|
||||
// So, if your implementation fails this assertion, but you still like to test the rest of
|
||||
// this file, a pull request to split this file seems the way to go!
|
||||
assert.sameValue(loc.toString(), canonical);
|
||||
|
||||
assert.sameValue(loc.maximize().toString(), canonicalMax);
|
||||
assert.sameValue(loc.maximize().maximize().toString(), canonicalMax);
|
||||
|
||||
assert.sameValue(loc.minimize().toString(), canonicalMin);
|
||||
assert.sameValue(loc.minimize().minimize().toString(), canonicalMin);
|
||||
|
||||
assert.sameValue(loc.maximize().minimize().toString(), canonicalMin);
|
||||
assert.sameValue(loc.minimize().maximize().toString(), canonicalMax);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
esid: sec-intl.numberformat.prototype.resolvedoptions
|
||||
description: Verifies the property order for the object returned by resolvedOptions().
|
||||
includes: [compareArray.js]
|
||||
features: [Intl.NumberFormat-unified]
|
||||
---*/
|
||||
|
||||
const options = new Intl.NumberFormat([], {
|
||||
|
@ -21,10 +22,13 @@ const expected = [
|
|||
"style",
|
||||
"currency",
|
||||
"currencyDisplay",
|
||||
"currencySign",
|
||||
"minimumIntegerDigits",
|
||||
"minimumSignificantDigits",
|
||||
"maximumSignificantDigits",
|
||||
"useGrouping",
|
||||
"notation",
|
||||
"signDisplay",
|
||||
];
|
||||
|
||||
assert.compareArray(Object.getOwnPropertyNames(options), expected);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
esid: sec-intl.numberformat.prototype.resolvedoptions
|
||||
description: Verifies the property order for the object returned by resolvedOptions().
|
||||
includes: [compareArray.js]
|
||||
features: [Intl.NumberFormat-unified]
|
||||
---*/
|
||||
|
||||
const options = new Intl.PluralRules([], {
|
||||
|
@ -16,8 +17,6 @@ const expected = [
|
|||
"locale",
|
||||
"type",
|
||||
"minimumIntegerDigits",
|
||||
"minimumFractionDigits",
|
||||
"maximumFractionDigits",
|
||||
"minimumSignificantDigits",
|
||||
"maximumSignificantDigits",
|
||||
"pluralCategories",
|
||||
|
|
|
@ -17,17 +17,28 @@ const tests = [
|
|||
[undefined, defaultLocale, "undefined"],
|
||||
["EN", "en", "Single value"],
|
||||
[[], defaultLocale, "Empty array"],
|
||||
[["en-GB-oed"], "en-GB", "Grandfathered"],
|
||||
[["x-private"], defaultLocale, "Private", ["lookup"]],
|
||||
[["en", "EN"], "en", "Duplicate value (canonical first)"],
|
||||
[["EN", "en"], "en", "Duplicate value (canonical last)"],
|
||||
[{ 0: "DE", length: 0 }, defaultLocale, "Object with zero length"],
|
||||
[{ 0: "DE", length: 1 }, "de", "Object with length"],
|
||||
];
|
||||
|
||||
const errorTests = [
|
||||
[["en-GB-oed"], "Grandfathered"],
|
||||
[["x-private"], "Private", ["lookup"]],
|
||||
];
|
||||
|
||||
for (const [locales, expected, name, matchers = ["best fit", "lookup"]] of tests) {
|
||||
for (const matcher of matchers) {
|
||||
const rtf = new Intl.RelativeTimeFormat(locales, {localeMatcher: matcher});
|
||||
assert.sameValue(rtf.resolvedOptions().locale, expected, name);
|
||||
}
|
||||
}
|
||||
|
||||
for (const [locales, name, matchers = ["best fit", "lookup"]] of errorTests) {
|
||||
for (const matcher of matchers) {
|
||||
assert.throws(RangeError, function() {
|
||||
new Intl.RelativeTimeFormat(locales, {localeMatcher: matcher});
|
||||
}, name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,8 +21,6 @@ const tests = [
|
|||
[["sr"], ["sr"], "Single-element array"],
|
||||
[["fr", "ar"], ["fr", "ar"], "Two-element array"],
|
||||
[["xyz", "ar"], ["ar"], "Two-element array with unknown code"],
|
||||
[["en-GB-oed"], ["en-GB"], "Grandfathered"],
|
||||
[["x-private"], [defaultLocale], "Private", ["lookup"]],
|
||||
[["en", "EN"], ["en"], "Duplicate value (canonical first)"],
|
||||
[["EN", "en"], ["en"], "Duplicate value (canonical last)"],
|
||||
[{ 0: "DE", length: 0 }, [defaultLocale], "Object with zero length"],
|
||||
|
@ -31,6 +29,11 @@ const tests = [
|
|||
[{ 1: "ja", 2: "fr" }, [defaultLocale], "Object without length, indexed from 1"],
|
||||
];
|
||||
|
||||
const errorTests = [
|
||||
[["en-GB-oed"], "Grandfathered"],
|
||||
[["x-private"], "Private", ["lookup"]],
|
||||
];
|
||||
|
||||
for (const [locales, expected, name, matchers = ["best fit", "lookup"]] of tests) {
|
||||
for (const localeMatcher of matchers) {
|
||||
const segmenter = new Intl.Segmenter(locales, { localeMatcher });
|
||||
|
@ -38,3 +41,11 @@ for (const [locales, expected, name, matchers = ["best fit", "lookup"]] of tests
|
|||
assert(expected.includes(actual), `${name}: expected one of ${expected}, found ${actual}`);
|
||||
}
|
||||
}
|
||||
|
||||
for (const [locales, name, matchers = ["best fit", "lookup"]] of errorTests) {
|
||||
for (const localeMatcher of matchers) {
|
||||
assert.throws(RangeError, function() {
|
||||
new Intl.Segmenter(locales, { localeMatcher });
|
||||
}, name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,17 +12,22 @@ includes: [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);
|
||||
assert.notSameValue(info.supported.indexOf(fallback), -1, "Locale " + locale + " is supported, but fallback " + fallback + " isn't.");
|
||||
for (var locale of info.supported) {
|
||||
var match = /^([a-z]{2,3})(-[A-Z][a-z]{3})?(-(?:[A-Z]{2}|[0-9]{3}))?$/.exec(locale);
|
||||
assert.notSameValue(match, null, "Locale " + locale + " is supported, but can't be parsed.")
|
||||
|
||||
var [language, script, region] = match.slice(1);
|
||||
|
||||
if (script !== undefined) {
|
||||
var fallback = language + script;
|
||||
assert(info.supported.includes(fallback) || info.byFallback.includes(fallback),
|
||||
"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];
|
||||
assert.notSameValue(info.supported.indexOf(fallback), -1, "Locale " + locale + " is supported, but fallback " + fallback + " isn't.");
|
||||
|
||||
if (region !== undefined) {
|
||||
var fallback = language + region;
|
||||
assert(info.supported.includes(fallback) || info.byFallback.includes(fallback),
|
||||
"Locale " + locale + " is supported, but fallback " + fallback + " isn't.");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -13,23 +13,18 @@ var canonicalizedTags = {
|
|||
"de": ["de"],
|
||||
"de-DE": ["de-DE", "de"],
|
||||
"DE-de": ["de-DE", "de"],
|
||||
"cmn": ["cmn"],
|
||||
"CMN-hANS": ["cmn-Hans", "cmn"],
|
||||
"cmn-hans-cn": ["cmn-Hans-CN", "cmn-Hans", "cmn"],
|
||||
"cmn": ["zh"],
|
||||
"CMN-hANS": ["zh-Hans", "zh"],
|
||||
"cmn-hans-cn": ["zh-Hans-CN", "zh-Hans", "zh"],
|
||||
"es-419": ["es-419", "es"],
|
||||
"es-419-u-nu-latn": ["es-419-u-nu-latn", "es-419", "es", "es-u-nu-latn"],
|
||||
// -u-ca is incomplete, so it will not show up in resolvedOptions().locale
|
||||
"cmn-hans-cn-u-ca-t-ca-x-t-u": ["cmn-Hans-CN-t-ca-u-ca-x-t-u", "cmn-Hans-CN-t-ca-x-t-u", "cmn-Hans-CN-t-ca-x-t", "cmn-Hans-CN-t-ca", "cmn-Hans-CN", "cmn-Hans", "cmn"],
|
||||
"cmn-hans-cn-u-ca-t-ca-x-t-u": ["zh-Hans-CN-t-ca-u-ca-x-t-u", "zh-Hans-CN-t-ca-x-t-u", "zh-Hans-CN-t-ca-x-t", "zh-Hans-CN-t-ca", "zh-Hans-CN", "zh-Hans", "zh"],
|
||||
"de-gregory-u-ca-gregory": ["de-gregory-u-ca-gregory", "de-gregory", "de-u-ca-gregory", "de"],
|
||||
"no-nyn": ["nn"],
|
||||
"i-klingon": ["tlh"],
|
||||
"sgn-GR": ["gss"],
|
||||
"ji": ["yi"],
|
||||
"de-DD": ["de-DE", "de"],
|
||||
"zh-hak-CN": ["hak-CN", "hak"],
|
||||
"sgn-ils": ["ils"],
|
||||
"in": ["id"],
|
||||
"x-foo": ["x-foo"]
|
||||
};
|
||||
|
||||
// make sure the data above is correct
|
||||
|
|
|
@ -10,24 +10,7 @@ author: Norbert Lindenberg
|
|||
includes: [testIntl.js]
|
||||
---*/
|
||||
|
||||
var invalidLanguageTags = [
|
||||
"", // empty tag
|
||||
"i", // singleton alone
|
||||
"x", // private use without subtag
|
||||
"u", // extension singleton in first place
|
||||
"419", // region code in first place
|
||||
"u-nu-latn-cu-bob", // extension sequence without language
|
||||
"hans-cmn-cn", // "hans" could theoretically be a 4-letter language code,
|
||||
// but those can't be followed by extlang codes.
|
||||
"cmn-hans-cn-u-u", // duplicate singleton
|
||||
"cmn-hans-cn-t-u-ca-u", // duplicate singleton
|
||||
"de-gregory-gregory", // duplicate variant
|
||||
"*", // language range
|
||||
"de-*", // language range
|
||||
"中文", // non-ASCII letters
|
||||
"en-ß", // non-ASCII letters
|
||||
"ıd" // non-ASCII letters
|
||||
];
|
||||
var invalidLanguageTags = getInvalidLanguageTags();
|
||||
|
||||
testWithIntlConstructors(function (Constructor) {
|
||||
invalidLanguageTags.forEach(function (tag) {
|
||||
|
|
|
@ -18,15 +18,9 @@ var validLanguageTags = [
|
|||
"cmn-hans-cn", // + ISO 3166-1 country code
|
||||
"es-419", // + UN M.49 region code
|
||||
"es-419-u-nu-latn-cu-bob", // + Unicode locale extension sequence
|
||||
"i-klingon", // grandfathered tag
|
||||
"cmn-hans-cn-t-ca-u-ca-x-t-u", // singleton subtags can also be used as private use subtags
|
||||
"de-gregory-u-ca-gregory", // variant and extension subtags may be the same
|
||||
"aa-a-foo-x-a-foo-bar", // variant subtags can also be used as private use subtags
|
||||
"x-en-US-12345", // anything goes in private use tags
|
||||
"x-12345-12345-en-US",
|
||||
"x-en-US-12345-12345",
|
||||
"x-en-u-foo",
|
||||
"x-en-u-foo-u-bar"
|
||||
];
|
||||
|
||||
testWithIntlConstructors(function (Constructor) {
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-elements/grammar-class-body-ctor-no-heritage.case
|
||||
// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template
|
||||
/*---
|
||||
description: A constructor is valid without a super call in the constructor and heritage (class declaration module default export)
|
||||
esid: prod-ClassElement
|
||||
features: [class]
|
||||
flags: [generated, module]
|
||||
info: |
|
||||
ClassTail : ClassHeritageopt { ClassBody }
|
||||
|
||||
It is a Syntax Error if ClassHeritage is not present and the following algorithm evaluates to true:
|
||||
1. Let constructor be ConstructorMethod of ClassBody.
|
||||
2. If constructor is empty, return false.
|
||||
3. Return HasDirectSuper of constructor.
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
export default class {
|
||||
constructor() {}
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-elements/grammar-field-classelementname-initializer-alt.case
|
||||
// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template
|
||||
/*---
|
||||
description: FieldDefinition, ClassElementName, PropertyName = Initializer Syntax (class declaration module default export)
|
||||
esid: prod-ClassElement
|
||||
features: [class-fields-public, class]
|
||||
flags: [generated, module]
|
||||
info: |
|
||||
ClassElement :
|
||||
...
|
||||
FieldDefinition ;
|
||||
;
|
||||
|
||||
FieldDefinition :
|
||||
ClassElementName Initializer _opt
|
||||
|
||||
ClassElementName :
|
||||
PropertyName
|
||||
PrivateName
|
||||
|
||||
PropertyName :
|
||||
LiteralPropertyName
|
||||
ComputedPropertyName
|
||||
|
||||
LiteralPropertyName :
|
||||
IdentifierName
|
||||
|
||||
Initializer :
|
||||
= AssignmentExpression
|
||||
|
||||
IdentifierName ::
|
||||
IdentifierStart
|
||||
IdentifierName IdentifierPart
|
||||
|
||||
IdentifierStart ::
|
||||
UnicodeIDStart
|
||||
$
|
||||
_
|
||||
\ UnicodeEscapeSequence
|
||||
|
||||
IdentifierPart ::
|
||||
UnicodeIDContinue
|
||||
$
|
||||
\ UnicodeEscapeSequence
|
||||
<ZWNJ> <ZWJ>
|
||||
|
||||
UnicodeIDStart ::
|
||||
any Unicode code point with the Unicode property "ID_Start"
|
||||
|
||||
UnicodeIDContinue ::
|
||||
any Unicode code point with the Unicode property "ID_Continue"
|
||||
|
||||
|
||||
NOTE 3
|
||||
The sets of code points with Unicode properties "ID_Start" and
|
||||
"ID_Continue" include, respectively, the code points with Unicode
|
||||
properties "Other_ID_Start" and "Other_ID_Continue".
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
export default class {
|
||||
$ = 1;
|
||||
_ = 2;
|
||||
\u{6F} = 3;
|
||||
℘ = 4; // DO NOT CHANGE THE NAME OF THIS FIELD
|
||||
ZW__NJ = 5; // DO NOT CHANGE THE NAME OF THIS FIELD
|
||||
ZW__J = 6; // DO NOT CHANGE THE NAME OF THIS FIELD
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-elements/grammar-field-classelementname-initializer.case
|
||||
// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template
|
||||
/*---
|
||||
description: FieldDefinition, ClassElementName, PropertyName = Initializer Syntax (class declaration module default export)
|
||||
esid: prod-ClassElement
|
||||
features: [class-fields-public, class]
|
||||
flags: [generated, module]
|
||||
info: |
|
||||
ClassElement :
|
||||
...
|
||||
FieldDefinition ;
|
||||
;
|
||||
|
||||
FieldDefinition :
|
||||
ClassElementName Initializer _opt
|
||||
|
||||
ClassElementName :
|
||||
PropertyName
|
||||
PrivateName
|
||||
|
||||
PropertyName :
|
||||
LiteralPropertyName
|
||||
ComputedPropertyName
|
||||
|
||||
LiteralPropertyName :
|
||||
IdentifierName
|
||||
|
||||
Initializer :
|
||||
= AssignmentExpression
|
||||
|
||||
IdentifierName ::
|
||||
IdentifierStart
|
||||
IdentifierName IdentifierPart
|
||||
|
||||
IdentifierStart ::
|
||||
UnicodeIDStart
|
||||
$
|
||||
_
|
||||
\ UnicodeEscapeSequence
|
||||
|
||||
IdentifierPart ::
|
||||
UnicodeIDContinue
|
||||
$
|
||||
\ UnicodeEscapeSequence
|
||||
<ZWNJ> <ZWJ>
|
||||
|
||||
UnicodeIDStart ::
|
||||
any Unicode code point with the Unicode property "ID_Start"
|
||||
|
||||
UnicodeIDContinue ::
|
||||
any Unicode code point with the Unicode property "ID_Continue"
|
||||
|
||||
|
||||
NOTE 3
|
||||
The sets of code points with Unicode properties "ID_Start" and
|
||||
"ID_Continue" include, respectively, the code points with Unicode
|
||||
properties "Other_ID_Start" and "Other_ID_Continue".
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
export default class {
|
||||
$ = 1;
|
||||
_ = 2;
|
||||
\u{6F} = 3;
|
||||
\u2118 = 4;
|
||||
ZW_\u200C_NJ = 5;
|
||||
ZW_\u200D_J = 6;
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-elements/grammar-field-identifier-alt.case
|
||||
// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template
|
||||
/*---
|
||||
description: Valid FieldDefinition, ClassElementName, PropertyName Syntax (class declaration module default export)
|
||||
esid: prod-ClassElement
|
||||
features: [class-fields-public, class]
|
||||
flags: [generated, module]
|
||||
info: |
|
||||
ClassElement :
|
||||
MethodDefinition
|
||||
static MethodDefinition
|
||||
FieldDefinition ;
|
||||
;
|
||||
|
||||
FieldDefinition :
|
||||
ClassElementName Initializer _opt
|
||||
|
||||
ClassElementName :
|
||||
PropertyName
|
||||
PrivateName
|
||||
|
||||
PropertyName :
|
||||
LiteralPropertyName
|
||||
ComputedPropertyName
|
||||
|
||||
LiteralPropertyName :
|
||||
IdentifierName
|
||||
StringLiteral
|
||||
NumericLiteral
|
||||
|
||||
IdentifierName ::
|
||||
IdentifierStart
|
||||
IdentifierName IdentifierPart
|
||||
|
||||
IdentifierStart ::
|
||||
UnicodeIDStart
|
||||
$
|
||||
_
|
||||
\ UnicodeEscapeSequence
|
||||
|
||||
IdentifierPart ::
|
||||
UnicodeIDContinue
|
||||
$
|
||||
\ UnicodeEscapeSequence
|
||||
<ZWNJ> <ZWJ>
|
||||
|
||||
UnicodeIDStart ::
|
||||
any Unicode code point with the Unicode property "ID_Start"
|
||||
|
||||
UnicodeIDContinue ::
|
||||
any Unicode code point with the Unicode property "ID_Continue"
|
||||
|
||||
|
||||
NOTE 3
|
||||
The sets of code points with Unicode properties "ID_Start" and
|
||||
"ID_Continue" include, respectively, the code points with Unicode
|
||||
properties "Other_ID_Start" and "Other_ID_Continue".
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
export default class {
|
||||
$;
|
||||
_;
|
||||
\u{6F};
|
||||
℘; // DO NOT CHANGE THE NAME OF THIS FIELD
|
||||
ZW__NJ; // DO NOT CHANGE THE NAME OF THIS FIELD
|
||||
ZW__J; // DO NOT CHANGE THE NAME OF THIS FIELD
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-elements/grammar-field-identifier.case
|
||||
// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template
|
||||
/*---
|
||||
description: Valid FieldDefinition, ClassElementName, PropertyName Syntax (class declaration module default export)
|
||||
esid: prod-ClassElement
|
||||
features: [class-fields-public, class]
|
||||
flags: [generated, module]
|
||||
info: |
|
||||
ClassElement :
|
||||
MethodDefinition
|
||||
static MethodDefinition
|
||||
FieldDefinition ;
|
||||
;
|
||||
|
||||
FieldDefinition :
|
||||
ClassElementName Initializer _opt
|
||||
|
||||
ClassElementName :
|
||||
PropertyName
|
||||
PrivateName
|
||||
|
||||
PropertyName :
|
||||
LiteralPropertyName
|
||||
ComputedPropertyName
|
||||
|
||||
LiteralPropertyName :
|
||||
IdentifierName
|
||||
StringLiteral
|
||||
NumericLiteral
|
||||
|
||||
IdentifierName ::
|
||||
IdentifierStart
|
||||
IdentifierName IdentifierPart
|
||||
|
||||
IdentifierStart ::
|
||||
UnicodeIDStart
|
||||
$
|
||||
_
|
||||
\ UnicodeEscapeSequence
|
||||
|
||||
IdentifierPart ::
|
||||
UnicodeIDContinue
|
||||
$
|
||||
\ UnicodeEscapeSequence
|
||||
<ZWNJ> <ZWJ>
|
||||
|
||||
UnicodeIDStart ::
|
||||
any Unicode code point with the Unicode property "ID_Start"
|
||||
|
||||
UnicodeIDContinue ::
|
||||
any Unicode code point with the Unicode property "ID_Continue"
|
||||
|
||||
|
||||
NOTE 3
|
||||
The sets of code points with Unicode properties "ID_Start" and
|
||||
"ID_Continue" include, respectively, the code points with Unicode
|
||||
properties "Other_ID_Start" and "Other_ID_Continue".
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
export default class {
|
||||
$;
|
||||
_;
|
||||
\u{6F};
|
||||
\u2118;
|
||||
ZW_\u200C_NJ;
|
||||
ZW_\u200D_J;
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-elements/grammar-fields-multi-line.case
|
||||
// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template
|
||||
/*---
|
||||
description: Valid multi-line, multi-field (class declaration module default export)
|
||||
esid: prod-ClassElement
|
||||
features: [class-fields-public, class]
|
||||
flags: [generated, module]
|
||||
info: |
|
||||
ClassElement :
|
||||
MethodDefinition
|
||||
static MethodDefinition
|
||||
FieldDefinition ;
|
||||
;
|
||||
|
||||
FieldDefinition :
|
||||
ClassElementName Initializer _opt
|
||||
|
||||
ClassElementName :
|
||||
PropertyName
|
||||
PrivateName
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
export default class {
|
||||
x
|
||||
y
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-elements/grammar-privatemeth-duplicate-get-set.case
|
||||
// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template
|
||||
/*---
|
||||
description: It's valid if a class contains a private getter and a private setter with the same name (class declaration module default export)
|
||||
esid: prod-ClassElement
|
||||
features: [class-methods-private, class]
|
||||
flags: [generated, module]
|
||||
info: |
|
||||
Static Semantics: Early Errors
|
||||
|
||||
ClassBody : ClassElementList
|
||||
It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries.
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
export default class {
|
||||
get #m() {}
|
||||
set #m(_) {}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-elements/grammar-privatemeth-duplicate-meth-nestedclassmeth.case
|
||||
// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template
|
||||
/*---
|
||||
description: It's valid if a nested class shadows a private method (class declaration module default export)
|
||||
esid: prod-ClassElement
|
||||
features: [class-methods-private, class]
|
||||
flags: [generated, module]
|
||||
info: |
|
||||
Static Semantics: Early Errors
|
||||
|
||||
ClassBody : ClassElementList
|
||||
It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries.
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
export default class {
|
||||
constructor() {
|
||||
class B {
|
||||
#m() {}
|
||||
}
|
||||
}
|
||||
|
||||
#m() {}
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-elements/grammar-privatename-classelementname-initializer-alt.case
|
||||
// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template
|
||||
/*---
|
||||
description: Valid PrivateName = Initializer Syntax (class declaration module default export)
|
||||
esid: prod-ClassElement
|
||||
features: [class-fields-private, class]
|
||||
flags: [generated, module]
|
||||
info: |
|
||||
ClassElement :
|
||||
MethodDefinition
|
||||
static MethodDefinition
|
||||
FieldDefinition ;
|
||||
;
|
||||
|
||||
FieldDefinition :
|
||||
ClassElementName Initializer _opt
|
||||
|
||||
ClassElementName :
|
||||
PropertyName
|
||||
PrivateName
|
||||
|
||||
PrivateName ::
|
||||
# IdentifierName
|
||||
|
||||
Initializer :
|
||||
= AssignmentExpression
|
||||
|
||||
IdentifierName ::
|
||||
IdentifierStart
|
||||
IdentifierName IdentifierPart
|
||||
|
||||
IdentifierStart ::
|
||||
UnicodeIDStart
|
||||
$
|
||||
_
|
||||
\ UnicodeEscapeSequence
|
||||
|
||||
IdentifierPart::
|
||||
UnicodeIDContinue
|
||||
$
|
||||
\ UnicodeEscapeSequence
|
||||
<ZWNJ> <ZWJ>
|
||||
|
||||
UnicodeIDStart::
|
||||
any Unicode code point with the Unicode property "ID_Start"
|
||||
|
||||
UnicodeIDContinue::
|
||||
any Unicode code point with the Unicode property "ID_Continue"
|
||||
|
||||
|
||||
NOTE 3
|
||||
The sets of code points with Unicode properties "ID_Start" and
|
||||
"ID_Continue" include, respectively, the code points with Unicode
|
||||
properties "Other_ID_Start" and "Other_ID_Continue".
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
export default class {
|
||||
#$ = 1;
|
||||
#_ = 2;
|
||||
#\u{6F} = 3;
|
||||
#℘ = 4; // DO NOT CHANGE THE NAME OF THIS FIELD
|
||||
#ZW__NJ = 5; // DO NOT CHANGE THE NAME OF THIS FIELD
|
||||
#ZW__J = 6; // DO NOT CHANGE THE NAME OF THIS FIELD
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-elements/grammar-privatename-classelementname-initializer.case
|
||||
// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template
|
||||
/*---
|
||||
description: Valid PrivateName = Initializer Syntax (class declaration module default export)
|
||||
esid: prod-ClassElement
|
||||
features: [class-fields-private, class]
|
||||
flags: [generated, module]
|
||||
info: |
|
||||
ClassElement :
|
||||
MethodDefinition
|
||||
static MethodDefinition
|
||||
FieldDefinition ;
|
||||
;
|
||||
|
||||
FieldDefinition :
|
||||
ClassElementName Initializer _opt
|
||||
|
||||
ClassElementName :
|
||||
PropertyName
|
||||
PrivateName
|
||||
|
||||
PrivateName ::
|
||||
# IdentifierName
|
||||
|
||||
Initializer :
|
||||
= AssignmentExpression
|
||||
|
||||
IdentifierName ::
|
||||
IdentifierStart
|
||||
IdentifierName IdentifierPart
|
||||
|
||||
IdentifierStart ::
|
||||
UnicodeIDStart
|
||||
$
|
||||
_
|
||||
\ UnicodeEscapeSequence
|
||||
|
||||
IdentifierPart::
|
||||
UnicodeIDContinue
|
||||
$
|
||||
\ UnicodeEscapeSequence
|
||||
<ZWNJ> <ZWJ>
|
||||
|
||||
UnicodeIDStart::
|
||||
any Unicode code point with the Unicode property "ID_Start"
|
||||
|
||||
UnicodeIDContinue::
|
||||
any Unicode code point with the Unicode property "ID_Continue"
|
||||
|
||||
|
||||
NOTE 3
|
||||
The sets of code points with Unicode properties "ID_Start" and
|
||||
"ID_Continue" include, respectively, the code points with Unicode
|
||||
properties "Other_ID_Start" and "Other_ID_Continue".
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
export default class {
|
||||
#$ = 1;
|
||||
#_ = 2;
|
||||
#\u{6F} = 3;
|
||||
#\u2118 = 4;
|
||||
#ZW_\u200C_NJ = 5;
|
||||
#ZW_\u200D_J = 6;
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-elements/grammar-privatename-identifier.case
|
||||
// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template
|
||||
/*---
|
||||
description: Valid PrivateName Syntax (class declaration module default export)
|
||||
esid: prod-ClassElement
|
||||
features: [class-fields-private, class]
|
||||
flags: [generated, module]
|
||||
info: |
|
||||
ClassElement :
|
||||
MethodDefinition
|
||||
static MethodDefinition
|
||||
FieldDefinition ;
|
||||
;
|
||||
|
||||
FieldDefinition :
|
||||
ClassElementName Initializer _opt
|
||||
|
||||
ClassElementName :
|
||||
PropertyName
|
||||
PrivateName
|
||||
|
||||
PrivateName ::
|
||||
# IdentifierName
|
||||
|
||||
IdentifierName ::
|
||||
IdentifierStart
|
||||
IdentifierName IdentifierPart
|
||||
|
||||
IdentifierStart ::
|
||||
UnicodeIDStart
|
||||
$
|
||||
_
|
||||
\ UnicodeEscapeSequence
|
||||
|
||||
IdentifierPart::
|
||||
UnicodeIDContinue
|
||||
$
|
||||
\ UnicodeEscapeSequence
|
||||
<ZWNJ> <ZWJ>
|
||||
|
||||
UnicodeIDStart::
|
||||
any Unicode code point with the Unicode property "ID_Start"
|
||||
|
||||
UnicodeIDContinue::
|
||||
any Unicode code point with the Unicode property "ID_Continue"
|
||||
|
||||
|
||||
NOTE 3
|
||||
The sets of code points with Unicode properties "ID_Start" and
|
||||
"ID_Continue" include, respectively, the code points with Unicode
|
||||
properties "Other_ID_Start" and "Other_ID_Continue".
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
export default class {
|
||||
#$;
|
||||
#_;
|
||||
#\u{6F};
|
||||
#\u2118;
|
||||
#ZW_\u200C_NJ;
|
||||
#ZW_\u200D_J;
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-elements/grammar-privatename-no-initializer-with-method.case
|
||||
// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template
|
||||
/*---
|
||||
description: SyntaxError (class declaration module default export)
|
||||
esid: prod-ClassElement
|
||||
features: [class-fields-private, class]
|
||||
flags: [generated, module]
|
||||
info: |
|
||||
ClassElement :
|
||||
MethodDefinition
|
||||
static MethodDefinition
|
||||
FieldDefinition ;
|
||||
;
|
||||
|
||||
FieldDefinition :
|
||||
ClassElementName Initializer _opt
|
||||
|
||||
ClassElementName :
|
||||
PropertyName
|
||||
PrivateName
|
||||
|
||||
PrivateName ::
|
||||
# IdentifierName
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
export default class {
|
||||
#x
|
||||
m() {}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-elements/grammar-privatenames-multi-line.case
|
||||
// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template
|
||||
/*---
|
||||
description: SyntaxError (class declaration module default export)
|
||||
esid: prod-ClassElement
|
||||
features: [class-fields-private, class]
|
||||
flags: [generated, module]
|
||||
info: |
|
||||
ClassElement :
|
||||
MethodDefinition
|
||||
static MethodDefinition
|
||||
FieldDefinition ;
|
||||
;
|
||||
|
||||
FieldDefinition :
|
||||
ClassElementName Initializer _opt
|
||||
|
||||
ClassElementName :
|
||||
PropertyName
|
||||
PrivateName
|
||||
|
||||
PrivateName ::
|
||||
# IdentifierName
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
export default class {
|
||||
#x
|
||||
#y
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-elements/grammar-static-ctor-accessor-meth-valid.case
|
||||
// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template
|
||||
/*---
|
||||
description: Static Accessor Methods can be named constructor (class declaration module default export)
|
||||
esid: prod-ClassElement
|
||||
features: [class]
|
||||
flags: [generated, module]
|
||||
info: |
|
||||
Class Definitions / Static Semantics: Early Errors
|
||||
|
||||
ClassElement : MethodDefinition
|
||||
It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true.
|
||||
It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true.
|
||||
ClassElement : static MethodDefinition
|
||||
It is a Syntax Error if HasDirectSuper of MethodDefinition is true.
|
||||
It is a Syntax Error if PropName of MethodDefinition is "prototype".
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
export default class {
|
||||
static get constructor() {}
|
||||
static set constructor(_) {}
|
||||
constructor() {} // stacks with a valid constructor
|
||||
}
|
||||
|
||||
assert(C.hasOwnProperty('constructor'));
|
||||
assert(C.prototype.hasOwnProperty('constructor'));
|
||||
assert.notSameValue(C.prototype.constructor, C.constructor);
|
|
@ -1,29 +0,0 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-elements/grammar-static-ctor-async-gen-meth-valid.case
|
||||
// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template
|
||||
/*---
|
||||
description: Static Async Generator Methods can be named constructor (class declaration module default export)
|
||||
esid: prod-ClassElement
|
||||
features: [async-iteration, class]
|
||||
flags: [generated, module]
|
||||
info: |
|
||||
Class Definitions / Static Semantics: Early Errors
|
||||
|
||||
ClassElement : MethodDefinition
|
||||
It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true.
|
||||
It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true.
|
||||
ClassElement : static MethodDefinition
|
||||
It is a Syntax Error if HasDirectSuper of MethodDefinition is true.
|
||||
It is a Syntax Error if PropName of MethodDefinition is "prototype".
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
export default class {
|
||||
static async * constructor() {}
|
||||
constructor() {} // stacks with a valid constructor
|
||||
}
|
||||
|
||||
assert(C.hasOwnProperty('constructor'));
|
||||
assert(C.prototype.hasOwnProperty('constructor'));
|
||||
assert.notSameValue(C.prototype.constructor, C.constructor);
|
|
@ -1,29 +0,0 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-elements/grammar-static-ctor-async-meth-valid.case
|
||||
// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template
|
||||
/*---
|
||||
description: Static Methods can be named constructor (class declaration module default export)
|
||||
esid: prod-ClassElement
|
||||
features: [async-functions, class]
|
||||
flags: [generated, module]
|
||||
info: |
|
||||
Class Definitions / Static Semantics: Early Errors
|
||||
|
||||
ClassElement : MethodDefinition
|
||||
It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true.
|
||||
It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true.
|
||||
ClassElement : static MethodDefinition
|
||||
It is a Syntax Error if HasDirectSuper of MethodDefinition is true.
|
||||
It is a Syntax Error if PropName of MethodDefinition is "prototype".
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
export default class {
|
||||
static async constructor() {}
|
||||
constructor() {} // stacks with a valid constructor
|
||||
}
|
||||
|
||||
assert(C.hasOwnProperty('constructor'));
|
||||
assert(C.prototype.hasOwnProperty('constructor'));
|
||||
assert.notSameValue(C.prototype.constructor, C.constructor);
|
|
@ -1,29 +0,0 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-elements/grammar-static-ctor-gen-meth-valid.case
|
||||
// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template
|
||||
/*---
|
||||
description: Static Generator Methods can be named constructor (class declaration module default export)
|
||||
esid: prod-ClassElement
|
||||
features: [generators, class]
|
||||
flags: [generated, module]
|
||||
info: |
|
||||
Class Definitions / Static Semantics: Early Errors
|
||||
|
||||
ClassElement : MethodDefinition
|
||||
It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true.
|
||||
It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true.
|
||||
ClassElement : static MethodDefinition
|
||||
It is a Syntax Error if HasDirectSuper of MethodDefinition is true.
|
||||
It is a Syntax Error if PropName of MethodDefinition is "prototype".
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
export default class {
|
||||
static * constructor() {}
|
||||
constructor() {} // stacks with a valid constructor
|
||||
}
|
||||
|
||||
assert(C.hasOwnProperty('constructor'));
|
||||
assert(C.prototype.hasOwnProperty('constructor'));
|
||||
assert.notSameValue(C.prototype.constructor, C.constructor);
|
|
@ -1,29 +0,0 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-elements/grammar-static-ctor-meth-valid.case
|
||||
// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template
|
||||
/*---
|
||||
description: Static Methods can be named constructor (class declaration module default export)
|
||||
esid: prod-ClassElement
|
||||
features: [class]
|
||||
flags: [generated, module]
|
||||
info: |
|
||||
Class Definitions / Static Semantics: Early Errors
|
||||
|
||||
ClassElement : MethodDefinition
|
||||
It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true.
|
||||
It is a Syntax Error if PropName of MethodDefinition is "constructor" and SpecialMethod of MethodDefinition is true.
|
||||
ClassElement : static MethodDefinition
|
||||
It is a Syntax Error if HasDirectSuper of MethodDefinition is true.
|
||||
It is a Syntax Error if PropName of MethodDefinition is "prototype".
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
export default class {
|
||||
static constructor() {}
|
||||
constructor() {} // stacks with a valid constructor
|
||||
}
|
||||
|
||||
assert(C.hasOwnProperty('constructor'));
|
||||
assert(C.prototype.hasOwnProperty('constructor'));
|
||||
assert.notSameValue(C.prototype.constructor, C.constructor);
|
|
@ -1,20 +0,0 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-elements/grammar-static-private-async-gen-meth-prototype.case
|
||||
// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template
|
||||
/*---
|
||||
description: Static Async Generator Private Methods can be named "#prototype" (class declaration module default export)
|
||||
esid: prod-ClassElement
|
||||
features: [async-iteration, class-static-methods-private, class]
|
||||
flags: [generated, module]
|
||||
info: |
|
||||
Class Definitions / Static Semantics: Early Errors
|
||||
|
||||
ClassElement : static MethodDefinition
|
||||
It is a Syntax Error if PropName of MethodDefinition is "prototype"
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
export default class {
|
||||
static async * #prototype() {}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-elements/grammar-static-private-async-meth-prototype.case
|
||||
// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template
|
||||
/*---
|
||||
description: Static Async Private Methods can be named "#prototype" (class declaration module default export)
|
||||
esid: prod-ClassElement
|
||||
features: [async-functions, class-static-methods-private, class]
|
||||
flags: [generated, module]
|
||||
info: |
|
||||
Class Definitions / Static Semantics: Early Errors
|
||||
|
||||
ClassElement : static MethodDefinition
|
||||
It is a Syntax Error if PropName of MethodDefinition is "prototype"
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
export default class {
|
||||
static async #prototype() {}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-elements/grammar-static-private-gen-meth-prototype.case
|
||||
// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template
|
||||
/*---
|
||||
description: Static Generator Private Methods can be named "#prototype" (class declaration module default export)
|
||||
esid: prod-ClassElement
|
||||
features: [generators, class-static-methods-private, class]
|
||||
flags: [generated, module]
|
||||
info: |
|
||||
Class Definitions / Static Semantics: Early Errors
|
||||
|
||||
ClassElement : static MethodDefinition
|
||||
It is a Syntax Error if PropName of MethodDefinition is "prototype"
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
export default class {
|
||||
static * #prototype() {}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/class-elements/grammar-static-private-meth-prototype.case
|
||||
// - src/class-elements/syntax/valid/cls-decl-elements-valid-syntax-export-default.template
|
||||
/*---
|
||||
description: Static Private Methods can be named "#prototype" (class declaration module default export)
|
||||
esid: prod-ClassElement
|
||||
features: [class-static-methods-private, class]
|
||||
flags: [generated, module]
|
||||
info: |
|
||||
Class Definitions / Static Semantics: Early Errors
|
||||
|
||||
ClassElement : static MethodDefinition
|
||||
It is a Syntax Error if PropName of MethodDefinition is "prototype"
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
export default class {
|
||||
static #prototype() {}
|
||||
}
|
Loading…
Reference in New Issue