Update Temporal test262 as per the normative changes

This commit is contained in:
Aditi 2023-01-04 16:23:49 +05:30 committed by Philip Chimento
parent 09f863d8c3
commit e1048d0aff
8 changed files with 26 additions and 27 deletions

View File

@ -14,9 +14,6 @@ TemporalHelpers.assertPlainDate(new Temporal.PlainDate(2020.6, 11.7, 24.1),
TemporalHelpers.assertPlainDate(new Temporal.PlainDate(-2020.6, 11.7, 24.1),
-2020, 11, "M11", 24, "negative fractional");
TemporalHelpers.assertPlainDate(new Temporal.PlainDate(undefined, 11, 24),
0, 11, "M11", 24, "undefined");
TemporalHelpers.assertPlainDate(new Temporal.PlainDate(null, 11, 24),
0, 11, "M11", 24, "null");
@ -26,15 +23,17 @@ TemporalHelpers.assertPlainDate(new Temporal.PlainDate(true, 11, 24),
TemporalHelpers.assertPlainDate(new Temporal.PlainDate("2020.6", "11.7", "24.1"),
2020, 11, "M11", 24, "fractional strings");
TemporalHelpers.assertPlainDate(new Temporal.PlainDate("invalid", 11, 24),
0, 11, "M11", 24, "invalid string");
for (const invalid of [Symbol(), 1n]) {
assert.throws(TypeError, () => new Temporal.PlainDate(invalid, 11, 24), `year ${typeof invalid}`);
assert.throws(TypeError, () => new Temporal.PlainDate(2020, invalid, 24), `month ${typeof invalid}`);
assert.throws(TypeError, () => new Temporal.PlainDate(2020, 11, invalid), `day ${typeof invalid}`);
}
for (const invalid of [undefined, "invalid"]) {
assert.throws(RangeError, () => new Temporal.PlainDate(invalid, 11, 24), `year ${typeof invalid}`);
assert.throws(RangeError, () => new Temporal.PlainDate(2020, invalid, 24), `month ${typeof invalid}`);
assert.throws(RangeError, () => new Temporal.PlainDate(2020, 11, invalid), `day ${typeof invalid}`);
}
const actual = [];
const args = [
TemporalHelpers.toPrimitiveObserver(actual, 2020, "year"),

View File

@ -13,6 +13,9 @@ const badResults = [
[-Infinity, RangeError],
[Symbol("foo"), TypeError],
[7n, TypeError],
[NaN, RangeError],
["string", RangeError],
[{}, RangeError],
];
badResults.forEach(([result, error]) => {
@ -32,11 +35,8 @@ const convertedResults = [
[7.1, 7],
[-7, -7],
[-0.1, 0],
[NaN, 0],
["string", 0],
["7", 7],
["7.5", 7],
[{}, 0],
[{valueOf() { return 7; }}, 7],
];

View File

@ -13,6 +13,9 @@ const badResults = [
[-Infinity, RangeError],
[Symbol("foo"), TypeError],
[7n, TypeError],
[NaN, RangeError],
["string", RangeError],
[{}, RangeError],
];
badResults.forEach(([result, error]) => {
@ -32,11 +35,8 @@ const convertedResults = [
[7.1, 7],
[-7, -7],
[-0.1, 0],
[NaN, 0],
["string", 0],
["7", 7],
["7.5", 7],
[{}, 0],
[{valueOf() { return 7; }}, 7],
];

View File

@ -13,6 +13,9 @@ const badResults = [
[-Infinity, RangeError],
[Symbol("foo"), TypeError],
[7n, TypeError],
[NaN, RangeError],
["string", RangeError],
[{}, RangeError],
];
badResults.forEach(([result, error]) => {
@ -32,11 +35,8 @@ const convertedResults = [
[7.1, 7],
[-7, -7],
[-0.1, 0],
[NaN, 0],
["string", 0],
["7", 7],
["7.5", 7],
[{}, 0],
[{valueOf() { return 7; }}, 7],
];

View File

@ -13,6 +13,9 @@ const badResults = [
[-Infinity, RangeError],
[Symbol("foo"), TypeError],
[7n, TypeError],
[NaN, RangeError],
["string", RangeError],
[{}, RangeError],
];
badResults.forEach(([result, error]) => {
@ -32,11 +35,8 @@ const convertedResults = [
[7.1, 7],
[-7, -7],
[-0.1, 0],
[NaN, 0],
["string", 0],
["7", 7],
["7.5", 7],
[{}, 0],
[{valueOf() { return 7; }}, 7],
];

View File

@ -13,6 +13,9 @@ const badResults = [
[-Infinity, RangeError],
[Symbol("foo"), TypeError],
[7n, TypeError],
[NaN, RangeError],
["string", RangeError],
[{}, RangeError],
];
badResults.forEach(([result, error]) => {
@ -32,11 +35,8 @@ const convertedResults = [
[7.1, 7],
[-7, -7],
[-0.1, 0],
[NaN, 0],
["string", 0],
["7", 7],
["7.5", 7],
[{}, 0],
[{valueOf() { return 7; }}, 7],
];

View File

@ -13,6 +13,9 @@ const badResults = [
[-Infinity, RangeError],
[Symbol("foo"), TypeError],
[7n, TypeError],
[NaN, RangeError],
["string", RangeError],
[{}, RangeError],
];
badResults.forEach(([result, error]) => {
@ -32,11 +35,8 @@ const convertedResults = [
[7.1, 7],
[-7, -7],
[-0.1, 0],
[NaN, 0],
["string", 0],
["7", 7],
["7.5", 7],
[{}, 0],
[{valueOf() { return 7; }}, 7],
];

View File

@ -13,6 +13,9 @@ const badResults = [
[-Infinity, RangeError],
[Symbol("foo"), TypeError],
[7n, TypeError],
[NaN, RangeError],
["string", RangeError],
[{}, RangeError],
];
badResults.forEach(([result, error]) => {
@ -32,11 +35,8 @@ const convertedResults = [
[7.1, 7],
[-7, -7],
[-0.1, 0],
[NaN, 0],
["string", 0],
["7", 7],
["7.5", 7],
[{}, 0],
[{valueOf() { return 7; }}, 7],
];