Add timezone case insensitive tests

This commit is contained in:
Aditi 2022-09-07 14:38:19 +05:30 committed by Philip Chimento
parent cf51de578f
commit d7181a5866
16 changed files with 149 additions and 5 deletions

View File

@ -0,0 +1,14 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.instant.prototype.tozoneddatetime
description: Time zone names are case insensitive
features: [Temporal]
---*/
const instance = new Temporal.Instant(0n);
const timeZone = 'eTc/gMt+1';
const result = instance.toZonedDateTime({ timeZone, calendar: "iso8601" });
assert.sameValue(result.timeZone.id, 'Etc/GMT+1', `Time zone created from string "${timeZone}"`);

View File

@ -0,0 +1,14 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.instant.prototype.tozoneddatetimeiso
description: Time zone names are case insensitive
features: [Temporal]
---*/
const instance = new Temporal.Instant(0n);
const timeZone = 'eTc/gMt+1';
const result = instance.toZonedDateTimeISO(timeZone);
assert.sameValue(result.timeZone.id, 'Etc/GMT+1', `Time zone created from string "${timeZone}"`);

View File

@ -0,0 +1,12 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.now.prototype.zoneddatetime
description: Time zone names are case insensitive
features: [Temporal]
---*/
const timeZone = 'eTc/gMt+1';
const result = Temporal.Now.zonedDateTime("iso8601", timeZone);
assert.sameValue(result.timeZone.id, 'Etc/GMT+1', `Time zone created from string "${timeZone}"`);

View File

@ -0,0 +1,12 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.now.prototype.zoneddatetimeiso
description: Time zone names are case insensitive
features: [Temporal]
---*/
const timeZone = 'eTc/gMt+1';
const result = Temporal.Now.zonedDateTimeISO(timeZone);
assert.sameValue(result.timeZone.id, 'Etc/GMT+1', `Time zone created from string "${timeZone}"`);

View File

@ -12,4 +12,4 @@ const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = Temporal.PlainDate.from(arg);
TemporalHelpers.assertPlainDate(result, 1976, 11, "M11", 18, `Calendar created from string "${calendar}"`);
TemporalHelpers.assertPlainDate(result, 1976, 11, "M11", 18, `Calendar created from string "${calendar}"`);

View File

@ -0,0 +1,14 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plaindate.prototype.tozoneddatetime
description: Time zone names are case insensitive
features: [Temporal]
---*/
const instance = new Temporal.PlainDate(2000, 5, 2);
const timeZone = 'eTc/gMt+1';
const result = instance.toZonedDateTime(timeZone);
assert.sameValue(result.timeZone.id, 'Etc/GMT+1', `Time zone created from string "${timeZone}"`);

View File

@ -12,4 +12,4 @@ const calendar = "IsO8601";
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
const result = Temporal.PlainDateTime.from(arg);
TemporalHelpers.assertPlainDateTime(result, 1976, 11, "M11", 18, 0, 0, 0, 0, 0, 0, `Calendar created from string "${calendar}"`);
TemporalHelpers.assertPlainDateTime(result, 1976, 11, "M11", 18, 0, 0, 0, 0, 0, 0, `Calendar created from string "${calendar}"`);

View File

@ -0,0 +1,14 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plaindatetime.prototype.tozoneddatetime
description: Time zone names are case insensitive
features: [Temporal]
---*/
const instance = new Temporal.PlainDateTime(2000, 5, 2);
const timeZone = 'eTc/gMt+1';
const result = instance.toZonedDateTime(timeZone);
assert.sameValue(result.timeZone.id, 'Etc/GMT+1', `Time zone created from string "${timeZone}"`);

View File

@ -12,4 +12,4 @@ const calendar = "IsO8601";
const arg = { monthCode: "M11", day: 18, calendar };
const result = Temporal.PlainMonthDay.from(arg);
TemporalHelpers.assertPlainMonthDay(result, "M11", 18, `Calendar created from string "${calendar}"`);
TemporalHelpers.assertPlainMonthDay(result, "M11", 18, `Calendar created from string "${calendar}"`);

View File

@ -0,0 +1,14 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plaintime.prototype.tozoneddatetime
description: Time zone names are case insensitive
features: [Temporal]
---*/
const instance = new Temporal.PlainTime();
const timeZone = 'eTc/gMt+1';
const result = instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone });
assert.sameValue(result.timeZone.id, 'Etc/GMT+1', `Time zone created from string "${timeZone}"`);

View File

@ -12,4 +12,4 @@ const calendar = "IsO8601";
const arg = { year: 2019, monthCode: "M06", calendar };
const result = Temporal.PlainYearMonth.from(arg);
TemporalHelpers.assertPlainYearMonth(result, 2019, 6, "M06", `Calendar created from string "${calendar}"`);
TemporalHelpers.assertPlainYearMonth(result, 2019, 6, "M06", `Calendar created from string "${calendar}"`);

View File

@ -0,0 +1,12 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.timezone.prototype.from
description: Time zone names are case insensitive
features: [Temporal]
---*/
const timeZone = 'eTc/gMt+1';
const result = Temporal.TimeZone.from(timeZone);
assert.sameValue(result.id, 'Etc/GMT+1', `Time zone created from string "${timeZone}"`);

View File

@ -12,4 +12,4 @@ const calendar = "IsO8601";
const timeZone = new Temporal.TimeZone("UTC");
const arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar };
const result = Temporal.ZonedDateTime.from(arg);
assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${calendar}"`);
assert.sameValue(result.calendar.id, "iso8601", `Calendar created from string "${calendar}"`);

View File

@ -0,0 +1,12 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.zoneddatetime.prototype.from
description: Time zone names are case insensitive
features: [Temporal]
---*/
const timeZone = 'eTc/gMt+1';
const result = Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone });
assert.sameValue(result.timeZone.id, 'Etc/GMT+1', `Time zone created from string "${timeZone}"`);

View File

@ -0,0 +1,14 @@
// Copyright (C) 2022 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: Time zone names are case insensitive
features: [Temporal]
---*/
const instance = new Temporal.ZonedDateTime(0n, "UTC");
const timeZone = 'eTc/gMt+1';
const result = instance.withTimeZone(timeZone);
assert.sameValue(result.timeZone.id, 'Etc/GMT+1', `Time zone created from string "${timeZone}"`);

View File

@ -0,0 +1,12 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.zoneddatetime.prototype.constructor
description: Time zone names are case insensitive
features: [Temporal]
---*/
const timeZone = 'eTc/gMt+1';
const result = new Temporal.ZonedDateTime(0n, timeZone);
assert.sameValue(result.timeZone.id, 'Etc/GMT+1', `Time zone created from string "${timeZone}"`);