mirror of
https://github.com/tc39/test262.git
synced 2025-08-18 08:28:27 +02:00
Many tests tested some functionality while asserting that there were no calls of calendar or time zone methods. We can continue testing the functionality, but there are no more methods to call, so we can delete those parts of the tests.
28 lines
1.1 KiB
JavaScript
28 lines
1.1 KiB
JavaScript
// Copyright (C) 2023 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: Return when two Temporal.Durations have identical internal slots
|
|
features: [Temporal]
|
|
---*/
|
|
|
|
const duration1 = new Temporal.Duration(0, 0, 0, 5, 5, 5, 5, 5, 5, 5);
|
|
const duration2 = new Temporal.Duration(0, 0, 0, 5, 5, 5, 5, 5, 5, 5);
|
|
assert.sameValue(Temporal.Duration.compare(duration1, duration2), 0, "identical Duration instances should be equal");
|
|
|
|
const dateDuration1 = new Temporal.Duration(5, 5, 5, 5, 5, 5, 5, 5, 5, 5);
|
|
const dateDuration2 = new Temporal.Duration(5, 5, 5, 5, 5, 5, 5, 5, 5, 5);
|
|
assert.sameValue(
|
|
Temporal.Duration.compare(dateDuration1, dateDuration2),
|
|
0,
|
|
"relativeTo is not required if two distinct Duration instances are identical"
|
|
);
|
|
|
|
const dateDuration3 = new Temporal.Duration(5, 5, 5, 5, 4, 65, 5, 5, 5, 5);
|
|
assert.throws(
|
|
RangeError,
|
|
() => Temporal.Duration.compare(dateDuration1, dateDuration3),
|
|
"relativeTo is required if two Duration instances are the same length but not identical"
|
|
);
|