Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainDateTime/from/argument-plaindatetime.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) 2022 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.plaindatetime.from
7 description: A PlainDateTime object is copied, not returned directly
8 includes: [temporalHelpers.js]
9 features: [Temporal]
10 ---*/
11
12 const orig = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 20, 123, 456, 789);
13 const result = Temporal.PlainDateTime.from(orig);
14
15 TemporalHelpers.assertPlainDateTime(
16 result,
17 1976, 11, "M11", 18, 15, 23, 20, 123, 456, 789,
18 "PlainDateTime is copied"
19 );
20
21 assert.sameValue(result.calendarId, orig.calendarId, "Calendar is copied");
22
23 assert.notSameValue(
24 result,
25 orig,
26 "When a PlainDateTime is given, the returned value is not the original PlainDateTime"
27 );
28
29 reportCompare(0, 0);