Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainDate/from/argument-string.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.plaindate.from
7 description: various interesting string arguments.
8 includes: [temporalHelpers.js]
9 features: [Temporal]
10 ---*/
11
12 const tests = [
13 ["1976-11-18", 1976, 11, "M11", 18],
14 ["2019-06-30", 2019, 6, "M06", 30],
15 ["+000050-06-30", 50, 6, "M06", 30],
16 ["+010583-06-30", 10583, 6, "M06", 30],
17 ["-010583-06-30", -10583, 6, "M06", 30],
18 ["-000333-06-30", -333, 6, "M06", 30],
19 ["19761118", 1976, 11, "M11", 18],
20 ["+0019761118", 1976, 11, "M11", 18],
21 ["1976-11-18T152330.1+00:00", 1976, 11, "M11", 18],
22 ["19761118T15:23:30.1+00:00", 1976, 11, "M11", 18],
23 ["1976-11-18T15:23:30.1+0000", 1976, 11, "M11", 18],
24 ["1976-11-18T152330.1+0000", 1976, 11, "M11", 18],
25 ["19761118T15:23:30.1+0000", 1976, 11, "M11", 18],
26 ["19761118T152330.1+00:00", 1976, 11, "M11", 18],
27 ["19761118T152330.1+0000", 1976, 11, "M11", 18],
28 ["+001976-11-18T152330.1+00:00", 1976, 11, "M11", 18],
29 ["+0019761118T15:23:30.1+00:00", 1976, 11, "M11", 18],
30 ["+001976-11-18T15:23:30.1+0000", 1976, 11, "M11", 18],
31 ["+001976-11-18T152330.1+0000", 1976, 11, "M11", 18],
32 ["+0019761118T15:23:30.1+0000", 1976, 11, "M11", 18],
33 ["+0019761118T152330.1+00:00", 1976, 11, "M11", 18],
34 ["+0019761118T152330.1+0000", 1976, 11, "M11", 18],
35 ];
36
37 for (const [input, ...expected] of tests) {
38 const result = Temporal.PlainDate.from(input);
39 TemporalHelpers.assertPlainDate(result, ...expected, `from(${input})`);
40 }
41
42 reportCompare(0, 0);