Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-calendar-year-zero.js

raw
1 // |reftest| shell-option(--enable-temporal) skip-if(!this.hasOwnProperty('Temporal')||!xulRuntime.shell) -- Temporal is not enabled unconditionally, requires shell-options
2 // Copyright (C) 2022 Igalia, S.L. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 esid: sec-temporal.zoneddatetime.compare
7 description: Negative zero, as an extended year, is rejected
8 features: [Temporal, arrow-function]
9 ---*/
10
11 const datetime = new Temporal.ZonedDateTime(0n, "UTC");
12 const invalidStrings = [
13 "-000000-10-31",
14 "-000000-10-31T17:45",
15 "-000000-10-31T17:45Z",
16 "-000000-10-31T17:45+01:00",
17 "-000000-10-31T17:45+00:00[UTC]",
18 ];
19
20 invalidStrings.forEach((arg) => {
21 assert.throws(
22 RangeError,
23 () => Temporal.ZonedDateTime.compare(arg, datetime),
24 "reject minus zero as extended year (first argument)"
25 );
26 assert.throws(
27 RangeError,
28 () => Temporal.ZonedDateTime.compare(datetime, arg),
29 "reject minus zero as extended year (second argument)"
30 );
31 });
32
33 reportCompare(0, 0);