summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Temporal/PlainDate/from/argument-plaindatetime.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Temporal/PlainDate/from/argument-plaindatetime.js')
-rw-r--r--js/src/tests/test262/built-ins/Temporal/PlainDate/from/argument-plaindatetime.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Temporal/PlainDate/from/argument-plaindatetime.js b/js/src/tests/test262/built-ins/Temporal/PlainDate/from/argument-plaindatetime.js
new file mode 100644
index 0000000000..a98ce76168
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Temporal/PlainDate/from/argument-plaindatetime.js
@@ -0,0 +1,24 @@
+// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
+// 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.plaindate.from
+description: Fast path for converting Temporal.PlainDateTime to Temporal.PlainDate by reading internal slots
+info: |
+ sec-temporal.plaindate.from step 3:
+ 3. Return ? ToTemporalDate(_item_, _options_).
+ sec-temporal-totemporaldate step 2.b:
+ b. If _item_ has an [[InitializedTemporalDateTime]] internal slot, then
+ i. Return ! CreateTemporalDate(_item_.[[ISOYear]], _item_.[[ISOMonth]], _item_.[[ISODay]], _item_.[[Calendar]]).
+includes: [compareArray.js, temporalHelpers.js]
+features: [Temporal]
+---*/
+
+TemporalHelpers.checkPlainDateTimeConversionFastPath((datetime, calendar) => {
+ const result = Temporal.PlainDate.from(datetime);
+ TemporalHelpers.assertPlainDate(result, 2000, 5, "M05", 2);
+ assert.sameValue(result.getCalendar(), calendar, "calendar result");
+});
+
+reportCompare(0, 0);