Debian Codegraph @

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