Backed out 2 changesets (bug 1888310, bug 1884625) for causing failures on browser_ap...
[gecko.git] / js / src / tests / test262 / built-ins / Temporal / PlainTime / compare / argument-string-calendar-annotation-invalid-key.js
blob8667a8bf8f6b72331f720392cc7bc2042450df0b
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
2 // Copyright (C) 2024 Igalia, S.L. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
5 /*---
6 esid: sec-temporal.plaintime.compare
7 description: Annotation keys are lowercase-only 
8 features: [Temporal]
9 ---*/
11 const invalidStrings = [
12   ["00:00[U-CA=iso8601]", "invalid capitalized key, time-only"],
13   ["T00:00[U-CA=iso8601]", "invalid capitalized key, time designator"],
14   ["1970-01-01T00:00[U-CA=iso8601]", "invalid capitalized key"],
15   ["00:00[u-CA=iso8601]", "invalid partially-capitalized key, time-only"],
16   ["T00:00[u-CA=iso8601]", "invalid partially-capitalized key, time designator"],
17   ["1970-01-01T00:00[u-CA=iso8601]", "invalid partially-capitalized key"],
18   ["00:00[FOO=bar]", "invalid capitalized unrecognized key, time-only"],
19   ["T00:00[FOO=bar]", "invalid capitalized unrecognized key, time designator"],
20   ["1970-01-01T00:00[FOO=bar]", "invalid capitalized unrecognized key"],
23 invalidStrings.forEach(([arg, descr]) => {
24   assert.throws(
25     RangeError,
26     () => Temporal.PlainTime.compare(arg, new Temporal.PlainTime(12, 34, 56, 987, 654, 321)),
27     `annotation keys must be lowercase: ${arg} - ${descr} (first argument)`
28   );
29   assert.throws(
30     RangeError,
31     () => Temporal.PlainTime.compare(new Temporal.PlainTime(12, 34, 56, 987, 654, 321), arg),
32     `annotation keys must be lowercase: ${arg} - ${descr} (second argument)`
33   );
34 });
36 reportCompare(0, 0);