Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainYearMonth/compare/argument-string-calendar-annotation-invalid-key.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) 2024 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.compare
7 description: Annotation keys are lowercase-only
8 features: [Temporal]
9 ---*/
10
11 const invalidStrings = [
12 ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"],
13 ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"],
14 ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"],
15 ];
16
17 invalidStrings.forEach(([arg, descr]) => {
18 assert.throws(
19 RangeError,
20 () => Temporal.PlainYearMonth.compare(arg, new Temporal.PlainYearMonth(2019, 6)),
21 `annotation keys must be lowercase: ${arg} - ${descr} (first argument)`
22 );
23 assert.throws(
24 RangeError,
25 () => Temporal.PlainYearMonth.compare(new Temporal.PlainYearMonth(2019, 6), arg),
26 `annotation keys must be lowercase: ${arg} - ${descr} (second argument)`
27 );
28 });
29
30 reportCompare(0, 0);