Temporal: Add missing Number checks in overflow-wrong-type.js.

This commit is contained in:
Ms2ger 2022-06-24 16:13:04 +02:00 committed by Philip Chimento
parent b458b9f0c2
commit 8123e8fc34
6 changed files with 6 additions and 2 deletions

View File

@ -44,6 +44,7 @@ assert.throws(RangeError, () => Temporal.PlainDateTime.from(propertyBag, { overf
assert.throws(RangeError, () => Temporal.PlainDateTime.from(propertyBag, { overflow: true }), "true");
assert.throws(RangeError, () => Temporal.PlainDateTime.from(propertyBag, { overflow: false }), "false");
assert.throws(TypeError, () => Temporal.PlainDateTime.from(propertyBag, { overflow: Symbol() }), "symbol");
assert.throws(RangeError, () => Temporal.PlainDateTime.from(propertyBag, { overflow: 2 }), "number");
assert.throws(RangeError, () => Temporal.PlainDateTime.from(propertyBag, { overflow: 2n }), "bigint");
assert.throws(RangeError, () => Temporal.PlainDateTime.from(propertyBag, { overflow: {} }), "plain object");

View File

@ -27,6 +27,7 @@ assert.throws(RangeError, () => datetime.with({ minute: 45 }, { overflow: null }
assert.throws(RangeError, () => datetime.with({ minute: 45 }, { overflow: true }), "true");
assert.throws(RangeError, () => datetime.with({ minute: 45 }, { overflow: false }), "false");
assert.throws(TypeError, () => datetime.with({ minute: 45 }, { overflow: Symbol() }), "symbol");
assert.throws(RangeError, () => datetime.with({ minute: 45 }, { overflow: 2 }), "number");
assert.throws(RangeError, () => datetime.with({ minute: 45 }, { overflow: 2n }), "bigint");
assert.throws(RangeError, () => datetime.with({ minute: 45 }, { overflow: {} }), "plain object");

View File

@ -29,7 +29,7 @@ assert.throws(RangeError, () => yearmonth.add(duration, { overflow: null }), "nu
assert.throws(RangeError, () => yearmonth.add(duration, { overflow: true }), "true");
assert.throws(RangeError, () => yearmonth.add(duration, { overflow: false }), "false");
assert.throws(TypeError, () => yearmonth.add(duration, { overflow: Symbol() }), "symbol");
assert.throws(RangeError, () => yearmonth.add(duration, { overflow: 2 }), "bigint");
assert.throws(RangeError, () => yearmonth.add(duration, { overflow: 2 }), "number");
assert.throws(RangeError, () => yearmonth.add(duration, { overflow: 2n }), "bigint");
assert.throws(RangeError, () => yearmonth.add(duration, { overflow: {} }), "plain object");

View File

@ -29,7 +29,7 @@ assert.throws(RangeError, () => yearmonth.subtract(duration, { overflow: null })
assert.throws(RangeError, () => yearmonth.subtract(duration, { overflow: true }), "true");
assert.throws(RangeError, () => yearmonth.subtract(duration, { overflow: false }), "false");
assert.throws(TypeError, () => yearmonth.subtract(duration, { overflow: Symbol() }), "symbol");
assert.throws(RangeError, () => yearmonth.subtract(duration, { overflow: 2 }), "bigint");
assert.throws(RangeError, () => yearmonth.subtract(duration, { overflow: 2 }), "number");
assert.throws(RangeError, () => yearmonth.subtract(duration, { overflow: 2n }), "bigint");
assert.throws(RangeError, () => yearmonth.subtract(duration, { overflow: {} }), "plain object");

View File

@ -46,6 +46,7 @@ assert.throws(RangeError, () => Temporal.ZonedDateTime.from(propertyBag, { overf
assert.throws(RangeError, () => Temporal.ZonedDateTime.from(propertyBag, { overflow: false }), "false");
assert.throws(TypeError, () => Temporal.ZonedDateTime.from(propertyBag, { overflow: Symbol() }), "symbol");
assert.throws(RangeError, () => Temporal.ZonedDateTime.from(propertyBag, { overflow: 2n }), "bigint");
assert.throws(RangeError, () => Temporal.ZonedDateTime.from(propertyBag, { overflow: 2 }), "number");
assert.throws(RangeError, () => Temporal.ZonedDateTime.from(propertyBag, { overflow: {} }), "plain object");
// toString property is read once by Calendar.dateFromFields() in the builtin

View File

@ -27,6 +27,7 @@ assert.throws(RangeError, () => datetime.with({ second: 41 }, { overflow: null }
assert.throws(RangeError, () => datetime.with({ second: 41 }, { overflow: true }), "true");
assert.throws(RangeError, () => datetime.with({ second: 41 }, { overflow: false }), "false");
assert.throws(TypeError, () => datetime.with({ second: 41 }, { overflow: Symbol() }), "symbol");
assert.throws(RangeError, () => datetime.with({ second: 41 }, { overflow: 2 }), "number");
assert.throws(RangeError, () => datetime.with({ second: 41 }, { overflow: 2n }), "bigint");
assert.throws(RangeError, () => datetime.with({ second: 41 }, { overflow: {} }), "plain object");