mirror of https://github.com/tc39/test262.git
Fix expected values for 'quarter' in RelativeTimeFormat
This commit is contained in:
parent
0aa1f70c14
commit
cd101873ba
|
@ -30,6 +30,11 @@ const exceptions = {
|
|||
"0": "this year",
|
||||
"1": "next year",
|
||||
},
|
||||
"quarter": {
|
||||
"-1": "last quarter",
|
||||
"0": "this quarter",
|
||||
"1": "next quarter",
|
||||
},
|
||||
"month": {
|
||||
"-1": "last month",
|
||||
"0": "this month",
|
||||
|
|
|
@ -9,14 +9,14 @@ locale: [en-US]
|
|||
---*/
|
||||
|
||||
const units = {
|
||||
"second": "sec.",
|
||||
"minute": "min.",
|
||||
"hour": "hr.",
|
||||
"day": undefined,
|
||||
"week": "wk.",
|
||||
"month": "mo.",
|
||||
"quarter": "qtr.",
|
||||
"year": "yr.",
|
||||
"second": ["sec."],
|
||||
"minute": ["min."],
|
||||
"hour": ["hr."],
|
||||
"day": ["day", "days"],
|
||||
"week": ["wk."],
|
||||
"month": ["mo."],
|
||||
"quarter": ["qtr.", "qtrs."],
|
||||
"year": ["yr."],
|
||||
};
|
||||
|
||||
const rtf = new Intl.RelativeTimeFormat("en-US", {
|
||||
|
@ -25,9 +25,8 @@ const rtf = new Intl.RelativeTimeFormat("en-US", {
|
|||
|
||||
assert.sameValue(typeof rtf.format, "function", "format should be supported");
|
||||
|
||||
for (const [unitArgument, unitString] of Object.entries(units)) {
|
||||
const singular = unitString || `${unitArgument}`;
|
||||
const plural = unitString || `${unitArgument}s`;
|
||||
for (const [unitArgument, unitStrings] of Object.entries(units)) {
|
||||
const [singular, plural = singular] = unitStrings;
|
||||
assert.sameValue(rtf.format(1000, unitArgument), `in 1,000 ${plural}`);
|
||||
assert.sameValue(rtf.format(10, unitArgument), `in 10 ${plural}`);
|
||||
assert.sameValue(rtf.format(2, unitArgument), `in 2 ${plural}`);
|
||||
|
|
|
@ -26,6 +26,11 @@ function expected(key, unit, default_) {
|
|||
"0": "this year",
|
||||
"1": "next year",
|
||||
},
|
||||
"quarter": {
|
||||
"-1": "last quarter",
|
||||
"0": "this quarter",
|
||||
"1": "next quarter",
|
||||
},
|
||||
"month": {
|
||||
"-1": "last month",
|
||||
"0": "this month",
|
||||
|
|
|
@ -19,14 +19,14 @@ function verifyFormatParts(actual, expected, message) {
|
|||
}
|
||||
|
||||
const units = {
|
||||
"second": "sec.",
|
||||
"minute": "min.",
|
||||
"hour": "hr.",
|
||||
"day": undefined,
|
||||
"week": "wk.",
|
||||
"month": "mo.",
|
||||
"quarter": "qtr.",
|
||||
"year": "yr.",
|
||||
"second": ["sec."],
|
||||
"minute": ["min."],
|
||||
"hour": ["hr."],
|
||||
"day": ["day", "days"],
|
||||
"week": ["wk."],
|
||||
"month": ["mo."],
|
||||
"quarter": ["qtr.", "qtrs."],
|
||||
"year": ["yr."],
|
||||
};
|
||||
|
||||
const rtf = new Intl.RelativeTimeFormat("en-US", {
|
||||
|
@ -35,9 +35,8 @@ const rtf = new Intl.RelativeTimeFormat("en-US", {
|
|||
|
||||
assert.sameValue(typeof rtf.formatToParts, "function", "formatToParts should be supported");
|
||||
|
||||
for (const [unitArgument, unitString] of Object.entries(units)) {
|
||||
const singular = unitString || `${unitArgument}`;
|
||||
const plural = unitString || `${unitArgument}s`;
|
||||
for (const [unitArgument, unitStrings] of Object.entries(units)) {
|
||||
const [singular, plural = singular] = unitStrings;
|
||||
|
||||
verifyFormatParts(rtf.formatToParts(1000, unitArgument), [
|
||||
{ "type": "literal", "value": "in " },
|
||||
|
|
Loading…
Reference in New Issue