-
Notifications
You must be signed in to change notification settings - Fork 468
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regularize "calendar-case-insensitive" tests
For each entry point where a string calendar name is accepted, we should have a test that ensures the calendar name is case-insensitive. These tests existed but several were incomplete as they didn't take nested properties into account, and several entry points were missing this test. Fix a minor copy-paste issue with double semicolons.
- Loading branch information
Showing
50 changed files
with
414 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...s/Temporal/Calendar/prototype/dateUntil/argument-propertybag-calendar-case-insensitive.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// 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.dateuntil | ||
description: The calendar name is case-insensitive | ||
includes: [temporalHelpers.js] | ||
features: [Temporal] | ||
---*/ | ||
|
||
const instance = new Temporal.Calendar("iso8601"); | ||
|
||
const calendar = "IsO8601"; | ||
|
||
let arg = { year: 1976, monthCode: "M11", day: 18, calendar }; | ||
const result1 = instance.dateUntil(arg, new Temporal.PlainDate(1976, 11, 19)); | ||
TemporalHelpers.assertDuration(result1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive (first argument)"); | ||
const result2 = instance.dateUntil(new Temporal.PlainDate(1976, 11, 19), arg); | ||
TemporalHelpers.assertDuration(result2, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive (second argument)"); | ||
|
||
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } }; | ||
const result3 = instance.dateUntil(arg, new Temporal.PlainDate(1976, 11, 19)); | ||
TemporalHelpers.assertDuration(result3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive (nested property, first argument)"); | ||
const result4 = instance.dateUntil(new Temporal.PlainDate(1976, 11, 19), arg); | ||
TemporalHelpers.assertDuration(result4, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, "Calendar is case-insensitive (nested property, second argument)"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
.../Temporal/Calendar/prototype/yearOfWeek/argument-propertybag-calendar-case-insensitive.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// 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.yearofweek | ||
description: The calendar name is case-insensitive | ||
features: [Temporal] | ||
---*/ | ||
|
||
const instance = new Temporal.Calendar("iso8601"); | ||
|
||
const calendar = "IsO8601"; | ||
|
||
let arg = { year: 1976, monthCode: "M11", day: 18, calendar }; | ||
const result1 = instance.yearOfWeek(arg); | ||
assert.sameValue(result1, 1976, "Calendar is case-insensitive"); | ||
|
||
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } }; | ||
const result2 = instance.yearOfWeek(arg); | ||
assert.sameValue(result2, 1976, "Calendar is case-insensitive (nested property)"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
test/built-ins/Temporal/PlainDate/compare/argument-propertybag-calendar-case-insensitive.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// 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.compare | ||
description: The calendar name is case-insensitive | ||
features: [Temporal] | ||
---*/ | ||
|
||
const calendar = "IsO8601"; | ||
|
||
let arg = { year: 1976, monthCode: "M11", day: 18, calendar }; | ||
const result1 = Temporal.PlainDate.compare(arg, new Temporal.PlainDate(1976, 11, 18)); | ||
assert.sameValue(result1, 0, "Calendar is case-insensitive (first argument)"); | ||
const result2 = Temporal.PlainDate.compare(new Temporal.PlainDate(1976, 11, 18), arg); | ||
assert.sameValue(result2, 0, "Calendar is case-insensitive (second argument)"); | ||
|
||
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } }; | ||
const result3 = Temporal.PlainDate.compare(arg, new Temporal.PlainDate(1976, 11, 18)); | ||
assert.sameValue(result3, 0, "Calendar is case-insensitive (nested property, first argument)"); | ||
const result4 = Temporal.PlainDate.compare(new Temporal.PlainDate(1976, 11, 18), arg); | ||
assert.sameValue(result4, 0, "Calendar is case-insensitive (nested property, second argument)"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...uilt-ins/Temporal/PlainDateTime/compare/argument-propertybag-calendar-case-insensitive.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// 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.compare | ||
description: The calendar name is case-insensitive | ||
features: [Temporal] | ||
---*/ | ||
|
||
const calendar = "IsO8601"; | ||
|
||
let arg = { year: 1976, monthCode: "M11", day: 18, calendar }; | ||
const result1 = Temporal.PlainDateTime.compare(arg, new Temporal.PlainDateTime(1976, 11, 18)); | ||
assert.sameValue(result1, 0, "Calendar is case-insensitive (first argument)"); | ||
const result2 = Temporal.PlainDateTime.compare(new Temporal.PlainDateTime(1976, 11, 18), arg); | ||
assert.sameValue(result2, 0, "Calendar is case-insensitive (second argument)"); | ||
|
||
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } }; | ||
const result3 = Temporal.PlainDateTime.compare(arg, new Temporal.PlainDateTime(1976, 11, 18)); | ||
assert.sameValue(result3, 0, "Calendar is case-insensitive (nested property, first argument)"); | ||
const result4 = Temporal.PlainDateTime.compare(new Temporal.PlainDateTime(1976, 11, 18), arg); | ||
assert.sameValue(result4, 0, "Calendar is case-insensitive (nested property, second argument)"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.