Skip to content

Commit

Permalink
Temporal: Remove now-valid rounding modes from roundingmode-invalid-s…
Browse files Browse the repository at this point in the history
…tring tests

See tc39/proposal-temporal#2262, which reached
consensus in the July 2022 TC39 meeting. This change added several
rounding modes from the NumberFormat V3 proposal, some of which were
listed as invalid in the roundingmode-invalid-string tests. Remove these
items from the list of invalid modes, since they are no longer invalid.
  • Loading branch information
ptomato authored and Ms2ger committed Sep 21, 2022
1 parent e79a193 commit 3214f2b
Show file tree
Hide file tree
Showing 22 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ features: [Temporal]
---*/

const duration = new Temporal.Duration(0, 0, 0, 0, 12, 34, 56, 123, 987, 500);
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "expand", "halfCeil", "halfFloor", "halfTrunc", "halfEven", "halfexpand", "floor\0"]) {
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "halfexpand", "floor\0"]) {
assert.throws(RangeError, () => duration.round({ smallestUnit: "microsecond", roundingMode }));
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ features: [Temporal]
---*/

const duration = new Temporal.Duration(0, 0, 0, 0, 12, 34, 56, 123, 987, 500);
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "expand", "halfCeil", "halfFloor", "halfTrunc", "halfEven", "halfexpand", "floor\0"]) {
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "halfexpand", "floor\0"]) {
assert.throws(RangeError, () => duration.toString({ smallestUnit: "microsecond", roundingMode }));
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ features: [Temporal]
---*/

const instant = new Temporal.Instant(1_000_000_000_123_987_500n);
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "expand", "halfCeil", "halfFloor", "halfTrunc", "halfEven", "halfexpand", "floor\0"]) {
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "halfexpand", "floor\0"]) {
assert.throws(RangeError, () => instant.round({ smallestUnit: "microsecond", roundingMode }));
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ features: [Temporal]

const earlier = new Temporal.Instant(1_000_000_000_000_000_000n);
const later = new Temporal.Instant(1_000_090_061_123_987_500n);
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "expand", "halfCeil", "halfFloor", "halfTrunc", "halfEven", "halfexpand", "floor\0"]) {
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "halfexpand", "floor\0"]) {
assert.throws(RangeError, () => later.since(earlier, { smallestUnit: "microsecond", roundingMode }));
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ features: [Temporal]
---*/

const instant = new Temporal.Instant(1_000_000_000_123_987_500n);
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "expand", "halfCeil", "halfFloor", "halfTrunc", "halfEven", "halfexpand", "floor\0"]) {
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "halfexpand", "floor\0"]) {
assert.throws(RangeError, () => instant.toString({ smallestUnit: "microsecond", roundingMode }));
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ features: [Temporal]

const earlier = new Temporal.Instant(1_000_000_000_000_000_000n);
const later = new Temporal.Instant(1_000_090_061_123_987_500n);
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "expand", "halfCeil", "halfFloor", "halfTrunc", "halfEven", "halfexpand", "floor\0"]) {
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "halfexpand", "floor\0"]) {
assert.throws(RangeError, () => earlier.until(later, { smallestUnit: "microsecond", roundingMode }));
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ features: [Temporal]

const earlier = new Temporal.PlainDate(2000, 5, 2);
const later = new Temporal.PlainDate(2001, 6, 3);
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "expand", "halfCeil", "halfFloor", "halfTrunc", "halfEven", "halfexpand", "floor\0"]) {
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "halfexpand", "floor\0"]) {
assert.throws(RangeError, () => later.since(earlier, { smallestUnit: "microsecond", roundingMode }));
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ features: [Temporal]

const earlier = new Temporal.PlainDate(2000, 5, 2);
const later = new Temporal.PlainDate(2001, 6, 3);
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "expand", "halfCeil", "halfFloor", "halfTrunc", "halfEven", "halfexpand", "floor\0"]) {
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "halfexpand", "floor\0"]) {
assert.throws(RangeError, () => earlier.until(later, { smallestUnit: "microsecond", roundingMode }));
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ features: [Temporal]
---*/

const datetime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 123, 987, 500);
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "expand", "halfCeil", "halfFloor", "halfTrunc", "halfEven", "halfexpand", "floor\0"]) {
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "halfexpand", "floor\0"]) {
assert.throws(RangeError, () => datetime.round({ smallestUnit: "microsecond", roundingMode }));
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ features: [Temporal]

const earlier = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 0, 0, 0);
const later = new Temporal.PlainDateTime(2000, 5, 3, 13, 35, 57, 123, 987, 500);
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "expand", "halfCeil", "halfFloor", "halfTrunc", "halfEven", "halfexpand", "floor\0"]) {
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "halfexpand", "floor\0"]) {
assert.throws(RangeError, () => later.since(earlier, { smallestUnit: "microsecond", roundingMode }));
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ features: [Temporal]
---*/

const datetime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 123, 987, 500);
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "expand", "halfCeil", "halfFloor", "halfTrunc", "halfEven", "halfexpand", "floor\0"]) {
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "halfexpand", "floor\0"]) {
assert.throws(RangeError, () => datetime.toString({ smallestUnit: "microsecond", roundingMode }));
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ features: [Temporal]

const earlier = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 0, 0, 0);
const later = new Temporal.PlainDateTime(2000, 5, 3, 13, 35, 57, 123, 987, 500);
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "expand", "halfCeil", "halfFloor", "halfTrunc", "halfEven", "halfexpand", "floor\0"]) {
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "halfexpand", "floor\0"]) {
assert.throws(RangeError, () => earlier.until(later, { smallestUnit: "microsecond", roundingMode }));
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ features: [Temporal]
---*/

const time = new Temporal.PlainTime(12, 34, 56, 123, 987, 500);
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "expand", "halfCeil", "halfFloor", "halfTrunc", "halfEven", "halfexpand", "floor\0"]) {
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "halfexpand", "floor\0"]) {
assert.throws(RangeError, () => time.round({ smallestUnit: "microsecond", roundingMode }));
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ features: [Temporal]

const earlier = new Temporal.PlainTime(12, 34, 56, 0, 0, 0);
const later = new Temporal.PlainTime(13, 35, 57, 123, 987, 500);
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "expand", "halfCeil", "halfFloor", "halfTrunc", "halfEven", "halfexpand", "floor\0"]) {
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "halfexpand", "floor\0"]) {
assert.throws(RangeError, () => later.since(earlier, { smallestUnit: "microsecond", roundingMode }));
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ features: [Temporal]
---*/

const time = new Temporal.PlainTime(12, 34, 56, 123, 987, 500);
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "expand", "halfCeil", "halfFloor", "halfTrunc", "halfEven", "halfexpand", "floor\0"]) {
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "halfexpand", "floor\0"]) {
assert.throws(RangeError, () => time.toString({ smallestUnit: "microsecond", roundingMode }));
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ features: [Temporal]

const earlier = new Temporal.PlainTime(12, 34, 56, 0, 0, 0);
const later = new Temporal.PlainTime(13, 35, 57, 123, 987, 500);
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "expand", "halfCeil", "halfFloor", "halfTrunc", "halfEven", "halfexpand", "floor\0"]) {
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "halfexpand", "floor\0"]) {
assert.throws(RangeError, () => earlier.until(later, { smallestUnit: "microsecond", roundingMode }));
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ features: [Temporal]

const earlier = new Temporal.PlainYearMonth(2000, 5);
const later = new Temporal.PlainYearMonth(2001, 6);
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "expand", "halfCeil", "halfFloor", "halfTrunc", "halfEven", "halfexpand", "floor\0"]) {
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "halfexpand", "floor\0"]) {
assert.throws(RangeError, () => later.since(earlier, { smallestUnit: "microsecond", roundingMode }));
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ features: [Temporal]

const earlier = new Temporal.PlainYearMonth(2000, 5);
const later = new Temporal.PlainYearMonth(2001, 6);
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "expand", "halfCeil", "halfFloor", "halfTrunc", "halfEven", "halfexpand", "floor\0"]) {
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "halfexpand", "floor\0"]) {
assert.throws(RangeError, () => earlier.until(later, { smallestUnit: "microsecond", roundingMode }));
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ features: [Temporal]
---*/

const datetime = new Temporal.ZonedDateTime(1_000_000_000_123_987_500n, "UTC");
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "expand", "halfCeil", "halfFloor", "halfTrunc", "halfEven", "halfexpand", "floor\0"]) {
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "halfexpand", "floor\0"]) {
assert.throws(RangeError, () => datetime.round({ smallestUnit: "microsecond", roundingMode }));
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ features: [Temporal]

const earlier = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
const later = new Temporal.ZonedDateTime(1_000_090_061_123_987_500n, "UTC");
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "expand", "halfCeil", "halfFloor", "halfTrunc", "halfEven", "halfexpand", "floor\0"]) {
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "halfexpand", "floor\0"]) {
assert.throws(RangeError, () => later.since(earlier, { smallestUnit: "microsecond", roundingMode }));
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ features: [Temporal]
---*/

const datetime = new Temporal.ZonedDateTime(1_000_000_000_123_987_500n, "UTC");
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "expand", "halfCeil", "halfFloor", "halfTrunc", "halfEven", "halfexpand", "floor\0"]) {
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "halfexpand", "floor\0"]) {
assert.throws(RangeError, () => datetime.toString({ smallestUnit: "microsecond", roundingMode }));
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ features: [Temporal]

const earlier = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
const later = new Temporal.ZonedDateTime(1_000_090_061_123_987_500n, "UTC");
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "expand", "halfCeil", "halfFloor", "halfTrunc", "halfEven", "halfexpand", "floor\0"]) {
for (const roundingMode of ["other string", "cile", "CEIL", "ce\u0131l", "auto", "halfexpand", "floor\0"]) {
assert.throws(RangeError, () => earlier.until(later, { smallestUnit: "microsecond", roundingMode }));
}

0 comments on commit 3214f2b

Please sign in to comment.