mirror of
https://github.com/tc39/test262.git
synced 2025-08-18 08:28:27 +02:00
Without custom calendars and time zones there are actually a bunch of things that we now can't test on implementations that don't have non-ISO calendars or non-UTC time zones. (Alternatively, we can say that these are functionalities that those implementations don't have to implement.)
48 lines
1.4 KiB
JavaScript
48 lines
1.4 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.plainyearmonth.compare
|
|
description: Tests for compare() with each possible outcome
|
|
features: [Temporal]
|
|
---*/
|
|
|
|
const cal1 = "iso8601";
|
|
const cal2 = "gregory";
|
|
|
|
assert.sameValue(
|
|
Temporal.PlainYearMonth.compare(new Temporal.PlainYearMonth(2000, 5, cal1), new Temporal.PlainYearMonth(1987, 5, cal2)),
|
|
1,
|
|
"year >"
|
|
);
|
|
assert.sameValue(
|
|
Temporal.PlainYearMonth.compare(new Temporal.PlainYearMonth(1981, 12, cal1), new Temporal.PlainYearMonth(2048, 12, cal2)),
|
|
-1,
|
|
"year <"
|
|
);
|
|
assert.sameValue(
|
|
Temporal.PlainYearMonth.compare(new Temporal.PlainYearMonth(2000, 5, cal1), new Temporal.PlainYearMonth(2000, 3, cal2)),
|
|
1,
|
|
"month >"
|
|
);
|
|
assert.sameValue(
|
|
Temporal.PlainYearMonth.compare(new Temporal.PlainYearMonth(1981, 4, cal1), new Temporal.PlainYearMonth(1981, 12, cal2)),
|
|
-1,
|
|
"month <"
|
|
);
|
|
assert.sameValue(
|
|
Temporal.PlainYearMonth.compare(new Temporal.PlainYearMonth(2000, 5, cal1, 30), new Temporal.PlainYearMonth(2000, 5, cal2, 14)),
|
|
1,
|
|
"reference day >"
|
|
);
|
|
assert.sameValue(
|
|
Temporal.PlainYearMonth.compare(new Temporal.PlainYearMonth(1981, 4, cal1, 1), new Temporal.PlainYearMonth(1981, 4, cal2, 12)),
|
|
-1,
|
|
"reference day <"
|
|
);
|
|
assert.sameValue(
|
|
Temporal.PlainYearMonth.compare(new Temporal.PlainYearMonth(2000, 5, cal1), new Temporal.PlainYearMonth(2000, 5, cal2)),
|
|
0,
|
|
"="
|
|
);
|