Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainTime/compare/argument-string-time-separators.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: Time separator in string argument can vary
8 features: [Temporal]
9 ---*/
10
11 const plainTime = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
12 const tests = [
13 ["1976-11-18T12:34:56.987654321", "uppercase T"],
14 ["1976-11-18t12:34:56.987654321", "lowercase T"],
15 ["1976-11-18 12:34:56.987654321", "space between date and time"],
16 ["T12:34:56.987654321", "time-only uppercase T"],
17 ["t12:34:56.987654321", "time-only lowercase T"],
18 ];
19
20 tests.forEach(([arg, description]) => {
21 assert.sameValue(
22 Temporal.PlainTime.compare(arg, plainTime),
23 0,
24 `variant time separators (${description}), first argument`
25 );
26
27 assert.sameValue(
28 Temporal.PlainTime.compare(plainTime, arg),
29 0,
30 `variant time separators (${description}), second argument`
31 );
32 });
33
34 reportCompare(0, 0);