Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainTime/from/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.from
7 description: Time separator in string argument can vary
8 features: [Temporal]
9 includes: [temporalHelpers.js]
10 ---*/
11
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 const result = Temporal.PlainTime.from(arg);
22
23 TemporalHelpers.assertPlainTime(
24 result,
25 12, 34, 56, 987, 654, 321,
26 `variant time separators (${description})`
27 );
28 });
29
30 reportCompare(0, 0);