mirror of https://github.com/tc39/test262.git
Add missing tests for PlainTime property bag with no time units
We already had similar tests to these for other methods, such as Temporal.PlainTime.prototype.equals(). since() and until() should have these tests too. Update assertion messages in all of the existing tests as well, as per Ms2ger's review comment.
This commit is contained in:
parent
15ed94c891
commit
7b3c176629
|
@ -11,7 +11,7 @@ features: [Temporal]
|
|||
const instance = new Temporal.PlainDate(2000, 1, 1);
|
||||
|
||||
const props = {};
|
||||
assert.throws(TypeError, () => instance.toPlainDateTime(props), "TypeError if at least one property is not present");
|
||||
assert.throws(TypeError, () => instance.toPlainDateTime(props), "TypeError if no properties are present");
|
||||
|
||||
props.minute = 30;
|
||||
const result = instance.toPlainDateTime(props);
|
||||
|
|
|
@ -10,7 +10,7 @@ features: [Temporal]
|
|||
const instance = new Temporal.PlainDate(2000, 1, 1);
|
||||
|
||||
const props = {};
|
||||
assert.throws(TypeError, () => instance.toZonedDateTime({ plainTime: props, timeZone: "UTC" }), "TypeError if at least one property is not present");
|
||||
assert.throws(TypeError, () => instance.toZonedDateTime({ plainTime: props, timeZone: "UTC" }), "TypeError if no properties are present");
|
||||
|
||||
props.minute = 30;
|
||||
const result = instance.toZonedDateTime({ plainTime: props, timeZone: "UTC" });
|
||||
|
|
|
@ -11,7 +11,7 @@ features: [Temporal]
|
|||
const instance = new Temporal.PlainDateTime(2000, 1, 1, 12, 30, 45, 123, 456, 789);
|
||||
|
||||
const props = {};
|
||||
assert.throws(TypeError, () => instance.withPlainTime(props), "TypeError if at least one property is not present");
|
||||
assert.throws(TypeError, () => instance.withPlainTime(props), "TypeError if no properties are present");
|
||||
|
||||
props.minute = 30;
|
||||
const result = instance.withPlainTime(props);
|
||||
|
|
|
@ -8,7 +8,7 @@ features: [Temporal]
|
|||
---*/
|
||||
|
||||
const props = {};
|
||||
assert.throws(TypeError, () => Temporal.PlainTime.compare(props, new Temporal.PlainTime(0, 30)), "TypeError if at least one property is not present");
|
||||
assert.throws(TypeError, () => Temporal.PlainTime.compare(props, new Temporal.PlainTime(0, 30)), "TypeError if no properties are present");
|
||||
|
||||
props.minute = 30;
|
||||
const result = Temporal.PlainTime.compare(props, new Temporal.PlainTime(0, 30));
|
||||
|
|
|
@ -10,7 +10,7 @@ features: [Temporal]
|
|||
const instance = new Temporal.PlainTime(0, 30, 0, 0, 0, 0);
|
||||
|
||||
const props = {};
|
||||
assert.throws(TypeError, () => instance.equals(props), "TypeError if at least one property is not present");
|
||||
assert.throws(TypeError, () => instance.equals(props), "TypeError if no properties are present");
|
||||
|
||||
props.minute = 30;
|
||||
const result = instance.equals(props);
|
||||
|
|
18
test/built-ins/Temporal/PlainTime/prototype/since/plaintime-propertybag-no-time-units.js
vendored
Normal file
18
test/built-ins/Temporal/PlainTime/prototype/since/plaintime-propertybag-no-time-units.js
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaintime.prototype.since
|
||||
description: Missing time units in property bag default to 0
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainTime(1, 0, 0, 0, 0, 1);
|
||||
|
||||
const props = {};
|
||||
assert.throws(TypeError, () => instance.since(props), "TypeError if no properties are present");
|
||||
|
||||
props.minute = 30;
|
||||
const result = instance.since(props);
|
||||
TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 30, 0, 0, 0, 1, "missing time units default to 0");
|
18
test/built-ins/Temporal/PlainTime/prototype/until/plaintime-propertybag-no-time-units.js
vendored
Normal file
18
test/built-ins/Temporal/PlainTime/prototype/until/plaintime-propertybag-no-time-units.js
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaintime.prototype.until
|
||||
description: Missing time units in property bag default to 0
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainTime(1, 0, 0, 0, 0, 1);
|
||||
|
||||
const props = {};
|
||||
assert.throws(TypeError, () => instance.until(props), "TypeError if no properties are present");
|
||||
|
||||
props.minute = 30;
|
||||
const result = instance.until(props);
|
||||
TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, -30, 0, 0, 0, -1, "missing time units default to 0");
|
|
@ -10,7 +10,7 @@ features: [Temporal]
|
|||
const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
||||
|
||||
const props = {};
|
||||
assert.throws(TypeError, () => instance.withPlainTime(props), "TypeError if at least one property is not present");
|
||||
assert.throws(TypeError, () => instance.withPlainTime(props), "TypeError if no properties are present");
|
||||
|
||||
props.minute = 30;
|
||||
const result = instance.withPlainTime(props);
|
||||
|
|
Loading…
Reference in New Issue