v8/test/mjsunit/temporal/calendar-constructor.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

20 lines
734 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
// 1. If NewTarget is undefined, then
// a. Throw a TypeError exception.
assertThrows(() => Temporal.Calendar("iso8601"), TypeError,
"Constructor Temporal.Calendar requires 'new'");
assertThrows(() => new Temporal.Calendar(), RangeError,
"Invalid calendar specified: undefined");
// Wrong case
assertThrows(() => new Temporal.Calendar("ISO8601"), RangeError,
"Invalid calendar specified: ISO8601");
assertEquals("iso8601", (new Temporal.Calendar("iso8601")).id)