Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / Temporal / PlainMonthDay / prototype / equals / argument-string-date-with-utc-offset.js
blobda63cbcedab1207823efd69285fb8f4e2544e7d7
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
2 // Copyright (C) 2022 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.plainmonthday.prototype.equals
7 description: UTC offset not valid with format that does not include a time
8 features: [Temporal]
9 ---*/
11 const instance = new Temporal.PlainMonthDay(5, 2);
13 const validStrings = [
14   "05-02[Asia/Katmandu]",
15   "05-02[!Asia/Katmandu]",
16   "05-02[u-ca=iso8601]",
17   "05-02[Asia/Tokyo][u-ca=iso8601]",
18   "--05-02[Asia/Katmandu]",
19   "--05-02[!Asia/Katmandu]",
20   "--05-02[u-ca=iso8601]",
21   "--05-02[Asia/Tokyo][u-ca=iso8601]",
22   "2000-05-02T00+00:00",
23   "2000-05-02T00+00:00[UTC]",
24   "2000-05-02T00-02:30[America/St_Johns]",
27 for (const arg of validStrings) {
28   const result = instance.equals(arg);
30   assert.sameValue(
31     result,
32     true,
33     `"${arg}" is a valid UTC offset with time for PlainMonthDay`
34   );
37 const invalidStrings = [
38   "09-15Z",
39   "09-15Z[UTC]",
40   "09-15+01:00",
41   "09-15+01:00[Europe/Vienna]",
42   "--09-15Z",
43   "--09-15Z[UTC]",
44   "--09-15+01:00",
45   "--09-15+01:00[Europe/Vienna]",
46   "2022-09-15Z",
47   "2022-09-15Z[UTC]",
48   "2022-09-15Z[Europe/Vienna]",
49   "2022-09-15+00:00",
50   "2022-09-15+00:00[UTC]",
51   "2022-09-15-02:30",
52   "2022-09-15-02:30[America/St_Johns]",
53   "09-15[u-ca=chinese]",
56 for (const arg of invalidStrings) {
57   assert.throws(
58     RangeError,
59     () => instance.equals(arg),
60     `"${arg}" UTC offset without time is not valid for PlainMonthDay`
61   );
64 reportCompare(0, 0);