Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainTime/compare/argument-string-no-implicit-midnight.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: RangeError thrown if a date-only string is passed in a PlainTime context
8 features: [Temporal, arrow-function]
9 ---*/
10
11 const arg = "2019-10-01";
12 const midnight = new Temporal.PlainTime();
13 assert.throws(
14 RangeError,
15 () => Temporal.PlainTime.compare(arg, midnight),
16 "Date-only string throws, does not implicitly convert to midnight (first argument)"
17 );
18 assert.throws(
19 RangeError,
20 () => Temporal.PlainTime.compare(midnight, arg),
21 "Date-only string throws, does not implicitly convert to midnight (second argument)"
22 );
23
24 reportCompare(0, 0);