mirror of https://github.com/tc39/test262.git
Intl.Locale: follow up tasks, set 1. Ref gh-1538 (#1540)
This commit is contained in:
parent
eecf4d46ad
commit
83d815328f
|
@ -2,14 +2,20 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: pending
|
||||
esid: sec-intl.locale
|
||||
description: >
|
||||
Verifies the NewTarget check for Intl.Locale.
|
||||
info: |
|
||||
Intl.Locale( tag [, options] )
|
||||
|
||||
1. If NewTarget is undefined, throw a TypeError exception.
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, () => Intl.Locale());
|
||||
assert.throws(TypeError, () => Intl.Locale("en"));
|
||||
assert.throws(TypeError, function() {
|
||||
Intl.Locale();
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Intl.Locale("en");
|
||||
});
|
|
@ -0,0 +1,36 @@
|
|||
// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-intl.locale
|
||||
description: >
|
||||
Checks error cases for the options argument to the Locale
|
||||
constructor.
|
||||
info: |
|
||||
Intl.Locale( tag [, options] )
|
||||
|
||||
...
|
||||
15. If calendar is not undefined, then
|
||||
a. If calendar does not match the [(3*8alphanum) *("-" (3*8alphanum))] sequence, throw a RangeError exception.
|
||||
16. Set opt.[[ca]] to calendar.
|
||||
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
|
||||
/*
|
||||
alphanum = (ALPHA / DIGIT) ; letters and numbers
|
||||
calendar = (3*8alphanum) *("-" (3*8alphanum))
|
||||
*/
|
||||
const invalidCalendarOptions = [
|
||||
"",
|
||||
"a",
|
||||
"ab",
|
||||
"abcdefghi",
|
||||
"abc-abcdefghi",
|
||||
];
|
||||
for (const invalidCalendarOption of invalidCalendarOptions) {
|
||||
assert.throws(RangeError, function() {
|
||||
new Intl.Locale("en", {calendar: invalidCalendarOption});
|
||||
}, `${invalidCalendarOption} is an invalid calendar option value`);
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-intl.locale
|
||||
description: >
|
||||
Checks error cases for the options argument to the Locale
|
||||
constructor.
|
||||
info: |
|
||||
Intl.Locale( tag [, options] )
|
||||
|
||||
...
|
||||
14. Let calendar be ? GetOption(options, "calendar", "string", undefined, undefined).
|
||||
...
|
||||
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
const validCalendarOptions = [
|
||||
["abc", "en-u-ca-abc"],
|
||||
["abcd", "en-u-ca-abcd"],
|
||||
["abcde", "en-u-ca-abcde"],
|
||||
["abcdef", "en-u-ca-abcdef"],
|
||||
["abcdefg", "en-u-ca-abcdefg"],
|
||||
["abcdefgh", "en-u-ca-abcdefgh"],
|
||||
["12345678", "en-u-ca-12345678"],
|
||||
["1234abcd", "en-u-ca-1234abcd"],
|
||||
["1234abcd-abc123", "en-u-ca-1234abcd-abc123"],
|
||||
];
|
||||
for (const [calendar, expected] of validCalendarOptions) {
|
||||
let options = { calendar };
|
||||
assert.sameValue(
|
||||
new Intl.Locale('en', options).toString(),
|
||||
expected,
|
||||
`new Intl.Locale('en', options).toString() equals the value of ${expected}`
|
||||
);
|
||||
assert.sameValue(
|
||||
new Intl.Locale('en-u-ca-gregory', options).toString(),
|
||||
expected,
|
||||
`new Intl.Locale('en-u-ca-gregory', options).toString() equals the value of ${expected}`
|
||||
);
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-intl.locale
|
||||
description: >
|
||||
Checks error cases for the options argument to the Locale
|
||||
constructor.
|
||||
info: |
|
||||
Intl.Locale( tag [, options] )
|
||||
10. If options is undefined, then
|
||||
11. Else
|
||||
a. Let options be ? ToObject(options).
|
||||
12. Set tag to ? ApplyOptionsToTag(tag, options).
|
||||
|
||||
ApplyOptionsToTag( tag, options )
|
||||
...
|
||||
4. If language is not undefined, then
|
||||
a. If language does not match the language production, throw a RangeError exception.
|
||||
...
|
||||
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
/*
|
||||
language = 2*3ALPHA ; shortest ISO 639 code
|
||||
["-" extlang] ; sometimes followed by
|
||||
; extended language subtags
|
||||
/ 4ALPHA ; or reserved for future use
|
||||
/ 5*8ALPHA ; or registered language subtag
|
||||
|
||||
extlang = 3ALPHA ; selected ISO 639 codes
|
||||
*2("-" 3ALPHA) ; permanently reserved
|
||||
*/
|
||||
const invalidLanguageOptions = [
|
||||
"",
|
||||
"a",
|
||||
"ab7",
|
||||
"notalanguage",
|
||||
"undefined",
|
||||
|
||||
// Value contains more than just the 'language' production.
|
||||
"fr-Latn",
|
||||
"fr-FR",
|
||||
"sa-vaidika",
|
||||
"fr-a-asdf",
|
||||
"fr-x-private",
|
||||
|
||||
// Irregular grandfathered language tag.
|
||||
"i-klingon",
|
||||
|
||||
// Regular grandfathered language tag.
|
||||
"zh-Hant",
|
||||
|
||||
// Reserved with extended language subtag
|
||||
"abcd-US",
|
||||
"abcde-US",
|
||||
"abcdef-US",
|
||||
"abcdefg-US",
|
||||
"abcdefgh-US",
|
||||
|
||||
7,
|
||||
];
|
||||
for (const invalidLanguageOption of invalidLanguageOptions) {
|
||||
assert.throws(RangeError, function() {
|
||||
new Intl.Locale("en", {language: invalidLanguageOption});
|
||||
}, `${invalidLanguageOption} is an invalid language option value`);
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-intl.locale
|
||||
description: >
|
||||
Checks error cases for the options argument to the Locale
|
||||
constructor.
|
||||
info: |
|
||||
Intl.Locale( tag [, options] )
|
||||
10. If options is undefined, then
|
||||
11. Else
|
||||
a. Let options be ? ToObject(options).
|
||||
12. Set tag to ? ApplyOptionsToTag(tag, options).
|
||||
|
||||
ApplyOptionsToTag( tag, options )
|
||||
...
|
||||
9. If tag matches the langtag production, then
|
||||
a. If language is not undefined, then
|
||||
i. Set tag to tag with the substring corresponding to the language production replaced by the string language.
|
||||
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
const validLanguageOptions = [
|
||||
[undefined, "en"],
|
||||
[null, "null"],
|
||||
["zh-cmn", "cmn"],
|
||||
["ZH-CMN", "cmn"],
|
||||
["abcd", "abcd"],
|
||||
["abcde", "abcde"],
|
||||
["abcdef", "abcdef"],
|
||||
["abcdefg", "abcdefg"],
|
||||
["abcdefgh", "abcdefgh"],
|
||||
[{ toString() { return "de" } }, "de"],
|
||||
];
|
||||
for (const [language, expected] of validLanguageOptions) {
|
||||
let options = { language };
|
||||
assert.sameValue(
|
||||
new Intl.Locale('en', options).toString(),
|
||||
expected,
|
||||
`new Intl.Locale('en', options).toString() equals the value of ${expected}`
|
||||
);
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-intl.locale
|
||||
description: >
|
||||
Checks error cases for the options argument to the Locale
|
||||
constructor.
|
||||
info: |
|
||||
Intl.Locale( tag [, options] )
|
||||
10. If options is undefined, then
|
||||
11. Else
|
||||
a. Let options be ? ToObject(options).
|
||||
12. Set tag to ? ApplyOptionsToTag(tag, options).
|
||||
|
||||
ApplyOptionsToTag( tag, options )
|
||||
...
|
||||
8. If region is not undefined, then
|
||||
a. If region does not match the region production, throw a RangeError exception.
|
||||
...
|
||||
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
/*
|
||||
region = 2ALPHA ; ISO 3166-1 code
|
||||
/ 3DIGIT ; UN M.49 code
|
||||
*/
|
||||
const invalidRegionOptions = [
|
||||
"",
|
||||
"a",
|
||||
"abc",
|
||||
"a7",
|
||||
|
||||
// Value cannot be parsed as a 'region' production.
|
||||
"notaregion",
|
||||
|
||||
// Value contains more than just the 'region' production.
|
||||
"SA-vaidika",
|
||||
"SA-a-asdf",
|
||||
"SA-x-private",
|
||||
|
||||
// Value contains more than just the 'script' production.
|
||||
"ary-Arab",
|
||||
"Latn-SA",
|
||||
"Latn-vaidika",
|
||||
"Latn-a-asdf",
|
||||
"Latn-x-private",
|
||||
|
||||
7,
|
||||
];
|
||||
for (const invalidRegionOption of invalidRegionOptions) {
|
||||
assert.throws(RangeError, function() {
|
||||
new Intl.Locale("en", {region: invalidRegionOption});
|
||||
}, `${invalidRegionOption} is an invalid region option value`);
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-intl.locale
|
||||
description: >
|
||||
Checks error cases for the options argument to the Locale
|
||||
constructor.
|
||||
info: |
|
||||
Intl.Locale( tag [, options] )
|
||||
10. If options is undefined, then
|
||||
11. Else
|
||||
a. Let options be ? ToObject(options).
|
||||
12. Set tag to ? ApplyOptionsToTag(tag, options).
|
||||
|
||||
ApplyOptionsToTag( tag, options )
|
||||
...
|
||||
7. Let region be ? GetOption(options, "region", "string", undefined, undefined).
|
||||
...
|
||||
9. If tag matches the langtag production, then
|
||||
...
|
||||
c. If region is not undefined, then
|
||||
i. If tag does not contain a region production, then
|
||||
1. Set tag to the concatenation of the language production of tag, the substring corresponding to the "-" script production if present, "-", region, and the rest of tag.
|
||||
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
const validRegionOptions = [
|
||||
["FR", "en-FR"],
|
||||
["554", "en-554"],
|
||||
[554, "en-554"],
|
||||
];
|
||||
for (const [region, expected] of validRegionOptions) {
|
||||
let options = { region };
|
||||
assert.sameValue(
|
||||
new Intl.Locale('en', options).toString(),
|
||||
expected,
|
||||
`new Intl.Locale('en', options).toString() equals the value of ${expected}`
|
||||
);
|
||||
assert.sameValue(
|
||||
new Intl.Locale('en-US', options).toString(),
|
||||
expected,
|
||||
`new Intl.Locale('en-US', options).toString() equals the value of ${expected}`
|
||||
);
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-intl.locale
|
||||
description: >
|
||||
Checks error cases for the options argument to the Locale
|
||||
constructor.
|
||||
info: |
|
||||
Intl.Locale( tag [, options] )
|
||||
10. If options is undefined, then
|
||||
11. Else
|
||||
a. Let options be ? ToObject(options).
|
||||
12. Set tag to ? ApplyOptionsToTag(tag, options).
|
||||
|
||||
ApplyOptionsToTag( tag, options )
|
||||
...
|
||||
6. If script is not undefined, then
|
||||
a. If script does not match the script production, throw a RangeError exception.
|
||||
...
|
||||
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
/*
|
||||
script = 4ALPHA ; ISO 15924 code
|
||||
*/
|
||||
const invalidScriptOptions = [
|
||||
"",
|
||||
"a",
|
||||
"ab",
|
||||
"abc",
|
||||
"abc7",
|
||||
"notascript",
|
||||
"undefined",
|
||||
"Bal\u0130",
|
||||
"Bal\u0131",
|
||||
|
||||
// Value contains more than just the 'script' production.
|
||||
"ary-Arab",
|
||||
"Latn-SA",
|
||||
"Latn-vaidika",
|
||||
"Latn-a-asdf",
|
||||
"Latn-x-private",
|
||||
|
||||
7,
|
||||
];
|
||||
for (const invalidScriptOption of invalidScriptOptions) {
|
||||
assert.throws(RangeError, function() {
|
||||
new Intl.Locale("en", {script: invalidScriptOption});
|
||||
}, `${invalidScriptOption} is an invalid script option value`);
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-intl.locale
|
||||
description: >
|
||||
Checks error cases for the options argument to the Locale
|
||||
constructor.
|
||||
info: |
|
||||
Intl.Locale( tag [, options] )
|
||||
10. If options is undefined, then
|
||||
11. Else
|
||||
a. Let options be ? ToObject(options).
|
||||
12. Set tag to ? ApplyOptionsToTag(tag, options).
|
||||
|
||||
ApplyOptionsToTag( tag, options )
|
||||
...
|
||||
5. Let script be ? GetOption(options, "script", "string", undefined, undefined).
|
||||
...
|
||||
9. If tag matches the langtag production, then
|
||||
...
|
||||
b. If script is not undefined, then
|
||||
i. If tag does not contain a script production, then
|
||||
1. Set tag to the concatenation of the language production of tag, "-", script, and the rest of tag.
|
||||
ii. Else,
|
||||
1. Set tag to tag with the substring corresponding to the script production replaced by the string script.
|
||||
|
||||
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
const validScriptOptions = [
|
||||
[null, "en-Null"],
|
||||
["bali", "en-Bali"],
|
||||
["Bali", "en-Bali"],
|
||||
["bALI", "en-BALI"], // TODO REVIEW: is this the correct case regularization?
|
||||
[{ toString() { return "Brai" } }, "en-Brai"],
|
||||
];
|
||||
for (const [script, expected] of validScriptOptions) {
|
||||
let options = { script };
|
||||
assert.sameValue(
|
||||
new Intl.Locale("en", options).toString(),
|
||||
expected,
|
||||
`new Intl.Locale("en", options).toString() equals the value of ${expected}`
|
||||
);
|
||||
assert.sameValue(
|
||||
new Intl.Locale("en-Cyrl", options).toString(),
|
||||
expected,
|
||||
`new Intl.Locale("en-Cyrl", options).toString() equals the value of ${expected}`
|
||||
);
|
||||
}
|
|
@ -1,258 +0,0 @@
|
|||
// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: pending
|
||||
description: >
|
||||
Checks error cases for the options argument to the Locale
|
||||
constructor.
|
||||
info: |
|
||||
Intl.Locale( tag [, options] )
|
||||
10. If options is undefined, then
|
||||
11. Else
|
||||
a. Let options be ? ToObject(options).
|
||||
12. Set tag to ? ApplyOptionsToTag(tag, options).
|
||||
14. Let calendar be ? GetOption(options, "calendar", "string", undefined, undefined).
|
||||
15. If calendar is not undefined, then
|
||||
a. If calendar does not match the [(3*8alphanum) *("-" (3*8alphanum))] sequence, throw a RangeError exception.
|
||||
16. Set opt.[[ca]] to calendar.
|
||||
|
||||
ApplyOptionsToTag( tag, options )
|
||||
2. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception.
|
||||
3. Let language be ? GetOption(options, "language", "string", undefined, undefined).
|
||||
4. If language is not undefined, then
|
||||
a. If language does not match the language production, throw a RangeError exception.
|
||||
5. Let script be ? GetOption(options, "script", "string", undefined, undefined).
|
||||
6. If script is not undefined, then
|
||||
a. If script does not match the script production, throw a RangeError exception.
|
||||
7. Let region be ? GetOption(options, "region", "string", undefined, undefined).
|
||||
8. If region is not undefined, then
|
||||
a. If region does not match the region production, throw a RangeError exception.
|
||||
9. If tag matches the langtag production, then
|
||||
a. If language is not undefined, then
|
||||
i. Set tag to tag with the substring corresponding to the language production replaced by the string language.
|
||||
b. If script is not undefined, then
|
||||
i. If tag does not contain a script production, then
|
||||
1. Set tag to the concatenation of the language production of tag, "-", script, and the rest of tag.
|
||||
ii. Else,
|
||||
1. Set tag to tag with the substring corresponding to the script production replaced by the string script.
|
||||
c. If region is not undefined, then
|
||||
i. If tag does not contain a region production, then
|
||||
1. Set tag to the concatenation of the language production of tag, the substring corresponding to the "-" script production if present, "-", region, and the rest of tag.
|
||||
ii. Else,
|
||||
1. Set tag to tag with the substring corresponding to the region production replaced by the string region.
|
||||
10. Return CanonicalizeLanguageTag(tag).
|
||||
includes: [testIntl.js, compareArray.js]
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
// Intl.Locale step 11.a.
|
||||
assert.throws(TypeError, function() { new Intl.Locale("en", null) })
|
||||
|
||||
|
||||
// ApplyOptionsToTag step 2.
|
||||
for (const invalidTag of getInvalidLanguageTags()) {
|
||||
assert.throws(RangeError, function() {
|
||||
new Intl.Locale(invalidTag)
|
||||
}, "Language tag: " + invalidTag);
|
||||
}
|
||||
|
||||
|
||||
// ApplyOptionsToTag step 3, 9.a.i.
|
||||
const validLanguageOptions = [
|
||||
[undefined, "en"],
|
||||
[null, "null"],
|
||||
["zh-cmn", "cmn"],
|
||||
["ZH-CMN", "cmn"],
|
||||
["abcd", "abcd"],
|
||||
["abcde", "abcde"],
|
||||
["abcdef", "abcdef"],
|
||||
["abcdefg", "abcdefg"],
|
||||
["abcdefgh", "abcdefgh"],
|
||||
[{ toString() { return "de" } }, "de"],
|
||||
];
|
||||
for (const [option, expected] of validLanguageOptions) {
|
||||
assert.sameValue(new Intl.Locale("en", {
|
||||
language: option,
|
||||
}).toString(), expected);
|
||||
}
|
||||
|
||||
|
||||
// ApplyOptionsToTag step 4.a.
|
||||
/*
|
||||
language = 2*3ALPHA ; shortest ISO 639 code
|
||||
["-" extlang] ; sometimes followed by
|
||||
; extended language subtags
|
||||
/ 4ALPHA ; or reserved for future use
|
||||
/ 5*8ALPHA ; or registered language subtag
|
||||
|
||||
extlang = 3ALPHA ; selected ISO 639 codes
|
||||
*2("-" 3ALPHA) ; permanently reserved
|
||||
*/
|
||||
const invalidLanguageOptions = [
|
||||
"",
|
||||
"a",
|
||||
"ab7",
|
||||
"notalanguage",
|
||||
"undefined",
|
||||
|
||||
// Value contains more than just the 'language' production.
|
||||
"fr-Latn",
|
||||
"fr-FR",
|
||||
"sa-vaidika",
|
||||
"fr-a-asdf",
|
||||
"fr-x-private",
|
||||
|
||||
// Irregular grandfathered language tag.
|
||||
"i-klingon",
|
||||
|
||||
// Regular grandfathered language tag.
|
||||
"zh-Hant",
|
||||
|
||||
// Reserved with extended language subtag
|
||||
"abcd-US",
|
||||
"abcde-US",
|
||||
"abcdef-US",
|
||||
"abcdefg-US",
|
||||
"abcdefgh-US",
|
||||
|
||||
7,
|
||||
];
|
||||
for (const invalidLanguageOption of invalidLanguageOptions) {
|
||||
assert.throws(RangeError, () => new Intl.Locale("en", {language: invalidLanguageOption}));
|
||||
}
|
||||
|
||||
|
||||
// ApplyOptionsToTag step 5, 9.b.
|
||||
const validScriptOptions = [
|
||||
[null, "en-Null"],
|
||||
["bali", "en-Bali"],
|
||||
["Bali", "en-Bali"],
|
||||
["bALI", "en-BALI"], // TODO REVIEW: is this the correct case regularization?
|
||||
[{ toString() { return "Brai" } }, "en-Brai"],
|
||||
];
|
||||
for (const [option, expected] of validScriptOptions) {
|
||||
assert.sameValue(new Intl.Locale("en", {
|
||||
script: option,
|
||||
}).toString(), expected);
|
||||
assert.sameValue(new Intl.Locale("en-Cyrl", {
|
||||
script: option,
|
||||
}).toString(), expected);
|
||||
}
|
||||
|
||||
|
||||
// ApplyOptionsToTag step 6.a.
|
||||
/*
|
||||
script = 4ALPHA ; ISO 15924 code
|
||||
*/
|
||||
const invalidScriptOptions = [
|
||||
"",
|
||||
"a",
|
||||
"ab",
|
||||
"abc",
|
||||
"abc7",
|
||||
"notascript",
|
||||
"undefined",
|
||||
"Bal\u0130",
|
||||
"Bal\u0131",
|
||||
|
||||
// Value contains more than just the 'script' production.
|
||||
"ary-Arab",
|
||||
"Latn-SA",
|
||||
"Latn-vaidika",
|
||||
"Latn-a-asdf",
|
||||
"Latn-x-private",
|
||||
|
||||
7,
|
||||
];
|
||||
for (const invalidScriptOption of invalidScriptOptions) {
|
||||
assert.throws(RangeError, () => new Intl.Locale("en", {script: invalidScriptOption}));
|
||||
}
|
||||
|
||||
|
||||
// ApplyOptionsToTag step 7, 9.c.
|
||||
const validRegionOptions = [
|
||||
["FR", "en-FR"],
|
||||
["554", "en-554"],
|
||||
[554, "en-554"],
|
||||
];
|
||||
for (const [option, expected] of validRegionOptions) {
|
||||
assert.sameValue(new Intl.Locale("en", {
|
||||
region: option,
|
||||
}).toString(), expected);
|
||||
assert.sameValue(new Intl.Locale("en-US", {
|
||||
region: option,
|
||||
}).toString(), expected);
|
||||
}
|
||||
|
||||
|
||||
// ApplyOptionsToTag step 8.a.
|
||||
/*
|
||||
region = 2ALPHA ; ISO 3166-1 code
|
||||
/ 3DIGIT ; UN M.49 code
|
||||
*/
|
||||
const invalidRegionOptions = [
|
||||
"",
|
||||
"a",
|
||||
"abc",
|
||||
"a7",
|
||||
|
||||
// Value cannot be parsed as a 'region' production.
|
||||
"notaregion",
|
||||
|
||||
// Value contains more than just the 'region' production.
|
||||
"SA-vaidika",
|
||||
"SA-a-asdf",
|
||||
"SA-x-private",
|
||||
|
||||
// Value contains more than just the 'script' production.
|
||||
"ary-Arab",
|
||||
"Latn-SA",
|
||||
"Latn-vaidika",
|
||||
"Latn-a-asdf",
|
||||
"Latn-x-private",
|
||||
|
||||
7,
|
||||
];
|
||||
for (const invalidRegionOption of invalidRegionOptions) {
|
||||
assert.throws(RangeError, () => new Intl.Locale("en", {region: invalidRegionOption}));
|
||||
}
|
||||
|
||||
|
||||
// Intl.Locale step 14.
|
||||
const validCalendarOptions = [
|
||||
["abc", "en-u-ca-abc"],
|
||||
["abcd", "en-u-ca-abcd"],
|
||||
["abcde", "en-u-ca-abcde"],
|
||||
["abcdef", "en-u-ca-abcdef"],
|
||||
["abcdefg", "en-u-ca-abcdefg"],
|
||||
["abcdefgh", "en-u-ca-abcdefgh"],
|
||||
["12345678", "en-u-ca-12345678"],
|
||||
["1234abcd", "en-u-ca-1234abcd"],
|
||||
["1234abcd-abc123", "en-u-ca-1234abcd-abc123"],
|
||||
];
|
||||
for (const [option, expected] of validCalendarOptions) {
|
||||
assert.sameValue(new Intl.Locale("en", {
|
||||
calendar: option,
|
||||
}).toString(), expected);
|
||||
assert.sameValue(new Intl.Locale("en-u-ca-gregory", {
|
||||
calendar: option,
|
||||
}).toString(), expected);
|
||||
}
|
||||
|
||||
|
||||
// Intl.Locale step 15.
|
||||
/*
|
||||
alphanum = (ALPHA / DIGIT) ; letters and numbers
|
||||
calendar = (3*8alphanum) *("-" (3*8alphanum))
|
||||
*/
|
||||
const invalidCalendarOptions = [
|
||||
"",
|
||||
"a",
|
||||
"ab",
|
||||
"abcdefghi",
|
||||
"abc-abcdefghi",
|
||||
];
|
||||
for (const invalidCalendarOption of invalidCalendarOptions) {
|
||||
assert.throws(RangeError, () => new Intl.Locale("en", {calendar: invalidCalendarOption}));
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-intl.locale
|
||||
description: >
|
||||
The value of the [[Prototype]] internal slot of the Intl.Locale constructor is the
|
||||
intrinsic object %FunctionPrototype%.
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
Object.getPrototypeOf(Intl.Locale),
|
||||
Function.prototype,
|
||||
"Object.getPrototypeOf(Intl.Locale) equals the value of Function.prototype"
|
||||
);
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright 2018 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-intl.locale
|
||||
description: >
|
||||
Intl.Locale instance object extensibility
|
||||
info: |
|
||||
17 ECMAScript Standard Built-in Objects:
|
||||
|
||||
Unless specified otherwise, the [[Extensible]] internal slot
|
||||
of a built-in object initially has the value true.
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
Object.isExtensible(new Intl.Locale('en')),
|
||||
true,
|
||||
"Object.isExtensible(new Intl.Locale('en')) returns true"
|
||||
);
|
|
@ -1,16 +0,0 @@
|
|||
// Copyright 2018 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: pending
|
||||
description: >
|
||||
Verifies the properties of a Locale instance.
|
||||
info: |
|
||||
Intl.Locale( tag [, options] )
|
||||
6. Let locale be ? OrdinaryCreateFromConstructor(NewTarget, %LocalePrototype%, internalSlotsList).
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
const value = new Intl.Locale("en");
|
||||
assert.sameValue(Object.getPrototypeOf(value), Intl.Locale.prototype);
|
||||
assert.sameValue(Object.isExtensible(value), true);
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2018 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-intl.locale
|
||||
description: >
|
||||
Intl.Locale instance object created from %LocalePrototype%.
|
||||
info: |
|
||||
Intl.Locale( tag [, options] )
|
||||
|
||||
6. Let locale be ?
|
||||
OrdinaryCreateFromConstructor(NewTarget, %LocalePrototype%,
|
||||
internalSlotsList).
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
const value = new Intl.Locale('en');
|
||||
assert.sameValue(
|
||||
Object.getPrototypeOf(value),
|
||||
Intl.Locale.prototype,
|
||||
"Object.getPrototypeOf(value) equals the value of Intl.Locale.prototype"
|
||||
);
|
|
@ -2,20 +2,19 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: pending
|
||||
esid: sec-intl.locale
|
||||
description: >
|
||||
Verifies the type check on the tag argument to Intl.Locale.
|
||||
Verifies the type check on the tag argument to Intl.Locale.
|
||||
info: |
|
||||
Intl.Locale( tag [, options] )
|
||||
7. If Type(tag) is not String or Object, throw a TypeError exception.
|
||||
Intl.Locale( tag [, options] )
|
||||
|
||||
7. If Type(tag) is not String or Object, throw a TypeError exception.
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
const boolean_values = [
|
||||
true,
|
||||
false,
|
||||
];
|
||||
|
||||
for (const boolean_value of boolean_values) {
|
||||
assert.throws(TypeError, () => new Intl.Locale(boolean_value));
|
||||
}
|
||||
assert.throws(TypeError, function() {
|
||||
new Intl.Locale(true);
|
||||
}, "true is an invalid tag value");
|
||||
assert.throws(TypeError, function() {
|
||||
new Intl.Locale(false);
|
||||
}, "false is an invalid tag value");
|
||||
|
|
|
@ -2,13 +2,16 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: pending
|
||||
esid: sec-intl.locale
|
||||
description: >
|
||||
Verifies the type check on the tag argument to Intl.Locale.
|
||||
Verifies the type check on the tag argument to Intl.Locale.
|
||||
info: |
|
||||
Intl.Locale( tag [, options] )
|
||||
7. If Type(tag) is not String or Object, throw a TypeError exception.
|
||||
Intl.Locale( tag [, options] )
|
||||
|
||||
7. If Type(tag) is not String or Object, throw a TypeError exception.
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, () => new Intl.Locale(null));
|
||||
assert.throws(TypeError, function() {
|
||||
new Intl.Locale(null);
|
||||
}, "null is an invalid tag value");
|
||||
|
|
|
@ -2,19 +2,29 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: pending
|
||||
esid: sec-intl.locale
|
||||
description: >
|
||||
Verifies the type check on the tag argument to Intl.Locale.
|
||||
info: |
|
||||
Intl.Locale( tag [, options] )
|
||||
|
||||
7. If Type(tag) is not String or Object, throw a TypeError exception.
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
const invalid_type_values = [
|
||||
0, 1.5, Infinity, -Infinity, NaN,
|
||||
];
|
||||
assert.throws(TypeError, function() {
|
||||
new Intl.Locale(0);
|
||||
}, "0 is an invalid tag value");
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new Intl.Locale(1);
|
||||
}, "1 is an invalid tag value");
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new Intl.Locale(Infinity);
|
||||
}, "Infinity is an invalid tag value");
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new Intl.Locale(NaN);
|
||||
}, "NaN is an invalid tag value");
|
||||
|
||||
for (const invalid_type_value of invalid_type_values) {
|
||||
assert.throws(TypeError, () => new Intl.Locale(invalid_type_value));
|
||||
}
|
||||
|
|
|
@ -2,14 +2,16 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: pending
|
||||
esid: sec-intl.locale
|
||||
description: >
|
||||
Verifies the type check on the tag argument to Intl.Locale.
|
||||
info: |
|
||||
Intl.Locale( tag [, options] )
|
||||
|
||||
7. If Type(tag) is not String or Object, throw a TypeError exception.
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
const symbol = Symbol();
|
||||
assert.throws(TypeError, () => new Intl.Locale(symbol));
|
||||
assert.throws(TypeError, function() {
|
||||
new Intl.Locale(Symbol());
|
||||
}, "Symbol() is an invalid tag value");
|
||||
|
|
|
@ -2,14 +2,20 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: pending
|
||||
esid: sec-intl.locale
|
||||
description: >
|
||||
Verifies the type check on the tag argument to Intl.Locale.
|
||||
info: |
|
||||
Intl.Locale( tag [, options] )
|
||||
|
||||
7. If Type(tag) is not String or Object, throw a TypeError exception.
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, () => new Intl.Locale());
|
||||
assert.throws(TypeError, () => new Intl.Locale(undefined));
|
||||
assert.throws(TypeError, function() {
|
||||
new Intl.Locale();
|
||||
}, "(empty) is an invalid tag value");
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new Intl.Locale(undefined)
|
||||
}, "undefined is an invalid tag value");
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-intl.locale
|
||||
description: >
|
||||
Checks error cases for the options argument to the Locale
|
||||
constructor.
|
||||
info: |
|
||||
Intl.Locale( tag [, options] )
|
||||
|
||||
...
|
||||
11. Else
|
||||
a. Let options be ? ToObject(options).
|
||||
12. Set tag to ? ApplyOptionsToTag(tag, options).
|
||||
...
|
||||
|
||||
ApplyOptionsToTag( tag, options )
|
||||
|
||||
...
|
||||
2. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception.
|
||||
...
|
||||
includes: [testIntl.js]
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
// Intl.Locale step 11.a.
|
||||
assert.throws(TypeError, function() { new Intl.Locale("en", null) })
|
||||
|
||||
|
||||
// ApplyOptionsToTag step 2.
|
||||
for (const invalidTag of getInvalidLanguageTags()) {
|
||||
assert.throws(RangeError, function() {
|
||||
new Intl.Locale(invalidTag);
|
||||
}, `${invalidTag} is an invalid tag value`);
|
||||
}
|
||||
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: pending
|
||||
esid: sec-intl.locale
|
||||
description: >
|
||||
Checks the "length" property of the Locale constructor.
|
||||
info: |
|
||||
|
@ -10,11 +10,13 @@ info: |
|
|||
The Locale constructor is a standard built-in property of the Intl object.
|
||||
Every built-in function object, including constructors, has a length property whose value is an integer. Unless otherwise specified, this value is equal to the largest number of named arguments shown in the subclause headings for the function description. Optional parameters (which are indicated with brackets: [ ]) or rest parameters (which are shown using the form «...name») are not included in the default argument count.
|
||||
Unless otherwise specified, the length property of a built-in function object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
|
||||
includes: [propertyHelper.js]
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale, "length");
|
||||
assert.sameValue(propdesc.writable, false);
|
||||
assert.sameValue(propdesc.enumerable, false);
|
||||
assert.sameValue(propdesc.configurable, true);
|
||||
assert.sameValue(propdesc.value, 1);
|
||||
verifyProperty(Intl.Locale, "length", {
|
||||
value: 1,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
|
|
@ -2,18 +2,20 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: pending
|
||||
esid: sec-intl.locale
|
||||
description: >
|
||||
Checks the "name" property of the Locale constructor.
|
||||
info: |
|
||||
Unless specified otherwise in this document, the objects, functions, and constructors described in this standard are subject to the generic requirements and restrictions specified for standard built-in ECMAScript objects in the ECMAScript 2019 Language Specification, 10th edition, clause 17, or successor.
|
||||
Every built-in function object, including constructors, that is not identified as an anonymous function has a name property whose value is a String. Unless otherwise specified, this value is the name that is given to the function in this specification.
|
||||
Unless otherwise specified, the name property of a built-in function object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
|
||||
includes: [propertyHelper.js]
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale, "name");
|
||||
assert.sameValue(propdesc.writable, false);
|
||||
assert.sameValue(propdesc.enumerable, false);
|
||||
assert.sameValue(propdesc.configurable, true);
|
||||
assert.sameValue(propdesc.value, "Locale");
|
||||
verifyProperty(Intl.Locale, "name", {
|
||||
value: "Locale",
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
|
|
@ -2,21 +2,25 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: pending
|
||||
esid: sec-intl.locale
|
||||
description: >
|
||||
Checks the properties of the Locale constructor.
|
||||
The value of the [[Prototype]] internal slot of the Intl.Locale constructor is the
|
||||
intrinsic object %FunctionPrototype%.
|
||||
info: |
|
||||
Every other data property described in clauses 18 through 26 and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
|
||||
Unless specified otherwise in this document, the objects, functions, and constructors described in this standard are subject to the generic requirements and restrictions specified for standard built-in ECMAScript objects in the ECMAScript 2019 Language Specification, 10th edition, clause 17, or successor.
|
||||
The Locale constructor is a standard built-in property of the Intl object.
|
||||
The value of Intl.Locale.prototype is %LocalePrototype%.
|
||||
|
||||
This property has the attributes
|
||||
{ [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
|
||||
|
||||
includes: [propertyHelper.js]
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
const propdesc = Object.getOwnPropertyDescriptor(Intl, "Locale");
|
||||
assert.sameValue(propdesc.writable, true);
|
||||
assert.sameValue(propdesc.enumerable, false);
|
||||
assert.sameValue(propdesc.configurable, true);
|
||||
assert.sameValue(propdesc.value, Intl.Locale);
|
||||
assert.sameValue(typeof Intl.Locale, "function", "typeof Intl.Locale is function");
|
||||
|
||||
assert.sameValue(typeof Intl.Locale, "function");
|
||||
assert.sameValue(Object.getPrototypeOf(Intl.Locale), Function.prototype);
|
||||
verifyProperty(Intl, "Locale", {
|
||||
value: Intl.Locale,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false,
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: pending
|
||||
esid: sec-intl.locale.prototype.constructor
|
||||
description: >
|
||||
Checks the "constructor" property of the Locale prototype object.
|
||||
info: |
|
||||
|
@ -13,11 +13,13 @@ info: |
|
|||
Unless specified otherwise in this document, the objects, functions, and constructors described in this standard are subject to the generic requirements and restrictions specified for standard built-in ECMAScript objects in the ECMAScript 2019 Language Specification, 10th edition, clause 17, or successor.
|
||||
|
||||
Every other data property described in clauses 18 through 26 and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
|
||||
includes: [propertyHelper.js]
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "constructor");
|
||||
assert.sameValue(propdesc.writable, true);
|
||||
assert.sameValue(propdesc.enumerable, false);
|
||||
assert.sameValue(propdesc.configurable, true);
|
||||
assert.sameValue(propdesc.value, Intl.Locale);
|
||||
verifyProperty(Intl.Locale.prototype, 'constructor', {
|
||||
value: Intl.Locale,
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-intl.locale.prototype.maximize
|
||||
description: >
|
||||
Checks the "length" property of Intl.Locale.prototype.maximize().
|
||||
info: |
|
||||
Unless specified otherwise in this document, the objects, functions, and constructors described in this standard are subject to the generic requirements and restrictions specified for standard built-in ECMAScript objects in the ECMAScript 2019 Language Specification, 10th edition, clause 17, or successor.
|
||||
The Locale constructor is a standard built-in property of the Intl object.
|
||||
Every built-in function object, including constructors, has a length property whose value is an integer. Unless otherwise specified, this value is equal to the largest number of named arguments shown in the subclause headings for the function description. Optional parameters (which are indicated with brackets: [ ]) or rest parameters (which are shown using the form «...name») are not included in the default argument count.
|
||||
Unless otherwise specified, the length property of a built-in function object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
|
||||
includes: [propertyHelper.js]
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
verifyProperty(Intl.Locale.prototype.maximize, 'length', {
|
||||
value: 1,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-intl.locale.prototype.maximize
|
||||
description: >
|
||||
Checks the "name" property of Intl.Locale.prototype.maximize().
|
||||
info: |
|
||||
Unless specified otherwise in this document, the objects, functions, and constructors described in this standard are subject to the generic requirements and restrictions specified for standard built-in ECMAScript objects in the ECMAScript 2019 Language Specification, 10th edition, clause 17, or successor.
|
||||
Every built-in function object, including constructors, that is not identified as an anonymous function has a name property whose value is a String. Unless otherwise specified, this value is the name that is given to the function in this specification.
|
||||
Unless otherwise specified, the name property of a built-in function object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
|
||||
includes: [propertyHelper.js]
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
verifyProperty(Intl.Locale.prototype.maximize, 'name', {
|
||||
value: 'maximize',
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
|
@ -2,7 +2,7 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: pending
|
||||
esid: sec-intl.locale.prototype.maximize
|
||||
description: >
|
||||
Checks the "maximize" property of the Locale prototype object.
|
||||
info: |
|
||||
|
@ -11,11 +11,19 @@ info: |
|
|||
Unless specified otherwise in this document, the objects, functions, and constructors described in this standard are subject to the generic requirements and restrictions specified for standard built-in ECMAScript objects in the ECMAScript 2019 Language Specification, 10th edition, clause 17, or successor.
|
||||
|
||||
Every other data property described in clauses 18 through 26 and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
|
||||
includes: [propertyHelper.js]
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, "maximize");
|
||||
assert.sameValue(propdesc.writable, true);
|
||||
assert.sameValue(propdesc.enumerable, false);
|
||||
assert.sameValue(propdesc.configurable, true);
|
||||
assert.sameValue(typeof propdesc.value, "function");
|
||||
assert.sameValue(
|
||||
typeof Intl.Locale.prototype.maximize,
|
||||
'function',
|
||||
"typeof Intl.Locale.prototype.maximize is function"
|
||||
);
|
||||
|
||||
verifyProperty(Intl.Locale.prototype, 'maximize', {
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: false,
|
||||
});
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: pending
|
||||
esid: sec-intl.locale.prototype
|
||||
description: >
|
||||
Checks the "prototype" property of the Locale constructor.
|
||||
info: |
|
||||
|
@ -11,12 +11,12 @@ info: |
|
|||
The value of Intl.Locale.prototype is %LocalePrototype%.
|
||||
|
||||
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
|
||||
includes: [propertyHelper.js]
|
||||
features: [Intl.Locale]
|
||||
---*/
|
||||
|
||||
const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale, "prototype");
|
||||
assert.sameValue(propdesc.writable, false);
|
||||
assert.sameValue(propdesc.enumerable, false);
|
||||
assert.sameValue(propdesc.configurable, false);
|
||||
assert.sameValue(typeof propdesc.value, "object");
|
||||
assert.notSameValue(propdesc.value, null);
|
||||
verifyProperty(Intl.Locale, 'prototype', {
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false,
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: pending
|
||||
esid: sec-intl.locale.prototype-@@tostringtag
|
||||
description: >
|
||||
Checks the @@toStringTag property of the Locale prototype object.
|
||||
info: |
|
||||
|
@ -11,11 +11,13 @@ info: |
|
|||
The initial value of the @@toStringTag property is the string value "Intl.Locale".
|
||||
|
||||
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
|
||||
includes: [propertyHelper.js]
|
||||
features: [Intl.Locale, Symbol.toStringTag]
|
||||
---*/
|
||||
|
||||
const propdesc = Object.getOwnPropertyDescriptor(Intl.Locale.prototype, Symbol.toStringTag);
|
||||
assert.sameValue(propdesc.writable, false);
|
||||
assert.sameValue(propdesc.enumerable, false);
|
||||
assert.sameValue(propdesc.configurable, true);
|
||||
assert.sameValue(propdesc.value, "Intl.Locale");
|
||||
verifyProperty(Intl.Locale.prototype, Symbol.toStringTag, {
|
||||
value: 'Intl.Locale',
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue