Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainYearMonth/compare/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 description: Negative zero, as an extended year, fails
7 esid: sec-temporal.plainyearmonth.compare
8 features: [Temporal]
9 ---*/
10
11 const ok = new Temporal.PlainYearMonth(2000, 5);
12 const invalidStrings = [
13 "-000000-06",
14 "-000000-06-24",
15 "-000000-06-24T15:43:27",
16 "-000000-06-24T15:43:27+01:00",
17 "-000000-06-24T15:43:27+00:00[UTC]",
18 ];
19
20 invalidStrings.forEach((arg) => {
21 assert.throws(
22 RangeError,
23 () => Temporal.PlainYearMonth.compare(arg, ok),
24 "Cannot use minus zero as extended year (first argument)"
25 );
26
27 assert.throws(
28 RangeError,
29 () => Temporal.PlainYearMonth.compare(ok, arg),
30 "Cannot use minus zero as extended year (second argument)"
31 );
32 });
33
34 reportCompare(0, 0);