diff --git a/test/built-ins/Temporal/Duration/compare/blank-duration.js b/test/built-ins/Temporal/Duration/compare/blank-duration.js new file mode 100644 index 0000000000..01a8a6ec5e --- /dev/null +++ b/test/built-ins/Temporal/Duration/compare/blank-duration.js @@ -0,0 +1,20 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.duration.compare +description: Behaviour with blank durations +features: [Temporal] +---*/ + +const blank1 = new Temporal.Duration(); +const blank2 = new Temporal.Duration(); +const { compare } = Temporal.Duration; +const plainRelativeTo = new Temporal.PlainDate(2025, 8, 22); +const zonedRelativeTo = new Temporal.ZonedDateTime(1n, "UTC"); + +assert.sameValue(compare(blank1, blank2), 0, "zero durations compared without relativeTo"); +assert.sameValue(compare(blank1, blank2, { relativeTo: plainRelativeTo }), 0, + "zero durations compared with PlainDate relativeTo"); +assert.sameValue(compare(blank1, blank2, { relativeTo: zonedRelativeTo }), 0, + "zero durations compared with ZonedDateTime relativeTo"); diff --git a/test/built-ins/Temporal/Duration/from/blank-duration.js b/test/built-ins/Temporal/Duration/from/blank-duration.js new file mode 100644 index 0000000000..2271655b33 --- /dev/null +++ b/test/built-ins/Temporal/Duration/from/blank-duration.js @@ -0,0 +1,13 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.duration.from +description: Behaviour with blank duration +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const blank = new Temporal.Duration(); +const result = Temporal.Duration.from(blank); +TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "result is also blank"); diff --git a/test/built-ins/Temporal/Duration/prototype/abs/basic.js b/test/built-ins/Temporal/Duration/prototype/abs/basic.js index ecc2ecf18a..eecf383061 100644 --- a/test/built-ins/Temporal/Duration/prototype/abs/basic.js +++ b/test/built-ins/Temporal/Duration/prototype/abs/basic.js @@ -15,7 +15,7 @@ includes: [temporalHelpers.js] let d1 = new Temporal.Duration(); TemporalHelpers.assertDuration( - d1.abs(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "empty"); + d1.abs(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "blank"); let d2 = new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); TemporalHelpers.assertDuration( diff --git a/test/built-ins/Temporal/Duration/prototype/add/blank-duration.js b/test/built-ins/Temporal/Duration/prototype/add/blank-duration.js new file mode 100644 index 0000000000..b8b0f36d63 --- /dev/null +++ b/test/built-ins/Temporal/Duration/prototype/add/blank-duration.js @@ -0,0 +1,16 @@ +// Copyright (C) 2025 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: Behaviour with blank duration +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const blank1 = new Temporal.Duration(); +const blank2 = new Temporal.Duration(); + +const result = blank1.add(blank2); + +TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "result is also blank"); diff --git a/test/built-ins/Temporal/Duration/prototype/blank/basic.js b/test/built-ins/Temporal/Duration/prototype/blank/basic.js index 10a594cb24..11b3197f72 100644 --- a/test/built-ins/Temporal/Duration/prototype/blank/basic.js +++ b/test/built-ins/Temporal/Duration/prototype/blank/basic.js @@ -23,3 +23,4 @@ const zero = Temporal.Duration.from({ nanoseconds: 0 }); assert.sameValue(zero.blank, true); +assert(new Temporal.Duration().blank, "created via constructor"); diff --git a/test/built-ins/Temporal/Duration/prototype/days/blank-duration.js b/test/built-ins/Temporal/Duration/prototype/days/blank-duration.js new file mode 100644 index 0000000000..45f4c87b38 --- /dev/null +++ b/test/built-ins/Temporal/Duration/prototype/days/blank-duration.js @@ -0,0 +1,11 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-get-temporal.duration.prototype.days +description: Behaviour with blank duration +features: [Temporal] +---*/ + +const blank = new Temporal.Duration(); +assert.sameValue(blank.days, 0); diff --git a/test/built-ins/Temporal/Duration/prototype/hours/blank-duration.js b/test/built-ins/Temporal/Duration/prototype/hours/blank-duration.js new file mode 100644 index 0000000000..5ba68e8bc8 --- /dev/null +++ b/test/built-ins/Temporal/Duration/prototype/hours/blank-duration.js @@ -0,0 +1,11 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-get-temporal.duration.prototype.hours +description: Behaviour with blank duration +features: [Temporal] +---*/ + +const blank = new Temporal.Duration(); +assert.sameValue(blank.hours, 0); diff --git a/test/built-ins/Temporal/Duration/prototype/microseconds/blank-duration.js b/test/built-ins/Temporal/Duration/prototype/microseconds/blank-duration.js new file mode 100644 index 0000000000..3f0d72a82b --- /dev/null +++ b/test/built-ins/Temporal/Duration/prototype/microseconds/blank-duration.js @@ -0,0 +1,11 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-get-temporal.duration.prototype.microseconds +description: Behaviour with blank duration +features: [Temporal] +---*/ + +const blank = new Temporal.Duration(); +assert.sameValue(blank.microseconds, 0); diff --git a/test/built-ins/Temporal/Duration/prototype/milliseconds/blank-duration.js b/test/built-ins/Temporal/Duration/prototype/milliseconds/blank-duration.js new file mode 100644 index 0000000000..75f8fc2c0c --- /dev/null +++ b/test/built-ins/Temporal/Duration/prototype/milliseconds/blank-duration.js @@ -0,0 +1,11 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-get-temporal.duration.prototype.milliseconds +description: Behaviour with blank duration +features: [Temporal] +---*/ + +const blank = new Temporal.Duration(); +assert.sameValue(blank.milliseconds, 0); diff --git a/test/built-ins/Temporal/Duration/prototype/minutes/blank-duration.js b/test/built-ins/Temporal/Duration/prototype/minutes/blank-duration.js new file mode 100644 index 0000000000..51192e7bcb --- /dev/null +++ b/test/built-ins/Temporal/Duration/prototype/minutes/blank-duration.js @@ -0,0 +1,11 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-get-temporal.duration.prototype.minutes +description: Behaviour with blank duration +features: [Temporal] +---*/ + +const blank = new Temporal.Duration(); +assert.sameValue(blank.minutes, 0); diff --git a/test/built-ins/Temporal/Duration/prototype/months/blank-duration.js b/test/built-ins/Temporal/Duration/prototype/months/blank-duration.js new file mode 100644 index 0000000000..eed0c260a9 --- /dev/null +++ b/test/built-ins/Temporal/Duration/prototype/months/blank-duration.js @@ -0,0 +1,11 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-get-temporal.duration.prototype.months +description: Behaviour with blank duration +features: [Temporal] +---*/ + +const blank = new Temporal.Duration(); +assert.sameValue(blank.months, 0); diff --git a/test/built-ins/Temporal/Duration/prototype/nanoseconds/blank-duration.js b/test/built-ins/Temporal/Duration/prototype/nanoseconds/blank-duration.js new file mode 100644 index 0000000000..f4e213fa68 --- /dev/null +++ b/test/built-ins/Temporal/Duration/prototype/nanoseconds/blank-duration.js @@ -0,0 +1,11 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-get-temporal.duration.prototype.nanoseconds +description: Behaviour with blank duration +features: [Temporal] +---*/ + +const blank = new Temporal.Duration(); +assert.sameValue(blank.nanoseconds, 0); diff --git a/test/built-ins/Temporal/Duration/prototype/negated/basic.js b/test/built-ins/Temporal/Duration/prototype/negated/basic.js index f2bae4848a..f2fc4de1aa 100644 --- a/test/built-ins/Temporal/Duration/prototype/negated/basic.js +++ b/test/built-ins/Temporal/Duration/prototype/negated/basic.js @@ -13,7 +13,7 @@ includes: [temporalHelpers.js] let d1 = new Temporal.Duration(); TemporalHelpers.assertDuration( d1.negated(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - "zeros"); + "blank"); let d2 = new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); TemporalHelpers.assertDuration( diff --git a/test/built-ins/Temporal/Duration/prototype/round/blank-duration.js b/test/built-ins/Temporal/Duration/prototype/round/blank-duration.js new file mode 100644 index 0000000000..45ac16556b --- /dev/null +++ b/test/built-ins/Temporal/Duration/prototype/round/blank-duration.js @@ -0,0 +1,32 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.duration.prototype.round +description: Behaviour with blank duration +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const blank = new Temporal.Duration(); +const plainRelativeTo = new Temporal.PlainDate(2025, 8, 22); +const zonedRelativeTo = new Temporal.ZonedDateTime(1n, "UTC"); + +for (const smallestUnit of ['days', 'hours', 'minutes', 'seconds', 'milliseconds', 'microseconds', 'nanoseconds']) { + let result = blank.round(smallestUnit); + TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `round to ${smallestUnit} without relativeTo`); + + result = blank.round({ smallestUnit, relativeTo: plainRelativeTo }); + TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `round to ${smallestUnit} with PlainDate relativeTo`); + + result = blank.round({ smallestUnit, relativeTo: zonedRelativeTo }); + TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `round to ${smallestUnit} with ZonedDateTime relativeTo`); +} + +for (const smallestUnit of ['years', 'months', 'weeks']) { + let result = blank.round({ smallestUnit, relativeTo: plainRelativeTo }); + TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `round to ${smallestUnit} with PlainDate relativeTo`); + + result = blank.round({ smallestUnit, relativeTo: zonedRelativeTo }); + TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `round to ${smallestUnit} with ZonedDateTime relativeTo`); +} diff --git a/test/built-ins/Temporal/Duration/prototype/seconds/blank-duration.js b/test/built-ins/Temporal/Duration/prototype/seconds/blank-duration.js new file mode 100644 index 0000000000..310820c76f --- /dev/null +++ b/test/built-ins/Temporal/Duration/prototype/seconds/blank-duration.js @@ -0,0 +1,11 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-get-temporal.duration.prototype.seconds +description: Behaviour with blank duration +features: [Temporal] +---*/ + +const blank = new Temporal.Duration(); +assert.sameValue(blank.seconds, 0); diff --git a/test/built-ins/Temporal/Duration/prototype/sign/blank-duration.js b/test/built-ins/Temporal/Duration/prototype/sign/blank-duration.js new file mode 100644 index 0000000000..c0d18b8f30 --- /dev/null +++ b/test/built-ins/Temporal/Duration/prototype/sign/blank-duration.js @@ -0,0 +1,12 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-get-temporal.duration.prototype.sign +description: Behaviour with blank duration +features: [Temporal] +---*/ + +const blank = new Temporal.Duration(); +assert.sameValue(blank.sign, 0); + diff --git a/test/built-ins/Temporal/Duration/prototype/subtract/blank-duration.js b/test/built-ins/Temporal/Duration/prototype/subtract/blank-duration.js new file mode 100644 index 0000000000..f07a4e6af5 --- /dev/null +++ b/test/built-ins/Temporal/Duration/prototype/subtract/blank-duration.js @@ -0,0 +1,16 @@ +// Copyright (C) 2025 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: Behaviour with blank duration +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const blank1 = new Temporal.Duration(); +const blank2 = new Temporal.Duration(); + +const result = blank1.subtract(blank2); + +TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "result is also blank"); diff --git a/test/built-ins/Temporal/Duration/prototype/toJSON/basic.js b/test/built-ins/Temporal/Duration/prototype/toJSON/basic.js index 8cadc51661..491c841aaa 100644 --- a/test/built-ins/Temporal/Duration/prototype/toJSON/basic.js +++ b/test/built-ins/Temporal/Duration/prototype/toJSON/basic.js @@ -12,7 +12,7 @@ features: [Temporal] ---*/ let d = new Temporal.Duration(); -assert.sameValue(d.toJSON(), "PT0S", "zero duration"); +assert.sameValue(d.toJSON(), "PT0S", "blank duration"); d = new Temporal.Duration(1); assert.sameValue(d.toJSON(), "P1Y", "positive small years"); diff --git a/test/built-ins/Temporal/Duration/prototype/total/blank-duration.js b/test/built-ins/Temporal/Duration/prototype/total/blank-duration.js new file mode 100644 index 0000000000..0d2c0d75fd --- /dev/null +++ b/test/built-ins/Temporal/Duration/prototype/total/blank-duration.js @@ -0,0 +1,31 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.duration.prototype.total +description: Behaviour with blank duration +features: [Temporal] +---*/ + +const blank = new Temporal.Duration(); +const plainRelativeTo = new Temporal.PlainDate(2025, 8, 22); +const zonedRelativeTo = new Temporal.ZonedDateTime(1n, "UTC"); + +for (const unit of ['days', 'hours', 'minutes', 'seconds', 'milliseconds', 'microseconds', 'nanoseconds']) { + let result = blank.total(unit); + assert.sameValue(result, 0, `total of ${unit} without relativeTo`); + + result = blank.total({ unit, relativeTo: plainRelativeTo }); + assert.sameValue(result, 0, `total of ${unit} with PlainDate relativeTo`); + + result = blank.total({ unit, relativeTo: zonedRelativeTo }); + assert.sameValue(result, 0, `total of ${unit} with ZonedDateTime relativeTo`); +} + +for (const unit of ['years', 'months', 'weeks']) { + let result = blank.total({ unit, relativeTo: plainRelativeTo }); + assert.sameValue(result, 0, `total of ${unit} with PlainDate relativeTo`); + + result = blank.total({ unit, relativeTo: zonedRelativeTo }); + assert.sameValue(result, 0, `total of ${unit} with ZonedDateTime relativeTo`); +} diff --git a/test/built-ins/Temporal/Duration/prototype/weeks/blank-duration.js b/test/built-ins/Temporal/Duration/prototype/weeks/blank-duration.js new file mode 100644 index 0000000000..c4f6a23e2c --- /dev/null +++ b/test/built-ins/Temporal/Duration/prototype/weeks/blank-duration.js @@ -0,0 +1,11 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-get-temporal.duration.prototype.weeks +description: Behaviour with blank duration +features: [Temporal] +---*/ + +const blank = new Temporal.Duration(); +assert.sameValue(blank.weeks, 0); diff --git a/test/built-ins/Temporal/Duration/prototype/with/blank-duration.js b/test/built-ins/Temporal/Duration/prototype/with/blank-duration.js new file mode 100644 index 0000000000..7bdf09e43f --- /dev/null +++ b/test/built-ins/Temporal/Duration/prototype/with/blank-duration.js @@ -0,0 +1,34 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.duration.prototype.with +description: Behaviour with blank duration +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const blank = new Temporal.Duration(); + +for (const val of [-1, 0, 1]) { + let result = blank.with({ years: val }); + TemporalHelpers.assertDuration(result, val, 0, 0, 0, 0, 0, 0, 0, 0, 0, `with years ${val}`); + result = blank.with({ months: val }); + TemporalHelpers.assertDuration(result, 0, val, 0, 0, 0, 0, 0, 0, 0, 0, `with months ${val}`); + result = blank.with({ weeks: val }); + TemporalHelpers.assertDuration(result, 0, 0, val, 0, 0, 0, 0, 0, 0, 0, `with weeks ${val}`); + result = blank.with({ days: val }); + TemporalHelpers.assertDuration(result, 0, 0, 0, val, 0, 0, 0, 0, 0, 0, `with days ${val}`); + result = blank.with({ hours: val }); + TemporalHelpers.assertDuration(result, 0, 0, 0, 0, val, 0, 0, 0, 0, 0, `with hours ${val}`); + result = blank.with({ minutes: val }); + TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, val, 0, 0, 0, 0, `with minutes ${val}`); + result = blank.with({ seconds: val }); + TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, val, 0, 0, 0, `with seconds ${val}`); + result = blank.with({ milliseconds: val }); + TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, val, 0, 0, `with milliseconds ${val}`); + result = blank.with({ microseconds: val }); + TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, val, 0, `with microseconds ${val}`); + result = blank.with({ nanoseconds: val }); + TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, val, `with nanoseconds ${val}`); +} diff --git a/test/built-ins/Temporal/Duration/prototype/years/blank-duration.js b/test/built-ins/Temporal/Duration/prototype/years/blank-duration.js new file mode 100644 index 0000000000..f0890359ec --- /dev/null +++ b/test/built-ins/Temporal/Duration/prototype/years/blank-duration.js @@ -0,0 +1,11 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-get-temporal.duration.prototype.years +description: Behaviour with blank duration +features: [Temporal] +---*/ + +const blank = new Temporal.Duration(); +assert.sameValue(blank.years, 0); diff --git a/test/built-ins/Temporal/Instant/prototype/add/blank-duration.js b/test/built-ins/Temporal/Instant/prototype/add/blank-duration.js new file mode 100644 index 0000000000..35829c287b --- /dev/null +++ b/test/built-ins/Temporal/Instant/prototype/add/blank-duration.js @@ -0,0 +1,13 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.instant.prototype.add +description: Behaviour with blank duration +features: [Temporal] +---*/ + +const instant = new Temporal.Instant(1n); +const blank = new Temporal.Duration(); +const result = instant.add(blank); +assert.sameValue(result.epochNanoseconds, 1n, "result is unchanged"); diff --git a/test/built-ins/Temporal/Instant/prototype/since/blank-result.js b/test/built-ins/Temporal/Instant/prototype/since/blank-result.js new file mode 100644 index 0000000000..ac1551a43c --- /dev/null +++ b/test/built-ins/Temporal/Instant/prototype/since/blank-result.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 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: Difference between equivalent objects returns blank duration +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const i1 = new Temporal.Instant(1n); +const i2 = new Temporal.Instant(1n); +const result = i1.since(i2); +TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "blank result"); diff --git a/test/built-ins/Temporal/Instant/prototype/subtract/blank-duration.js b/test/built-ins/Temporal/Instant/prototype/subtract/blank-duration.js new file mode 100644 index 0000000000..b164bc5de9 --- /dev/null +++ b/test/built-ins/Temporal/Instant/prototype/subtract/blank-duration.js @@ -0,0 +1,13 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.instant.prototype.subtract +description: Behaviour with blank duration +features: [Temporal] +---*/ + +const instant = new Temporal.Instant(1n); +const blank = new Temporal.Duration(); +const result = instant.subtract(blank); +assert.sameValue(result.epochNanoseconds, 1n, "result is unchanged"); diff --git a/test/built-ins/Temporal/Instant/prototype/until/blank-result.js b/test/built-ins/Temporal/Instant/prototype/until/blank-result.js new file mode 100644 index 0000000000..c67d47dd6a --- /dev/null +++ b/test/built-ins/Temporal/Instant/prototype/until/blank-result.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 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: Difference between equivalent objects returns blank duration +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const i1 = new Temporal.Instant(1n); +const i2 = new Temporal.Instant(1n); +const result = i1.until(i2); +TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "blank result"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/add/blank-duration.js b/test/built-ins/Temporal/PlainDate/prototype/add/blank-duration.js new file mode 100644 index 0000000000..2aa5b40ec3 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/add/blank-duration.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 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: Behaviour with blank duration +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const d = new Temporal.PlainDate(2025, 8, 22); +const blank = new Temporal.Duration(); +const result = d.add(blank); +TemporalHelpers.assertPlainDate(result, 2025, 8, "M08", 22, "result is unchanged"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/since/blank-result.js b/test/built-ins/Temporal/PlainDate/prototype/since/blank-result.js new file mode 100644 index 0000000000..0d1ff69cdb --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/since/blank-result.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 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: Difference between equivalent objects returns blank duration +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const d1 = new Temporal.PlainDate(2025, 8, 22); +const d2 = new Temporal.PlainDate(2025, 8, 22); +const result = d1.since(d2); +TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "blank result"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/subtract/blank-duration.js b/test/built-ins/Temporal/PlainDate/prototype/subtract/blank-duration.js new file mode 100644 index 0000000000..be0418c3d6 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/subtract/blank-duration.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 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: Behaviour with blank duration +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const d = new Temporal.PlainDate(2025, 8, 22); +const blank = new Temporal.Duration(); +const result = d.subtract(blank); +TemporalHelpers.assertPlainDate(result, 2025, 8, "M08", 22, "result is unchanged"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/until/blank-result.js b/test/built-ins/Temporal/PlainDate/prototype/until/blank-result.js new file mode 100644 index 0000000000..05294dfaeb --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/until/blank-result.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 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: Difference between equivalent objects returns blank duration +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const d1 = new Temporal.PlainDate(2025, 8, 22); +const d2 = new Temporal.PlainDate(2025, 8, 22); +const result = d1.until(d2); +TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "blank result"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/add/blank-duration.js b/test/built-ins/Temporal/PlainDateTime/prototype/add/blank-duration.js new file mode 100644 index 0000000000..2ef98007a7 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/add/blank-duration.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.add +description: Behaviour with blank duration +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const dt = new Temporal.PlainDateTime(2025, 8, 22, 14, 1); +const blank = new Temporal.Duration(); +const result = dt.add(blank); +TemporalHelpers.assertPlainDateTime(result, 2025, 8, "M08", 22, 14, 1, 0, 0, 0, 0, "result is unchanged"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/since/blank-result.js b/test/built-ins/Temporal/PlainDateTime/prototype/since/blank-result.js new file mode 100644 index 0000000000..9e2bed7f62 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/since/blank-result.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.since +description: Difference between equivalent objects returns blank duration +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const d1 = new Temporal.PlainDateTime(2025, 8, 22, 13, 52); +const d2 = new Temporal.PlainDateTime(2025, 8, 22, 13, 52); +const result = d1.since(d2); +TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "blank result"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/subtract/blank-duration.js b/test/built-ins/Temporal/PlainDateTime/prototype/subtract/blank-duration.js new file mode 100644 index 0000000000..84c68a898d --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/subtract/blank-duration.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.subtract +description: Behaviour with blank duration +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const dt = new Temporal.PlainDateTime(2025, 8, 22, 14, 1); +const blank = new Temporal.Duration(); +const result = dt.subtract(blank); +TemporalHelpers.assertPlainDateTime(result, 2025, 8, "M08", 22, 14, 1, 0, 0, 0, 0, "result is unchanged"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/until/blank-result.js b/test/built-ins/Temporal/PlainDateTime/prototype/until/blank-result.js new file mode 100644 index 0000000000..a866e0525c --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/until/blank-result.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.until +description: Difference between equivalent objects returns blank duration +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const d1 = new Temporal.PlainDateTime(2025, 8, 22, 13, 52); +const d2 = new Temporal.PlainDateTime(2025, 8, 22, 13, 52); +const result = d1.until(d2); +TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "blank result"); diff --git a/test/built-ins/Temporal/PlainTime/prototype/add/blank-duration.js b/test/built-ins/Temporal/PlainTime/prototype/add/blank-duration.js new file mode 100644 index 0000000000..26afc2617f --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/add/blank-duration.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.prototype.add +description: Behaviour with blank duration +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const t = new Temporal.PlainTime(14, 1); +const blank = new Temporal.Duration(); +const result = t.add(blank); +TemporalHelpers.assertPlainTime(result, 14, 1, 0, 0, 0, 0, "result is unchanged"); diff --git a/test/built-ins/Temporal/PlainTime/prototype/since/blank-result.js b/test/built-ins/Temporal/PlainTime/prototype/since/blank-result.js new file mode 100644 index 0000000000..904eb22eda --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/since/blank-result.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 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: Difference between equivalent objects returns blank duration +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const d1 = new Temporal.PlainTime(13, 52); +const d2 = new Temporal.PlainTime(13, 52); +const result = d1.since(d2); +TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "blank result"); diff --git a/test/built-ins/Temporal/PlainTime/prototype/subtract/blank-duration.js b/test/built-ins/Temporal/PlainTime/prototype/subtract/blank-duration.js new file mode 100644 index 0000000000..79fb650e53 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/subtract/blank-duration.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.prototype.subtract +description: Behaviour with blank duration +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const t = new Temporal.PlainTime(14, 1); +const blank = new Temporal.Duration(); +const result = t.subtract(blank); +TemporalHelpers.assertPlainTime(result, 14, 1, 0, 0, 0, 0, "result is unchanged"); diff --git a/test/built-ins/Temporal/PlainTime/prototype/until/blank-result.js b/test/built-ins/Temporal/PlainTime/prototype/until/blank-result.js new file mode 100644 index 0000000000..92d7662390 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/until/blank-result.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 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: Difference between equivalent objects returns blank duration +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const d1 = new Temporal.PlainTime(13, 52); +const d2 = new Temporal.PlainTime(13, 52); +const result = d1.until(d2); +TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "blank result"); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/add/blank-duration.js b/test/built-ins/Temporal/PlainYearMonth/prototype/add/blank-duration.js new file mode 100644 index 0000000000..920ea94098 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/add/blank-duration.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 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: Behaviour with blank duration +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const ym = new Temporal.PlainYearMonth(2025, 8); +const blank = new Temporal.Duration(); +const result = ym.add(blank); +TemporalHelpers.assertPlainYearMonth(result, 2025, 8, "M08", "result is unchanged"); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/since/blank-result.js b/test/built-ins/Temporal/PlainYearMonth/prototype/since/blank-result.js new file mode 100644 index 0000000000..f7f5eea8fd --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/since/blank-result.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 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: Difference between equivalent objects returns blank duration +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const d1 = new Temporal.PlainYearMonth(2025, 8); +const d2 = new Temporal.PlainYearMonth(2025, 8); +const result = d1.since(d2); +TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "blank result"); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/subtract/blank-duration.js b/test/built-ins/Temporal/PlainYearMonth/prototype/subtract/blank-duration.js new file mode 100644 index 0000000000..0ac4ce8737 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/subtract/blank-duration.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 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: Behaviour with blank duration +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const ym = new Temporal.PlainYearMonth(2025, 8); +const blank = new Temporal.Duration(); +const result = ym.subtract(blank); +TemporalHelpers.assertPlainYearMonth(result, 2025, 8, "M08", "result is unchanged"); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/until/blank-result.js b/test/built-ins/Temporal/PlainYearMonth/prototype/until/blank-result.js new file mode 100644 index 0000000000..e40c8f7ef6 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/until/blank-result.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 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: Difference between equivalent objects returns blank duration +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const d1 = new Temporal.PlainYearMonth(2025, 8); +const d2 = new Temporal.PlainYearMonth(2025, 8); +const result = d1.until(d2); +TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "blank result"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/add/blank-duration.js b/test/built-ins/Temporal/ZonedDateTime/prototype/add/blank-duration.js new file mode 100644 index 0000000000..839e3966b4 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/add/blank-duration.js @@ -0,0 +1,13 @@ +// Copyright (C) 2025 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: Behaviour with blank duration +features: [Temporal] +---*/ + +const dt = new Temporal.ZonedDateTime(1n, "UTC"); +const blank = new Temporal.Duration(); +const result = dt.add(blank); +assert.sameValue(result.epochNanoseconds, 1n, "result is unchanged"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/since/blank-result.js b/test/built-ins/Temporal/ZonedDateTime/prototype/since/blank-result.js new file mode 100644 index 0000000000..1ee4c83f21 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/since/blank-result.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 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: Difference between equivalent objects returns blank duration +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const d1 = new Temporal.ZonedDateTime(1n, "UTC"); +const d2 = new Temporal.ZonedDateTime(1n, "UTC"); +const result = d1.since(d2); +TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "blank result"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/subtract/blank-duration.js b/test/built-ins/Temporal/ZonedDateTime/prototype/subtract/blank-duration.js new file mode 100644 index 0000000000..c264d681a2 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/subtract/blank-duration.js @@ -0,0 +1,13 @@ +// Copyright (C) 2025 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: Behaviour with blank duration +features: [Temporal] +---*/ + +const dt = new Temporal.ZonedDateTime(1n, "UTC"); +const blank = new Temporal.Duration(); +const result = dt.subtract(blank); +assert.sameValue(result.epochNanoseconds, 1n, "result is unchanged"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/until/blank-result.js b/test/built-ins/Temporal/ZonedDateTime/prototype/until/blank-result.js new file mode 100644 index 0000000000..331b866ac3 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/until/blank-result.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 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: Difference between equivalent objects returns blank duration +features: [Temporal] +includes: [temporalHelpers.js] +---*/ + +const d1 = new Temporal.ZonedDateTime(1n, "UTC"); +const d2 = new Temporal.ZonedDateTime(1n, "UTC"); +const result = d1.until(d2); +TemporalHelpers.assertDuration(result, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "blank result");