mirror of
https://github.com/tc39/test262.git
synced 2025-08-31 06:48:27 +02:00
Many methods did not test what happened when an input or return value was a blank (all fields 0) duration. This adds coverage for those code paths.
21 lines
850 B
JavaScript
21 lines
850 B
JavaScript
// 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");
|