Added intl tests for timezone and calendar case insensitivity

This commit is contained in:
Aditi 2022-09-08 18:27:52 +05:30 committed by Philip Chimento
parent d7181a5866
commit c6b62110f9
28 changed files with 96 additions and 48 deletions

View File

@ -7,7 +7,7 @@ description: Calendar names are case-insensitive
features: [Temporal]
---*/
const arg = "jApAnEsE";
const arg = "iSo8601";
const result = Temporal.Calendar.from(arg);
assert.sameValue(result.id, "japanese", "Calendar is case-insensitive");
assert.sameValue(result.id, "iso8601", "Calendar is case-insensitive");

View File

@ -9,6 +9,6 @@ features: [Temporal]
const instance = new Temporal.Instant(1_000_000_000_000_000_000n);
const arg = "jApAnEsE";;
const arg = "iSo8601";;
const result = instance.toZonedDateTime({ calendar: arg, timeZone: "UTC" });
assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive");
assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive");

View File

@ -9,6 +9,6 @@ features: [Temporal]
const instance = new Temporal.Instant(0n);
const timeZone = 'eTc/gMt+1';
const timeZone = 'uTc';
const result = instance.toZonedDateTime({ timeZone, calendar: "iso8601" });
assert.sameValue(result.timeZone.id, 'Etc/GMT+1', `Time zone created from string "${timeZone}"`);
assert.sameValue(result.timeZone.id, 'UTC', `Time zone created from string "${timeZone}"`);

View File

@ -9,6 +9,6 @@ features: [Temporal]
const instance = new Temporal.Instant(0n);
const timeZone = 'eTc/gMt+1';
const timeZone = 'uTc';
const result = instance.toZonedDateTimeISO(timeZone);
assert.sameValue(result.timeZone.id, 'Etc/GMT+1', `Time zone created from string "${timeZone}"`);
assert.sameValue(result.timeZone.id, 'UTC', `Time zone created from string "${timeZone}"`);

View File

@ -7,7 +7,7 @@ description: Calendar names are case-insensitive
features: [Temporal]
---*/
const arg = "jApAnEsE";
const arg = "iSo8601";
const result = Temporal.Now.plainDate(arg);
assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive");
assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive");

View File

@ -7,7 +7,7 @@ description: Calendar names are case-insensitive
features: [Temporal]
---*/
const arg = "jApAnEsE";
const arg = "iSo8601";
const result = Temporal.Now.plainDateTime(arg);
assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive");
assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive");

View File

@ -7,7 +7,7 @@ description: Calendar names are case-insensitive
features: [Temporal]
---*/
const arg = "jApAnEsE";
const arg = "iSo8601";
const result = Temporal.Now.zonedDateTime(arg);
assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive");
assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive");

View File

@ -7,6 +7,6 @@ description: Time zone names are case insensitive
features: [Temporal]
---*/
const timeZone = 'eTc/gMt+1';
const timeZone = 'UtC';
const result = Temporal.Now.zonedDateTime("iso8601", timeZone);
assert.sameValue(result.timeZone.id, 'Etc/GMT+1', `Time zone created from string "${timeZone}"`);
assert.sameValue(result.timeZone.id, 'UTC', `Time zone created from string "${timeZone}"`);

View File

@ -7,6 +7,6 @@ description: Time zone names are case insensitive
features: [Temporal]
---*/
const timeZone = 'eTc/gMt+1';
const timeZone = 'UtC';
const result = Temporal.Now.zonedDateTimeISO(timeZone);
assert.sameValue(result.timeZone.id, 'Etc/GMT+1', `Time zone created from string "${timeZone}"`);
assert.sameValue(result.timeZone.id, 'UTC', `Time zone created from string "${timeZone}"`);

View File

@ -7,7 +7,7 @@ description: Calendar names are case-insensitive
features: [Temporal]
---*/
const arg = "jApAnEsE";
const arg = "iSo8601";
const result = new Temporal.PlainDate(2000, 5, 2, arg);
assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive");
assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive");

View File

@ -9,6 +9,6 @@ features: [Temporal]
const instance = new Temporal.PlainDate(2000, 5, 2);
const timeZone = 'eTc/gMt+1';
const timeZone = 'uTc';
const result = instance.toZonedDateTime(timeZone);
assert.sameValue(result.timeZone.id, 'Etc/GMT+1', `Time zone created from string "${timeZone}"`);
assert.sameValue(result.timeZone.id, 'UTC', `Time zone created from string "${timeZone}"`);

View File

@ -9,6 +9,6 @@ features: [Temporal]
const instance = new Temporal.PlainDate(1976, 11, 18, { id: "replace-me" });
const arg = "jApAnEsE";;
const arg = "iSo8601";;
const result = instance.withCalendar(arg);
assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive");
assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive");

View File

@ -7,7 +7,7 @@ description: Calendar names are case-insensitive
features: [Temporal]
---*/
const arg = "jApAnEsE";
const arg = "iSo8601";
const result = new Temporal.PlainDateTime(2000, 5, 2, 15, 23, 30, 987, 654, 321, arg);
assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive");
assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive");

