Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainYearMonth/from/argument-string-critical-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.plainyearmonth.from
7 description: Unknown annotations with critical flag are rejected
8 features: [Temporal]
9 ---*/
10
11 const invalidStrings = [
12 "1970-01-01T00:00[!foo=bar]",
13 "1970-01-01T00:00[UTC][!foo=bar]",
14 "1970-01-01T00:00[u-ca=iso8601][!foo=bar]",
15 "1970-01-01T00:00[UTC][!foo=bar][u-ca=iso8601]",
16 "1970-01-01T00:00[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]",
17 ];
18
19 invalidStrings.forEach((arg) => {
20 assert.throws(
21 RangeError,
22 () => Temporal.PlainYearMonth.from(arg),
23 `reject unknown annotation with critical flag: ${arg}`
24 );
25 });
26
27 reportCompare(0, 0);