mirror of https://github.com/tc39/test262.git
restore the wrong copy
This commit is contained in:
parent
970865e44d
commit
c2bd148ac7
|
@ -2,13 +2,46 @@
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
esid: sec-temporal.instant.prototype.tolocalestring
|
esid: sup-temporal.instant.prototype.tolocalestring
|
||||||
description: >
|
description: >
|
||||||
toLocaleString return a string.
|
Conflicting properties of dateStyle must be rejected with a TypeError for the options argument
|
||||||
features: [Temporal]
|
info: |
|
||||||
|
Using sec-temporal-getdatetimeformatpattern:
|
||||||
|
GetDateTimeFormatPattern ( dateStyle, timeStyle, matcher, opt, dataLocaleData, hc )
|
||||||
|
|
||||||
|
1. If dateStyle is not undefined or timeStyle is not undefined, then
|
||||||
|
a. For each row in Table 7, except the header row, do
|
||||||
|
i. Let prop be the name given in the Property column of the row.
|
||||||
|
ii. Let p be opt.[[<prop>]].
|
||||||
|
iii. If p is not undefined, then
|
||||||
|
1. Throw a TypeError exception.
|
||||||
|
features: [BigInt, Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
// Table 14 - Supported fields + example value for each field
|
||||||
|
const conflictingOptions = [
|
||||||
|
[ "weekday", "short" ],
|
||||||
|
[ "era", "short" ],
|
||||||
|
[ "year", "numeric" ],
|
||||||
|
[ "month", "numeric" ],
|
||||||
|
[ "day", "numeric" ],
|
||||||
|
[ "hour", "numeric" ],
|
||||||
|
[ "minute", "numeric" ],
|
||||||
|
[ "second", "numeric" ],
|
||||||
|
[ "dayPeriod", "short" ],
|
||||||
|
[ "fractionalSecondDigits", 3 ],
|
||||||
|
];
|
||||||
const instant = new Temporal.Instant(957270896_987_650_000n);
|
const instant = new Temporal.Instant(957270896_987_650_000n);
|
||||||
|
|
||||||
assert.sameValue(typeof instant.toLocaleString("en", { dateStyle: "short" }), "string");
|
assert.sameValue(typeof instant.toLocaleString("en", { dateStyle: "short" }), "string");
|
||||||
assert.sameValue(typeof instant.toLocaleString("en", { timeStyle: "short" }), "string");
|
assert.sameValue(typeof instant.toLocaleString("en", { timeStyle: "short" }), "string");
|
||||||
|
|
||||||
|
for (const [ option, value ] of conflictingOptions) {
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
instant.toLocaleString("en", { [option]: value, dateStyle: "short" });
|
||||||
|
}, `instant.toLocaleString("en", { ${option}: "${value}", dateStyle: "short" }) throws TypeError`);
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
instant.toLocaleString("en", { [option]: value, timeStyle: "short" });
|
||||||
|
}, `instant.toLocaleString("en", { ${option}: "${value}", timeStyle: "short" }) throws TypeError`);
|
||||||
|
}
|
||||||
|
|
|
@ -2,12 +2,36 @@
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
esid: sec-temporal.plaindate.prototype.tolocalestring
|
esid: sup-temporal.plaindate.prototype.tolocalestring
|
||||||
description: >
|
description: >
|
||||||
toLocaleString return a string.
|
Conflicting properties of dateStyle must be rejected with a TypeError for the options argument
|
||||||
|
info: |
|
||||||
|
Using sec-temporal-getdatetimeformatpattern:
|
||||||
|
GetDateTimeFormatPattern ( dateStyle, timeStyle, matcher, opt, dataLocaleData, hc )
|
||||||
|
|
||||||
|
1. If dateStyle is not undefined or timeStyle is not undefined, then
|
||||||
|
a. For each row in Table 7, except the header row, do
|
||||||
|
i. Let prop be the name given in the Property column of the row.
|
||||||
|
ii. Let p be opt.[[<prop>]].
|
||||||
|
iii. If p is not undefined, then
|
||||||
|
1. Throw a TypeError exception.
|
||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
// Table 14 - Supported fields + example value for each field
|
||||||
|
const conflictingOptions = [
|
||||||
|
[ "weekday", "short" ],
|
||||||
|
[ "era", "short" ],
|
||||||
|
[ "year", "numeric" ],
|
||||||
|
[ "month", "numeric" ],
|
||||||
|
[ "day", "numeric" ],
|
||||||
|
];
|
||||||
const date = new Temporal.PlainDate(2000, 5, 2);
|
const date = new Temporal.PlainDate(2000, 5, 2);
|
||||||
|
|
||||||
assert.sameValue(typeof date.toLocaleString("en", { dateStyle: "short" }), "string");
|
assert.sameValue(typeof date.toLocaleString("en", { dateStyle: "short" }), "string");
|
||||||
|
|
||||||
|
for (const [ option, value ] of conflictingOptions) {
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
date.toLocaleString("en", { [option]: value, dateStyle: "short" });
|
||||||
|
}, `date.toLocaleString("en", { ${option}: "${value}", dateStyle: "short" }) throws TypeError`);
|
||||||
|
}
|
||||||
|
|
|
@ -2,13 +2,46 @@
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
esid: sec-temporal.plaindatetime.prototype.tolocalestring
|
esid: sup-temporal.plaindatetime.prototype.tolocalestring
|
||||||
description: >
|
description: >
|
||||||
toLocaleString return a string.
|
Conflicting properties of dateStyle must be rejected with a TypeError for the options argument
|
||||||
|
info: |
|
||||||
|
Using sec-temporal-getdatetimeformatpattern:
|
||||||
|
GetDateTimeFormatPattern ( dateStyle, timeStyle, matcher, opt, dataLocaleData, hc )
|
||||||
|
|
||||||
|
1. If dateStyle is not undefined or timeStyle is not undefined, then
|
||||||
|
a. For each row in Table 7, except the header row, do
|
||||||
|
i. Let prop be the name given in the Property column of the row.
|
||||||
|
ii. Let p be opt.[[<prop>]].
|
||||||
|
iii. If p is not undefined, then
|
||||||
|
1. Throw a TypeError exception.
|
||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
// Table 14 - Supported fields + example value for each field
|
||||||
|
const conflictingOptions = [
|
||||||
|
[ "weekday", "short" ],
|
||||||
|
[ "era", "short" ],
|
||||||
|
[ "year", "numeric" ],
|
||||||
|
[ "month", "numeric" ],
|
||||||
|
[ "day", "numeric" ],
|
||||||
|
[ "hour", "numeric" ],
|
||||||
|
[ "minute", "numeric" ],
|
||||||
|
[ "second", "numeric" ],
|
||||||
|
[ "dayPeriod", "short" ],
|
||||||
|
[ "fractionalSecondDigits", 3 ],
|
||||||
|
];
|
||||||
const datetime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
const datetime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||||
|
|
||||||
assert.sameValue(typeof datetime.toLocaleString("en", { dateStyle: "short" }), "string");
|
assert.sameValue(typeof datetime.toLocaleString("en", { dateStyle: "short" }), "string");
|
||||||
assert.sameValue(typeof datetime.toLocaleString("en", { timeStyle: "short" }), "string");
|
assert.sameValue(typeof datetime.toLocaleString("en", { timeStyle: "short" }), "string");
|
||||||
|
|
||||||
|
for (const [ option, value ] of conflictingOptions) {
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
datetime.toLocaleString("en", { [option]: value, dateStyle: "short" });
|
||||||
|
}, `datetime.toLocaleString("en", { ${option}: "${value}", dateStyle: "short" }) throws TypeError`);
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
datetime.toLocaleString("en", { [option]: value, timeStyle: "short" });
|
||||||
|
}, `datetime.toLocaleString("en", { ${option}: "${value}", timeStyle: "short" }) throws TypeError`);
|
||||||
|
}
|
||||||
|
|
|
@ -2,12 +2,36 @@
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
esid: sec-temporal.plaintime.prototype.tolocalestring
|
esid: sup-temporal.plaintime.prototype.tolocalestring
|
||||||
description: >
|
description: >
|
||||||
toLocaleString return a string.
|
Conflicting properties of dateStyle must be rejected with a TypeError for the options argument
|
||||||
|
info: |
|
||||||
|
Using sec-temporal-getdatetimeformatpattern:
|
||||||
|
GetDateTimeFormatPattern ( dateStyle, timeStyle, matcher, opt, dataLocaleData, hc )
|
||||||
|
|
||||||
|
1. If dateStyle is not undefined or timeStyle is not undefined, then
|
||||||
|
a. For each row in Table 7, except the header row, do
|
||||||
|
i. Let prop be the name given in the Property column of the row.
|
||||||
|
ii. Let p be opt.[[<prop>]].
|
||||||
|
iii. If p is not undefined, then
|
||||||
|
1. Throw a TypeError exception.
|
||||||
features: [Temporal]
|
features: [Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
// Table 14 - Supported fields + example value for each field
|
||||||
|
const conflictingOptions = [
|
||||||
|
[ "hour", "numeric" ],
|
||||||
|
[ "minute", "numeric" ],
|
||||||
|
[ "second", "numeric" ],
|
||||||
|
[ "dayPeriod", "short" ],
|
||||||
|
[ "fractionalSecondDigits", 3 ],
|
||||||
|
];
|
||||||
const time = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
const time = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||||
|
|
||||||
assert.sameValue(typeof time.toLocaleString("en", { timeStyle: "short" }), "string");
|
assert.sameValue(typeof time.toLocaleString("en", { timeStyle: "short" }), "string");
|
||||||
|
|
||||||
|
for (const [ option, value ] of conflictingOptions) {
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
time.toLocaleString("en", { [option]: value, timeStyle: "short" });
|
||||||
|
}, `time.toLocaleString("en", { ${option}: "${value}", timeStyle: "short" }) throws TypeError`);
|
||||||
|
}
|
||||||
|
|
|
@ -2,13 +2,47 @@
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
esid: sec-temporal.zoneddatetime.prototype.tolocalestring
|
esid: sup-temporal.zoneddatetime.prototype.tolocalestring
|
||||||
description: >
|
description: >
|
||||||
toLocaleString return a string.
|
Conflicting properties of dateStyle must be rejected with a TypeError for the options argument
|
||||||
features: [Temporal]
|
info: |
|
||||||
|
Using sec-temporal-getdatetimeformatpattern:
|
||||||
|
GetDateTimeFormatPattern ( dateStyle, timeStyle, matcher, opt, dataLocaleData, hc )
|
||||||
|
|
||||||
|
1. If dateStyle is not undefined or timeStyle is not undefined, then
|
||||||
|
a. For each row in Table 7, except the header row, do
|
||||||
|
i. Let prop be the name given in the Property column of the row.
|
||||||
|
ii. Let p be opt.[[<prop>]].
|
||||||
|
iii. If p is not undefined, then
|
||||||
|
1. Throw a TypeError exception.
|
||||||
|
features: [BigInt, Temporal]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
// Table 14 - Supported fields + example value for each field
|
||||||
|
const conflictingOptions = [
|
||||||
|
[ "weekday", "short" ],
|
||||||
|
[ "era", "short" ],
|
||||||
|
[ "year", "numeric" ],
|
||||||
|
[ "month", "numeric" ],
|
||||||
|
[ "day", "numeric" ],
|
||||||
|
[ "hour", "numeric" ],
|
||||||
|
[ "minute", "numeric" ],
|
||||||
|
[ "second", "numeric" ],
|
||||||
|
[ "dayPeriod", "short" ],
|
||||||
|
[ "fractionalSecondDigits", 3 ],
|
||||||
|
[ "timeZoneName", "short" ],
|
||||||
|
];
|
||||||
const datetime = new Temporal.ZonedDateTime(957270896_987_650_000n, "UTC");
|
const datetime = new Temporal.ZonedDateTime(957270896_987_650_000n, "UTC");
|
||||||
|
|
||||||
assert.sameValue(typeof datetime.toLocaleString("en", { dateStyle: "short" }), "string");
|
assert.sameValue(typeof datetime.toLocaleString("en", { dateStyle: "short" }), "string");
|
||||||
assert.sameValue(typeof datetime.toLocaleString("en", { timeStyle: "short" }), "string");
|
assert.sameValue(typeof datetime.toLocaleString("en", { timeStyle: "short" }), "string");
|
||||||
|
|
||||||
|
for (const [ option, value ] of conflictingOptions) {
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
datetime.toLocaleString("en", { [option]: value, dateStyle: "short" });
|
||||||
|
}, `datetime.toLocaleString("en", { ${option}: "${value}", dateStyle: "short" }) throws TypeError`);
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
datetime.toLocaleString("en", { [option]: value, timeStyle: "short" });
|
||||||
|
}, `datetime.toLocaleString("en", { ${option}: "${value}", timeStyle: "short" }) throws TypeError`);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue