Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainDateTime/compare/argument-string-minus-sign.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) 2024 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: Non-ASCII minus sign is not acceptable
8 features: [Temporal]
9 ---*/
10
11 const invalidStrings = [
12 "1976-11-18T15:23:30.12\u221202:00",
13 "\u2212009999-11-18T15:23:30.12",
14 ];
15
16 invalidStrings.forEach((arg) => {
17 assert.throws(
18 RangeError,
19 () => Temporal.PlainDateTime.compare(arg, new Temporal.PlainDateTime(1976, 11, 18)),
20 `variant minus sign: ${arg} (first argument)`
21 );
22
23 assert.throws(
24 RangeError,
25 () => Temporal.PlainDateTime.compare(new Temporal.PlainDateTime(1976, 11, 18), arg),
26 `variant minus sign: ${arg} (second argument)`
27 );
28 });
29
30 reportCompare(0, 0);