summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/Temporal/Now
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/intl402/Temporal/Now
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/intl402/Temporal/Now')
-rw-r--r--js/src/tests/test262/intl402/Temporal/Now/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Temporal/Now/plainDate/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Temporal/Now/plainDate/calendar-string.js15
-rw-r--r--js/src/tests/test262/intl402/Temporal/Now/plainDate/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Temporal/Now/plainDateTime/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Temporal/Now/plainDateTime/calendar-string.js15
-rw-r--r--js/src/tests/test262/intl402/Temporal/Now/plainDateTime/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Temporal/Now/plainDateTimeISO/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Temporal/Now/plainDateTimeISO/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Temporal/Now/plainDateTimeISO/timezone-string-datetime.js36
-rw-r--r--js/src/tests/test262/intl402/Temporal/Now/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Temporal/Now/zonedDateTime/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Temporal/Now/zonedDateTime/calendar-string.js20
-rw-r--r--js/src/tests/test262/intl402/Temporal/Now/zonedDateTime/calendar-timezone-string.js18
-rw-r--r--js/src/tests/test262/intl402/Temporal/Now/zonedDateTime/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Temporal/Now/zonedDateTime/timezone-string-datetime.js29
-rw-r--r--js/src/tests/test262/intl402/Temporal/Now/zonedDateTimeISO/browser.js0
-rw-r--r--js/src/tests/test262/intl402/Temporal/Now/zonedDateTimeISO/shell.js0
-rw-r--r--js/src/tests/test262/intl402/Temporal/Now/zonedDateTimeISO/timezone-string-datetime.js29
-rw-r--r--js/src/tests/test262/intl402/Temporal/Now/zonedDateTimeISO/timezone-string.js18
20 files changed, 180 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/Temporal/Now/browser.js b/js/src/tests/test262/intl402/Temporal/Now/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Temporal/Now/browser.js
diff --git a/js/src/tests/test262/intl402/Temporal/Now/plainDate/browser.js b/js/src/tests/test262/intl402/Temporal/Now/plainDate/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Temporal/Now/plainDate/browser.js
diff --git a/js/src/tests/test262/intl402/Temporal/Now/plainDate/calendar-string.js b/js/src/tests/test262/intl402/Temporal/Now/plainDate/calendar-string.js
new file mode 100644
index 0000000000..dad18c5a25
--- /dev/null
+++ b/js/src/tests/test262/intl402/Temporal/Now/plainDate/calendar-string.js
@@ -0,0 +1,15 @@
+// |reftest| skip -- Temporal is not supported
+// Copyright (C) 2022 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-temporal.now.plaindate
+description: String calendar argument
+features: [Temporal]
+---*/
+
+const date = Temporal.Now.plainDate("gregory");
+assert(date instanceof Temporal.PlainDate);
+assert.sameValue(date.calendar.id, "gregory");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Temporal/Now/plainDate/shell.js b/js/src/tests/test262/intl402/Temporal/Now/plainDate/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Temporal/Now/plainDate/shell.js
diff --git a/js/src/tests/test262/intl402/Temporal/Now/plainDateTime/browser.js b/js/src/tests/test262/intl402/Temporal/Now/plainDateTime/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Temporal/Now/plainDateTime/browser.js
diff --git a/js/src/tests/test262/intl402/Temporal/Now/plainDateTime/calendar-string.js b/js/src/tests/test262/intl402/Temporal/Now/plainDateTime/calendar-string.js
new file mode 100644
index 0000000000..abba88e695
--- /dev/null
+++ b/js/src/tests/test262/intl402/Temporal/Now/plainDateTime/calendar-string.js
@@ -0,0 +1,15 @@
+// |reftest| skip -- Temporal is not supported
+// Copyright (C) 2022 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-temporal.now.plaindatetime
+description: String calendar argument
+features: [Temporal]
+---*/
+
+const dt = Temporal.Now.plainDateTime("gregory");
+assert(dt instanceof Temporal.PlainDateTime);
+assert.sameValue(dt.calendar.id, "gregory");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Temporal/Now/plainDateTime/shell.js b/js/src/tests/test262/intl402/Temporal/Now/plainDateTime/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Temporal/Now/plainDateTime/shell.js
diff --git a/js/src/tests/test262/intl402/Temporal/Now/plainDateTimeISO/browser.js b/js/src/tests/test262/intl402/Temporal/Now/plainDateTimeISO/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Temporal/Now/plainDateTimeISO/browser.js
diff --git a/js/src/tests/test262/intl402/Temporal/Now/plainDateTimeISO/shell.js b/js/src/tests/test262/intl402/Temporal/Now/plainDateTimeISO/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Temporal/Now/plainDateTimeISO/shell.js
diff --git a/js/src/tests/test262/intl402/Temporal/Now/plainDateTimeISO/timezone-string-datetime.js b/js/src/tests/test262/intl402/Temporal/Now/plainDateTimeISO/timezone-string-datetime.js
new file mode 100644
index 0000000000..c8bfcda543
--- /dev/null
+++ b/js/src/tests/test262/intl402/Temporal/Now/plainDateTimeISO/timezone-string-datetime.js
@@ -0,0 +1,36 @@
+// |reftest| skip -- Temporal is not supported
+// Copyright (C) 2021 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-temporal.now.plaindatetimeiso
+description: Conversion of ISO date-time strings to Temporal.TimeZone instances
+features: [Temporal]
+---*/
+
+let timeZone = "2021-08-19T17:30";
+assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO(timeZone), "bare date-time string is not a time zone");
+assert.throws(RangeError, () => Temporal.Now.plainDateTimeISO({ timeZone }), "bare date-time string is not a time zone");
+
+// The following are all valid strings so should not throw:
+
+[
+ "2021-08-19T17:30Z",
+ "2021-08-19T1730Z",
+ "2021-08-19T17:30-07:00",
+ "2021-08-19T1730-07:00",
+ "2021-08-19T17:30-0700",
+ "2021-08-19T1730-0700",
+ "2021-08-19T17:30[America/Vancouver]",
+ "2021-08-19T1730[America/Vancouver]",
+ "2021-08-19T17:30Z[America/Vancouver]",
+ "2021-08-19T1730Z[America/Vancouver]",
+ "2021-08-19T17:30-07:00[America/Vancouver]",
+ "2021-08-19T1730-07:00[America/Vancouver]",
+ "2021-08-19T17:30-0700[America/Vancouver]",
+ "2021-08-19T1730-0700[America/Vancouver]",
+].forEach((timeZone) => {
+ Temporal.Now.plainDateTimeISO(timeZone);
+ Temporal.Now.plainDateTimeISO({ timeZone });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Temporal/Now/shell.js b/js/src/tests/test262/intl402/Temporal/Now/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Temporal/Now/shell.js
diff --git a/js/src/tests/test262/intl402/Temporal/Now/zonedDateTime/browser.js b/js/src/tests/test262/intl402/Temporal/Now/zonedDateTime/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Temporal/Now/zonedDateTime/browser.js
diff --git a/js/src/tests/test262/intl402/Temporal/Now/zonedDateTime/calendar-string.js b/js/src/tests/test262/intl402/Temporal/Now/zonedDateTime/calendar-string.js
new file mode 100644
index 0000000000..d1c0921343
--- /dev/null
+++ b/js/src/tests/test262/intl402/Temporal/Now/zonedDateTime/calendar-string.js
@@ -0,0 +1,20 @@
+// |reftest| skip -- Temporal is not supported
+// Copyright (C) 2022 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-temporal.now.zoneddatetime
+description: String calendar argument
+features: [Temporal]
+---*/
+
+const zdt = Temporal.Now.zonedDateTime("gregory");
+const tz = Temporal.Now.timeZone();
+assert(zdt instanceof Temporal.ZonedDateTime);
+assert(zdt.calendar instanceof Temporal.Calendar);
+assert.sameValue(zdt.calendar.id, "gregory");
+assert(zdt.timeZone instanceof Temporal.TimeZone);
+assert.sameValue(zdt.timeZone.id, tz.id);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Temporal/Now/zonedDateTime/calendar-timezone-string.js b/js/src/tests/test262/intl402/Temporal/Now/zonedDateTime/calendar-timezone-string.js
new file mode 100644
index 0000000000..46723c9033
--- /dev/null
+++ b/js/src/tests/test262/intl402/Temporal/Now/zonedDateTime/calendar-timezone-string.js
@@ -0,0 +1,18 @@
+// |reftest| skip -- Temporal is not supported
+// Copyright (C) 2022 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-temporal.now.zoneddatetime
+description: String calendar and time zone arguments
+features: [Temporal]
+---*/
+
+const zdt = Temporal.Now.zonedDateTime("gregory", "America/Los_Angeles");
+assert(zdt instanceof Temporal.ZonedDateTime);
+assert(zdt.calendar instanceof Temporal.Calendar);
+assert.sameValue(zdt.calendar.id, "gregory");
+assert(zdt.timeZone instanceof Temporal.TimeZone);
+assert.sameValue(zdt.timeZone.id, "America/Los_Angeles");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Temporal/Now/zonedDateTime/shell.js b/js/src/tests/test262/intl402/Temporal/Now/zonedDateTime/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Temporal/Now/zonedDateTime/shell.js
diff --git a/js/src/tests/test262/intl402/Temporal/Now/zonedDateTime/timezone-string-datetime.js b/js/src/tests/test262/intl402/Temporal/Now/zonedDateTime/timezone-string-datetime.js
new file mode 100644
index 0000000000..5b2fd3bee1
--- /dev/null
+++ b/js/src/tests/test262/intl402/Temporal/Now/zonedDateTime/timezone-string-datetime.js
@@ -0,0 +1,29 @@
+// |reftest| skip -- Temporal is not supported
+// Copyright (C) 2022 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-temporal.now.zoneddatetime
+description: Conversion of ISO date-time strings to Temporal.TimeZone instances (with Intl time zones)
+features: [Temporal]
+---*/
+
+let timeZone = "2021-08-19T17:30[America/Vancouver]";
+const result1 = Temporal.Now.zonedDateTime("iso8601", timeZone);
+assert.sameValue(result1.timeZone.id, "America/Vancouver", "date-time + IANA annotation is the IANA time zone");
+const result2 = Temporal.Now.zonedDateTime("iso8601", { timeZone });
+assert.sameValue(result2.timeZone.id, "America/Vancouver", "date-time + IANA annotation is the IANA time zone (string in property bag)");
+
+timeZone = "2021-08-19T17:30Z[America/Vancouver]";
+const result3 = Temporal.Now.zonedDateTime("iso8601", timeZone);
+assert.sameValue(result3.timeZone.id, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone");
+const result4 = Temporal.Now.zonedDateTime("iso8601", { timeZone });
+assert.sameValue(result4.timeZone.id, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)");
+
+timeZone = "2021-08-19T17:30-07:00[America/Vancouver]";
+const result5 = Temporal.Now.zonedDateTime("iso8601", timeZone);
+assert.sameValue(result5.timeZone.id, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone");
+const result6 = Temporal.Now.zonedDateTime("iso8601", { timeZone });
+assert.sameValue(result6.timeZone.id, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Temporal/Now/zonedDateTimeISO/browser.js b/js/src/tests/test262/intl402/Temporal/Now/zonedDateTimeISO/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Temporal/Now/zonedDateTimeISO/browser.js
diff --git a/js/src/tests/test262/intl402/Temporal/Now/zonedDateTimeISO/shell.js b/js/src/tests/test262/intl402/Temporal/Now/zonedDateTimeISO/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/intl402/Temporal/Now/zonedDateTimeISO/shell.js
diff --git a/js/src/tests/test262/intl402/Temporal/Now/zonedDateTimeISO/timezone-string-datetime.js b/js/src/tests/test262/intl402/Temporal/Now/zonedDateTimeISO/timezone-string-datetime.js
new file mode 100644
index 0000000000..535719d23b
--- /dev/null
+++ b/js/src/tests/test262/intl402/Temporal/Now/zonedDateTimeISO/timezone-string-datetime.js
@@ -0,0 +1,29 @@
+// |reftest| skip -- Temporal is not supported
+// Copyright (C) 2022 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-temporal.now.zoneddatetimeiso
+description: Conversion of ISO date-time strings to Temporal.TimeZone instances (with Intl time zones)
+features: [Temporal]
+---*/
+
+let timeZone = "2021-08-19T17:30[America/Vancouver]";
+const result1 = Temporal.Now.zonedDateTimeISO(timeZone);
+assert.sameValue(result1.timeZone.id, "America/Vancouver", "date-time + IANA annotation is the IANA time zone");
+const result2 = Temporal.Now.zonedDateTimeISO({ timeZone });
+assert.sameValue(result2.timeZone.id, "America/Vancouver", "date-time + IANA annotation is the IANA time zone (string in property bag)");
+
+timeZone = "2021-08-19T17:30Z[America/Vancouver]";
+const result3 = Temporal.Now.zonedDateTimeISO(timeZone);
+assert.sameValue(result3.timeZone.id, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone");
+const result4 = Temporal.Now.zonedDateTimeISO({ timeZone });
+assert.sameValue(result4.timeZone.id, "America/Vancouver", "date-time + Z + IANA annotation is the IANA time zone (string in property bag)");
+
+timeZone = "2021-08-19T17:30-07:00[America/Vancouver]";
+const result5 = Temporal.Now.zonedDateTimeISO(timeZone);
+assert.sameValue(result5.timeZone.id, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone");
+const result6 = Temporal.Now.zonedDateTimeISO({ timeZone });
+assert.sameValue(result6.timeZone.id, "America/Vancouver", "date-time + offset + IANA annotation is the IANA time zone (string in property bag)");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/Temporal/Now/zonedDateTimeISO/timezone-string.js b/js/src/tests/test262/intl402/Temporal/Now/zonedDateTimeISO/timezone-string.js
new file mode 100644
index 0000000000..31a7badf28
--- /dev/null
+++ b/js/src/tests/test262/intl402/Temporal/Now/zonedDateTimeISO/timezone-string.js
@@ -0,0 +1,18 @@
+// |reftest| skip -- Temporal is not supported
+// Copyright (C) 2022 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-temporal.now.zoneddatetimeiso
+description: String calendar argument
+features: [Temporal]
+---*/
+
+const zdt = Temporal.Now.zonedDateTimeISO("America/Los_Angeles");
+assert(zdt instanceof Temporal.ZonedDateTime);
+assert(zdt.calendar instanceof Temporal.Calendar);
+assert.sameValue(zdt.calendar.id, "iso8601");
+assert(zdt.timeZone instanceof Temporal.TimeZone);
+assert.sameValue(zdt.timeZone.id, "America/Los_Angeles");
+
+reportCompare(0, 0);