Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainDate/from/argument-plaindate.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) 2021 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.plaindate.from
7 description: A PlainDate object is copied, not returned directly
8 includes: [temporalHelpers.js]
9 features: [Temporal]
10 ---*/
11
12 const orig = new Temporal.PlainDate(2000, 5, 2);
13 const result = Temporal.PlainDate.from(orig);
14
15 TemporalHelpers.assertPlainDate(
16 result,
17 2000, 5, "M05", 2,
18 "PlainDate 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 PlainDate is given, the returned value is not the original PlainDate"
27 );
28
29 reportCompare(0, 0);