Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainDateTime/compare/argument-string-multiple-calendar.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) 2023 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.plaindatetime.compare
7 description: >
8 More than one calendar annotation is not syntactical if any have the criical
9 flag
10 features: [Temporal]
11 ---*/
12
13 const invalidStrings = [
14 "1970-01-01[u-ca=iso8601][!u-ca=iso8601]",
15 "1970-01-01[!u-ca=iso8601][u-ca=iso8601]",
16 "1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]",
17 "1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]",
18 "1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]",
19 "1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]",
20 "1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]",
21 "1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]",
22 ];
23
24 invalidStrings.forEach((arg) => {
25 assert.throws(
26 RangeError,
27 () => Temporal.PlainDateTime.compare(arg, new Temporal.PlainDateTime(1976, 11, 18)),
28 `reject more than one calendar annotation if any critical: ${arg} (first argument)`
29 );
30 assert.throws(
31 RangeError,
32 () => Temporal.PlainDateTime.compare(new Temporal.PlainDateTime(1976, 11, 18), arg),
33 `reject more than one calendar annotation if any critical: ${arg} (second argument)`
34 );
35 });
36
37 reportCompare(0, 0);