View File

@ -9,6 +9,6 @@ features: [Temporal]
const instance = new Temporal.PlainDateTime(2000, 5, 2);
const timeZone = 'eTc/gMt+1';
const timeZone = 'uTc';
const result = instance.toZonedDateTime(timeZone);
assert.sameValue(result.timeZone.id, 'Etc/GMT+1', `Time zone created from string "${timeZone}"`);
assert.sameValue(result.timeZone.id, 'UTC', `Time zone created from string "${timeZone}"`);

View File

@ -9,6 +9,6 @@ features: [Temporal]
const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, { id: "replace-me" });
const arg = "jApAnEsE";;
const arg = "iSo8601";;
const result = instance.withCalendar(arg);
assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive");
assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive");

View File

@ -7,7 +7,7 @@ description: Calendar names are case-insensitive
features: [Temporal]
---*/
const arg = "jApAnEsE";
const arg = "iSo8601";
const result = new Temporal.PlainMonthDay(12, 15, arg, 1972);
assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive");
assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive");

View File

@ -9,6 +9,6 @@ features: [Temporal]
const instance = new Temporal.PlainTime();
const timeZone = 'eTc/gMt+1';
const timeZone = 'uTc';
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}"`);
assert.sameValue(result.timeZone.id, 'UTC', `Time zone created from string "${timeZone}"`);

View File

@ -7,7 +7,7 @@ description: Calendar names are case-insensitive
features: [Temporal]
---*/
const arg = "jApAnEsE";
const arg = "iSo8601";
const result = new Temporal.PlainYearMonth(2000, 5, arg, 1);
assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive");
assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive");

View File

@ -7,6 +7,6 @@ description: Time zone names are case insensitive
features: [Temporal]
---*/
const timeZone = 'eTc/gMt+1';
const timeZone = 'UtC';
const result = Temporal.TimeZone.from(timeZone);
assert.sameValue(result.id, 'Etc/GMT+1', `Time zone created from string "${timeZone}"`);
assert.sameValue(result.id, 'UTC', `Time zone created from string "${timeZone}"`);

View File

@ -9,6 +9,6 @@ features: [Temporal]
const instance = new Temporal.TimeZone("UTC");
const arg = "jApAnEsE";;
const arg = "iSo8601";;
const result = instance.getPlainDateTimeFor(new Temporal.Instant(0n), arg);
assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive");
assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive");

View File

@ -7,7 +7,7 @@ description: Calendar names are case-insensitive
features: [Temporal]
---*/
const arg = "jApAnEsE";
const arg = "iSo8601";
const result = new Temporal.ZonedDateTime(0n, "UTC", arg);
assert.sameValue(result.calendar.id, "japanese", "Calendar is case-insensitive");
assert.sameValue(result.calendar.id, "iso8601", "Calendar is case-insensitive");

View File

@ -7,6 +7,6 @@ description: Time zone names are case insensitive
features: [Temporal]
---*/
const timeZone = 'eTc/gMt+1';
const timeZone = 'uTc';
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}"`);
assert.sameValue(result.timeZone.id, 'UTC', `Time zone created from string "${timeZone}"`);

View File

@ -9,6 +9,6 @@ features: [Temporal]
const instance = new Temporal.ZonedDateTime(0n, "UTC");
const timeZone = 'eTc/gMt+1';
const timeZone = 'uTc';
const result = instance.withTimeZone(timeZone);
assert.sameValue(result.timeZone.id, 'Etc/GMT+1', `Time zone created from string "${timeZone}"`);
assert.sameValue(result.timeZone.id, 'UTC', `Time zone created from string "${timeZone}"`);

View File

@ -7,6 +7,6 @@ description: Time zone names are case insensitive
features: [Temporal]
---*/
const timeZone = 'eTc/gMt+1';
const timeZone = 'uTc';
const result = new Temporal.ZonedDateTime(0n, timeZone);
assert.sameValue(result.timeZone.id, 'Etc/GMT+1', `Time zone created from string "${timeZone}"`);
assert.sameValue(result.timeZone.id, 'UTC', `Time zone created from string "${timeZone}"`);

View File

@ -0,0 +1,11 @@
// 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.calendar constructor
description: Calendar names are case-insensitive
features: [Temporal]
---*/
const result = new Temporal.Calendar("jApAnEsE");
assert.sameValue(result.toString(), "japanese", "Calendar is case-insensitive");

View File

@ -0,0 +1,13 @@
// 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.calendar.prototype.from
description: Calendar names are case-insensitive
features: [Temporal]
---*/
const arg = "jApAnEsE";
const result = Temporal.Calendar.from(arg);
assert.sameValue(result.id, "japanese", "Calendar is case-insensitive");

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

@ -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 constructor
description: Time zone names are case insensitive
features: [Temporal]
---*/
const timeZone = 'eTc/gMt+1';
const result = new Temporal.TimeZone(timeZone);
assert.sameValue(result.toString(), 'Etc/GMT+1', `Time zone created from string "${timeZone}"`);