Debian Codegraph @

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