Skip to content

Commit

Permalink
Add tests for PlainDate.from() with the Gregorian calendar.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ms2ger authored and ptomato committed Sep 17, 2021
1 parent 326d9a4 commit 8b90758
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 50 deletions.
1 change: 0 additions & 1 deletion polyfill/test/all.mjs
Expand Up @@ -26,7 +26,6 @@ import './plaindatetime.mjs';
import './duration.mjs';
import './plainyearmonth.mjs';
import './intl.mjs';
import './calendar.mjs';

// tests of userland objects
import './usertimezone.mjs';
Expand Down
49 changes: 0 additions & 49 deletions polyfill/test/calendar.mjs

This file was deleted.

29 changes: 29 additions & 0 deletions polyfill/test/intl402/Temporal/PlainDate/constructor/from/basic.js
@@ -0,0 +1,29 @@
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.plaindate.from
description: Basic tests for PlainDate.from() with the Gregorian calendar.
includes: [compareArray.js, temporalHelpers.js]
features: [Temporal]
---*/

TemporalHelpers.assertPlainDate(
Temporal.PlainDate.from("1999-12-31[u-ca=gregory]"),
1999, 12, "M12", 31, "string era CE", "ce", 1999);

TemporalHelpers.assertPlainDate(
Temporal.PlainDate.from("-000001-12-31[u-ca=gregory]"),
-1, 12, "M12", 31, "string era BCE", "bce", 2);

TemporalHelpers.assertPlainDate(
Temporal.PlainDate.from({ era: "ce", eraYear: 1999, month: 12, day: 31, calendar: "gregory" }),
1999, 12, "M12", 31, "property bag explicit era CE", "ce", 1999);

TemporalHelpers.assertPlainDate(
Temporal.PlainDate.from({ year: 1999, month: 12, day: 31, calendar: "gregory" }),
1999, 12, "M12", 31, "property bag implicit era CE", "ce", 1999);

TemporalHelpers.assertPlainDate(
Temporal.PlainDate.from({ era: "bce", eraYear: 2, month: 12, day: 31, calendar: "gregory" }),
-1, 12, "M12", 31, "property bag era BCE", "bce", 2);

0 comments on commit 8b90758

Please sign in to comment.