v8/test/mjsunit/temporal/calendar-from.js
Frank Tang dfa3dfa3b5 [Temporal] Add some tests for Temporal.Calendar
All marked as FAIL at this stage.

Bug: v8:11544
Change-Id: I6e4346a57aa3df054d2ef5bd353544fba7fd855b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3044350
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#76211}
2021-08-10 20:04:10 +00:00

24 lines
997 B
JavaScript

// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-temporal
// https://tc39.es/proposal-temporal/#sec-temporal.calendar.from
// 1. If NewTarget is undefined, then
// a. Throw a TypeError exception.
//assertThrows(() => Temporal.Calendar.from("invalid"), TypeError,
// "Constructor Temporal.Calendar requires 'new'");
assertEquals("iso8601",
(Temporal.Calendar.from("iso8601")).id);
assertEquals("iso8601",
(Temporal.Calendar.from(new Temporal.PlainDate(2021, 7, 3))).id);
assertEquals("iso8601",
(Temporal.Calendar.from(new Temporal.PlainDateTime(2021, 7, 3, 4, 5))).id);
assertEquals("iso8601",
(Temporal.Calendar.from(new Temporal.PlainTime())).id);
assertEquals("iso8601",
(Temporal.Calendar.from(new Temporal.PlainYearMonth(2011, 4))).id);
assertEquals("iso8601",
(Temporal.Calendar.from(new Temporal.PlainMonthDay(2, 6))).id);