Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainTime/from/argument-string-unknown-annotation.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: Various forms of unknown annotation
8 features: [Temporal]
9 includes: [temporalHelpers.js]
10 ---*/
11
12 const tests = [
13 ["12:34:56.987654321[foo=bar]", "alone"],
14 ["12:34:56.987654321[UTC][foo=bar]", "with time zone"],
15 ["12:34:56.987654321[u-ca=iso8601][foo=bar]", "with calendar"],
16 ["12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
17 ["T12:34:56.987654321[foo=bar]", "with T"],
18 ["T12:34:56.987654321[UTC][foo=bar]", "with T and time zone"],
19 ["T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with T and calendar"],
20 ["T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with T, time zone, and calendar"],
21 ["1970-01-01T12:34:56.987654321[foo=bar]", "with date"],
22 ["1970-01-01T12:34:56.987654321[UTC][foo=bar]", "with date and time zone"],
23 ["1970-01-01T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with date and calendar"],
24 ["1970-01-01T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with date, time zone, and calendar"],
25 ["1970-01-01T12:34:56.987654321[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
26 ];
27
28 tests.forEach(([arg, description]) => {
29 const result = Temporal.PlainTime.from(arg);
30
31 TemporalHelpers.assertPlainTime(
32 result,
33 12, 34, 56, 987, 654, 321,
34 `unknown annotation (${description})`
35 );
36 });
37
38 reportCompare(0, 0);