mirror of https://github.com/tc39/test262.git
Added tests for an empty or a function options object
This commit is contained in:
parent
bea421c1dc
commit
6fa1bb89a3
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.dateadd
|
||||
description: Empty or a function object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
const result1 = instance.dateAdd(new Temporal.PlainDate(1976, 11, 18), new Temporal.Duration(1), {});
|
||||
TemporalHelpers.assertPlainDate(
|
||||
result1, 1977, 11, "M11", 18,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.dateAdd(new Temporal.PlainDate(1976, 11, 18), new Temporal.Duration(1), () => {});
|
||||
TemporalHelpers.assertPlainDate(
|
||||
result2, 1977, 11, "M11", 18,
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.datefromfields
|
||||
description: Empty or a function object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
const result1 = instance.dateFromFields({ year: 1976, month: 11, day: 18 }, {});
|
||||
TemporalHelpers.assertPlainDate(
|
||||
result1, 1976, 11, "M11", 18,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.dateFromFields({ year: 1976, month: 11, day: 18 }, () => {});
|
||||
TemporalHelpers.assertPlainDate(
|
||||
result2, 1976, 11, "M11", 18,
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.dateuntil
|
||||
description: Empty or a function object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
const result1 = instance.dateUntil(new Temporal.PlainDate(1976, 11, 18), new Temporal.PlainDate(1984, 5, 31), {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result1, 0, 0, 0, 2751, 0, 0, 0, 0, 0, 0,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.dateUntil(new Temporal.PlainDate(1976, 11, 18), new Temporal.PlainDate(1984, 5, 31), () => {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result2, 0, 0, 0, 2751, 0, 0, 0, 0, 0, 0,
|
||||
"options may be a function object"
|
||||
);
|
23
test/built-ins/Temporal/Calendar/prototype/monthDayFromFields/options-object.js
vendored
Normal file
23
test/built-ins/Temporal/Calendar/prototype/monthDayFromFields/options-object.js
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.monthdayfromfields
|
||||
description: Empty or a function object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
const result1 = instance.monthDayFromFields({ monthCode: "M12", day: 15 }, {});
|
||||
TemporalHelpers.assertPlainMonthDay(
|
||||
result1, "M12", 15,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.monthDayFromFields({ monthCode: "M12", day: 15 }, () => {});
|
||||
TemporalHelpers.assertPlainMonthDay(
|
||||
result2, "M12", 15,
|
||||
"options may be a function object"
|
||||
);
|
23
test/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/options-object.js
vendored
Normal file
23
test/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/options-object.js
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.calendar.prototype.yearmonthfromfields
|
||||
description: Empty or a function object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.Calendar("iso8601");
|
||||
|
||||
const result1 = instance.yearMonthFromFields({ year: 2000, monthCode: "M05" }, {});
|
||||
TemporalHelpers.assertPlainYearMonth(
|
||||
result1, 2000, 5, "M05",
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.yearMonthFromFields({ year: 2000, monthCode: "M05" }, () => {});
|
||||
TemporalHelpers.assertPlainYearMonth(
|
||||
result2, 2000, 5, "M05",
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.duration.prototype.compare
|
||||
description: Empty object may be used as options
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
Temporal.Duration.compare({ hours: 1 }, { minutes: 60 }, {}), 0,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
Temporal.Duration.compare({ hours: 1 }, { minutes:60 }, () => {}), 0,
|
||||
"options may be an empty function object"
|
||||
);
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.duration.prototype.add
|
||||
description: Empty or a function object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.Duration(0, 0, 0, 0, 1);
|
||||
|
||||
const result1 = instance.add({ hours: 1 }, {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.add({ hours: 1 }, () => {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.duration.prototype.subtract
|
||||
description: Empty or a function object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.Duration(0, 0, 0, 0, 1);
|
||||
|
||||
const result1 = instance.subtract({ hours: 1 }, {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.subtract({ hours: 1 }, () => {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.duration.prototype.tostring
|
||||
description: Empty or a function object may be used as options
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.Duration(0, 0, 0, 0, 1);
|
||||
|
||||
const result1 = instance.toString({});
|
||||
assert.sameValue(
|
||||
result1, "PT1H",
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.toString(() => {});
|
||||
assert.sameValue(
|
||||
result2, "PT1H",
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.instant.prototype.since
|
||||
description: Empty or a function object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.Instant(0n);
|
||||
|
||||
const result1 = instance.since(new Temporal.Instant(3600_000_000_000n), {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result1, 0, 0, 0, 0, 0, 0, -3600, 0, 0, 0,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.since(new Temporal.Instant(3600_000_000_000n), () => {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result2, 0, 0, 0, 0, 0, 0, -3600, 0, 0, 0,
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.instant.prototype.tostring
|
||||
description: Empty or a function object may be used as options
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.Instant(0n);
|
||||
|
||||
const result1 = instance.toString({});
|
||||
assert.sameValue(
|
||||
result1, "1970-01-01T00:00:00Z",
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.toString(() => {});
|
||||
assert.sameValue(
|
||||
result2, "1970-01-01T00:00:00Z",
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.instant.prototype.until
|
||||
description: Empty or a function object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.Instant(0n);
|
||||
|
||||
const result1 = instance.until(new Temporal.Instant(3600_000_000_000n), {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result1, 0, 0, 0, 0, 0, 0, 3600, 0, 0, 0,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.until(new Temporal.Instant(3600_000_000_000n), () => {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result2, 0, 0, 0, 0, 0, 0, 3600, 0, 0, 0,
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindate.prototype.from
|
||||
description: Empty object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
Temporal.PlainDate.from({ year: 1976, month: 11, day: 18 }, {}), 1976, 11, "M11", 18,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
TemporalHelpers.assertPlainDate(
|
||||
Temporal.PlainDate.from({ year: 1976, month: 11, day: 18 }, () => {}), 1976, 11, "M11", 18,
|
||||
"options may be an empty function object"
|
||||
);
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindate.prototype.add
|
||||
description: Empty or a function object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
|
||||
const result1 = instance.add({ months: 1 }, {});
|
||||
TemporalHelpers.assertPlainDate(
|
||||
result1, 2000, 6, "M06", 2,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.add({ months: 1 }, () => {});
|
||||
TemporalHelpers.assertPlainDate(
|
||||
result2, 2000, 6, "M06", 2,
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindate.prototype.since
|
||||
description: Empty or a function object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
|
||||
const result1 = instance.since(new Temporal.PlainDate(1976, 11, 18), {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result1, 0, 0, 0, 8566, 0, 0, 0, 0, 0, 0,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.since(new Temporal.PlainDate(1976, 11, 18), () => {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result2, 0, 0, 0, 8566, 0, 0, 0, 0, 0, 0,
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindate.prototype.subtract
|
||||
description: Empty or a function object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
|
||||
const result1 = instance.subtract({ months: 1 }, {});
|
||||
TemporalHelpers.assertPlainDate(
|
||||
result1, 2000, 4, "M04", 2,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.subtract({ months: 1 }, () => {});
|
||||
TemporalHelpers.assertPlainDate(
|
||||
result2, 2000, 4, "M04", 2,
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindate.prototype.tostring
|
||||
description: Empty or a function object may be used as options
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
|
||||
const result1 = instance.toString({});
|
||||
assert.sameValue(
|
||||
result1, "2000-05-02",
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.toString(() => {});
|
||||
assert.sameValue(
|
||||
result2, "2000-05-02",
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindate.prototype.until
|
||||
description: Empty or a function object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
|
||||
const result1 = instance.until(new Temporal.PlainDate(1976, 11, 18), {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result1, 0, 0, 0, -8566, 0, 0, 0, 0, 0, 0,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.until(new Temporal.PlainDate(1976, 11, 18), () => {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result2, 0, 0, 0, -8566, 0, 0, 0, 0, 0, 0,
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindate.prototype.with
|
||||
description: Empty or a function object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
|
||||
const result1 = instance.with({ day: 5 }, {});
|
||||
TemporalHelpers.assertPlainDate(
|
||||
result1, 2000, 5, "M05", 5,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.with({ day: 5 }, () => {});
|
||||
TemporalHelpers.assertPlainDate(
|
||||
result2, 2000, 5, "M05", 5,
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindatetime.prototype.from
|
||||
description: Empty object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
TemporalHelpers.assertPlainDateTime(
|
||||
Temporal.PlainDateTime.from({ year: 1976, month: 11, day: 18 }, {}), 1976, 11, "M11", 18, 0, 0, 0, 0, 0, 0,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
TemporalHelpers.assertPlainDateTime(
|
||||
Temporal.PlainDateTime.from({ year: 1976, month: 11, day: 18 }, () => {}), 1976, 11, "M11", 18, 0, 0, 0, 0, 0, 0,
|
||||
"options may be an empty function object"
|
||||
);
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindatetime.prototype.tostring
|
||||
description: Empty or a function object may be used as options
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2);
|
||||
|
||||
const result1 = instance.toString({});
|
||||
assert.sameValue(
|
||||
result1, "2000-05-02T00:00:00",
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.toString(() => {});
|
||||
assert.sameValue(
|
||||
result2, "2000-05-02T00:00:00",
|
||||
"options may be a function object"
|
||||
);
|
|
@ -2,21 +2,21 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindate.prototype.tozoneddatetime
|
||||
description: Empty object may be used as options
|
||||
esid: sec-temporal.plaindatetime.prototype.tozoneddatetime
|
||||
description: Empty or a function object may be used as options
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const dt = new Temporal.PlainDateTime(2019, 10, 29, 10, 46, 38, 271, 986, 102);
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2);
|
||||
|
||||
const result1 = instance.toZonedDateTime("UTC", {});
|
||||
assert.sameValue(
|
||||
dt.toZonedDateTime("UTC", {}).epochNanoseconds,
|
||||
1572345998271986102n,
|
||||
result1.epochNanoseconds, 957225600000000000n,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.toZonedDateTime("UTC", () => {});
|
||||
assert.sameValue(
|
||||
dt.toZonedDateTime("UTC", () => {}).epochNanoseconds,
|
||||
1572345998271986102n,
|
||||
result2.epochNanoseconds, 957225600000000000n,
|
||||
"options may be a function object"
|
||||
);
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainmonthday.prototype.from
|
||||
description: Empty object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
TemporalHelpers.assertPlainMonthDay(
|
||||
Temporal.PlainMonthDay.from({ monthCode: "M12", day: 15 }, {}), "M12", 15,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
TemporalHelpers.assertPlainMonthDay(
|
||||
Temporal.PlainMonthDay.from({ monthCode: "M12", day: 15 }, () => {}), "M12", 15,
|
||||
"options may be an empty function object"
|
||||
);
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainmonthday.prototype.tostring
|
||||
description: Empty or a function object may be used as options
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainMonthDay(5, 2);
|
||||
|
||||
const result1 = instance.toString({});
|
||||
assert.sameValue(
|
||||
result1, "05-02",
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.toString(() => {});
|
||||
assert.sameValue(
|
||||
result2, "05-02",
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainmonthday.prototype.with
|
||||
description: Empty or a function object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainMonthDay(5, 2);
|
||||
|
||||
const result1 = instance.with({ day: 5 }, {});
|
||||
TemporalHelpers.assertPlainMonthDay(
|
||||
result1, "M05", 5,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.with({ day: 5 }, () => {});
|
||||
TemporalHelpers.assertPlainMonthDay(
|
||||
result2, "M05", 5,
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaintime.prototype.from
|
||||
description: Empty object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
TemporalHelpers.assertPlainTime(
|
||||
Temporal.PlainTime.from({ hour: 12, minute: 34 }, {}), 12, 34, 0, 0, 0, 0,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
TemporalHelpers.assertPlainTime(
|
||||
Temporal.PlainTime.from({ hour: 12, minute: 34 }, () => {}), 12, 34, 0, 0, 0, 0,
|
||||
"options may be an empty function object"
|
||||
);
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 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: Empty or a function object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainTime();
|
||||
|
||||
const result1 = instance.since(new Temporal.PlainTime(12, 34, 56), {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result1, 0, 0, 0, 0, -12, -34, -56, 0, 0, 0,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.since(new Temporal.PlainTime(12, 34, 56), () => {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result2, 0, 0, 0, 0, -12, -34, -56, 0, 0, 0,
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaintime.prototype.tostring
|
||||
description: Empty or a function object may be used as options
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainTime();
|
||||
|
||||
const result1 = instance.toString({});
|
||||
assert.sameValue(
|
||||
result1, "00:00:00",
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.toString(() => {});
|
||||
assert.sameValue(
|
||||
result2, "00:00:00",
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 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: Empty or a function object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainTime();
|
||||
|
||||
const result1 = instance.until(new Temporal.PlainTime(12, 34, 56), {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result1, 0, 0, 0, 0, 12, 34, 56, 0, 0, 0,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.until(new Temporal.PlainTime(12, 34, 56), () => {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result2, 0, 0, 0, 0, 12, 34, 56, 0, 0, 0,
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaintime.prototype.with
|
||||
description: Empty or a function object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainTime();
|
||||
|
||||
const result1 = instance.with({ minute: 45 }, {});
|
||||
TemporalHelpers.assertPlainTime(
|
||||
result1, 0, 45, 0, 0, 0, 0,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.with({ minute: 45 }, () => {});
|
||||
TemporalHelpers.assertPlainTime(
|
||||
result2, 0, 45, 0, 0, 0, 0,
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainyearmonth.prototype.from
|
||||
description: Empty object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
TemporalHelpers.assertPlainYearMonth(
|
||||
Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M01" }, {}), 2021, 1, "M01",
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
TemporalHelpers.assertPlainYearMonth(
|
||||
Temporal.PlainYearMonth.from({ year: 2021, monthCode: "M01" }, () => {}), 2021, 1, "M01",
|
||||
"options may be an empty function object"
|
||||
);
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainyearmonth.prototype.add
|
||||
description: Empty or a function object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainYearMonth(2019, 10);
|
||||
|
||||
const result1 = instance.add({ months: 1 }, {});
|
||||
TemporalHelpers.assertPlainYearMonth(
|
||||
result1, 2019, 11, "M11",
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.add({ months: 1 }, () => {});
|
||||
TemporalHelpers.assertPlainYearMonth(
|
||||
result2, 2019, 11, "M11",
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainyearmonth.prototype.since
|
||||
description: Empty or a function object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainYearMonth(2019, 10);
|
||||
|
||||
const result1 = instance.since(new Temporal.PlainYearMonth(1976, 11), {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result1, 42, 11, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.since(new Temporal.PlainYearMonth(1976, 11), () => {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result2, 42, 11, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainyearmonth.prototype.subtract
|
||||
description: Empty or a function object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainYearMonth(2019, 10);
|
||||
|
||||
const result1 = instance.subtract({ months: 1 }, {});
|
||||
TemporalHelpers.assertPlainYearMonth(
|
||||
result1, 2019, 9, "M09",
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.subtract({ months: 1 }, () => {});
|
||||
TemporalHelpers.assertPlainYearMonth(
|
||||
result2, 2019, 9, "M09",
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainyearmonth.prototype.tostring
|
||||
description: Empty or a function object may be used as options
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainYearMonth(2019, 10);
|
||||
|
||||
const result1 = instance.toString({});
|
||||
assert.sameValue(
|
||||
result1, "2019-10",
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.toString(() => {});
|
||||
assert.sameValue(
|
||||
result2, "2019-10",
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainyearmonth.prototype.until
|
||||
description: Empty or a function object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainYearMonth(2019, 10);
|
||||
|
||||
const result1 = instance.until(new Temporal.PlainYearMonth(1976, 11), {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result1, -42, -11, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.until(new Temporal.PlainYearMonth(1976, 11), () => {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result2, -42, -11, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainyearmonth.prototype.with
|
||||
description: Empty or a function object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainYearMonth(2019, 10);
|
||||
|
||||
const result1 = instance.with({ year: 2020 }, {});
|
||||
TemporalHelpers.assertPlainYearMonth(
|
||||
result1, 2020, 10, "M10",
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.with({ year: 2020 }, () => {});
|
||||
TemporalHelpers.assertPlainYearMonth(
|
||||
result2, 2020, 10, "M10",
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.timezone.prototype.getinstantfor
|
||||
description: Empty or a function object may be used as options
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.TimeZone("UTC");
|
||||
|
||||
const result1 = instance.getInstantFor(new Temporal.PlainDateTime(2019, 10, 29, 10, 46, 38), {});
|
||||
assert.sameValue(
|
||||
result1.epochNanoseconds, 1572345998000000000n,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.getInstantFor(new Temporal.PlainDateTime(2019, 10, 29, 10, 46, 38), () => {});
|
||||
assert.sameValue(
|
||||
result2.epochNanoseconds, 1572345998000000000n,
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.from
|
||||
description: Empty object may be used as options
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
Temporal.ZonedDateTime.from({ year: 1976, month: 11, day: 18, timeZone: "UTC" }, {}).epochNanoseconds, 217123200000000000n, "UTC",
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
Temporal.ZonedDateTime.from({ year: 1976, month: 11, day: 18, timeZone: "UTC" }, () => {}).epochNanoseconds, 217123200000000000n, "UTC",
|
||||
"options may be an empty function object"
|
||||
);
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.add
|
||||
description: Empty or a function object may be used as options
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.ZonedDateTime(0n, "UTC");
|
||||
|
||||
const result1 = instance.add({ years: 1 }, {});
|
||||
assert.sameValue(
|
||||
result1.epochNanoseconds, 31536000000000000n, "UTC",
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.add({ years: 1 }, () => {});
|
||||
assert.sameValue(
|
||||
result2.epochNanoseconds, 31536000000000000n, "UTC",
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.since
|
||||
description: Empty or a function object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.ZonedDateTime(0n, "UTC");
|
||||
|
||||
const result1 = instance.since(new Temporal.ZonedDateTime(3600_000_000_000n, "UTC"), {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.since(new Temporal.ZonedDateTime(3600_000_000_000n, "UTC"), () => {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result2, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0,
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.subtract
|
||||
description: Empty or a function object may be used as options
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.ZonedDateTime(0n, "UTC");
|
||||
|
||||
const result1 = instance.subtract({ years: 1 }, {});
|
||||
assert.sameValue(
|
||||
result1.epochNanoseconds, -31536000000000000n, "UTC",
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.subtract({ years: 1 }, () => {});
|
||||
assert.sameValue(
|
||||
result2.epochNanoseconds, -31536000000000000n, "UTC",
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.tostring
|
||||
description: Empty or a function object may be used as options
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.ZonedDateTime(0n, "UTC");
|
||||
|
||||
const result1 = instance.toString({});
|
||||
assert.sameValue(
|
||||
result1, "1970-01-01T00:00:00+00:00[UTC]",
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.toString(() => {});
|
||||
assert.sameValue(
|
||||
result2, "1970-01-01T00:00:00+00:00[UTC]",
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.until
|
||||
description: Empty or a function object may be used as options
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.ZonedDateTime(0n, "UTC");
|
||||
|
||||
const result1 = instance.until(new Temporal.ZonedDateTime(3600_000_000_000n, "UTC"), {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.until(new Temporal.ZonedDateTime(3600_000_000_000n, "UTC"), () => {});
|
||||
TemporalHelpers.assertDuration(
|
||||
result2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
|
||||
"options may be a function object"
|
||||
);
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.with
|
||||
description: Empty or a function object may be used as options
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.ZonedDateTime(0n, "UTC");
|
||||
|
||||
const result1 = instance.with({ day: 5 }, {});
|
||||
assert.sameValue(
|
||||
result1.epochNanoseconds, 345600000000000n, "UTC",
|
||||
"options may be an empty plain object"
|
||||
);
|
||||
|
||||
const result2 = instance.with({ day: 5 }, () => {});
|
||||
assert.sameValue(
|
||||
result2.epochNanoseconds, 345600000000000n, "UTC",
|
||||
"options may be a function object"
|
||||
);
|
Loading…
Reference in New Issue