Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporal: Move remaining tests from Temporal/ZonedDateTime/old under staging into separate files under test/built-ins #4298

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// 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.zoneddatetime.prototype.withplaintime
description: withPlainTime() works.
includes: [temporalHelpers.js]
features: [Temporal]
---*/

const zdt = Temporal.ZonedDateTime.from("2015-12-07T03:24:30.000003500[-08:00]");

// withPlainTime({ hour: 10 }) works
TemporalHelpers.assertZonedDateTimesEqual(
zdt.withPlainTime({ hour: 10 }),
Temporal.ZonedDateTime.from("2015-12-07T10:00:00-08:00[-08:00]"));

// withPlainTime(time) works
const time = new Temporal.PlainTime(11, 22);
TemporalHelpers.assertZonedDateTimesEqual(
zdt.withPlainTime(time),
Temporal.ZonedDateTime.from("2015-12-07T11:22:00-08:00[-08:00]"));

// withPlainTime('12:34') works
TemporalHelpers.assertZonedDateTimesEqual(
zdt.withPlainTime("12:34"),
Temporal.ZonedDateTime.from( "2015-12-07T12:34:00-08:00[-08:00]"));
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// 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.zoneddatetime.prototype.withplaintime
description: Incorrectly-spelled properties are ignored.
includes: [temporalHelpers.js]
features: [Temporal]
---*/

const zdt = Temporal.ZonedDateTime.from("2015-12-07T03:24:30.000003500[-08:00]");

TemporalHelpers.assertZonedDateTimesEqual(
zdt.withPlainTime({
hour: 10,
seconds: 55
}),
Temporal.ZonedDateTime.from("2015-12-07T10:00:00-08:00[-08:00]"));
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// 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.zoneddatetime.prototype.withtimezone
description: Keeps instant the same.
includes: [temporalHelpers.js]
features: [Temporal]
---*/

const zdt = Temporal.ZonedDateTime.from("2019-11-18T15:23:30.123456789+01:00[+01:00]");
const zdt2 = zdt.withTimeZone("-08:00");

assert.sameValue(zdt.epochNanoseconds, zdt2.epochNanoseconds);
assert.sameValue(zdt2.timeZoneId, "-08:00");

TemporalHelpers.assertPlainDateTime(
zdt.toPlainDateTime(),
2019, 11, "M11", 18, 15, 23, 30, 123, 456, 789);
TemporalHelpers.assertPlainDateTime(
zdt2.toPlainDateTime(),
2019, 11, "M11", 18, 6, 23, 30, 123, 456, 789);
26 changes: 0 additions & 26 deletions test/staging/Temporal/ZonedDateTime/old/withPlainTime.js

This file was deleted.

15 changes: 0 additions & 15 deletions test/staging/Temporal/ZonedDateTime/old/withTimezone.js

This file was deleted.

Loading