-
Notifications
You must be signed in to change notification settings - Fork 472
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests for multiple calendar annotations with at least one critical
As per IETF review, an IXDTF string (ISO 8601 with annotations) is no longer valid if it contains more than one u-ca annotation and at least one of the annotations is marked critical. Removes tests where such a string was assumed to be valid, and adds new ones with a few variations on invalid strings.
- Loading branch information
Showing
128 changed files
with
1,835 additions
and
64 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
29 changes: 29 additions & 0 deletions
29
test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-multiple-calendar.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,29 @@ | ||
// Copyright (C) 2023 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.dateadd | ||
description: > | ||
More than one calendar annotation is not syntactical if any have the criical | ||
flag | ||
features: [Temporal] | ||
---*/ | ||
|
||
const invalidStrings = [ | ||
"1970-01-01[u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01[!u-ca=iso8601][u-ca=iso8601]", | ||
"1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", | ||
"1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", | ||
"1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", | ||
]; | ||
const instance = new Temporal.Calendar("iso8601"); | ||
invalidStrings.forEach((arg) => { | ||
assert.throws( | ||
RangeError, | ||
() => instance.dateAdd(arg, new Temporal.Duration()), | ||
`reject more than one calendar annotation if any critical: ${arg}` | ||
); | ||
}); |
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
34 changes: 34 additions & 0 deletions
34
test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-multiple-calendar.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,34 @@ | ||
// Copyright (C) 2023 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: > | ||
More than one calendar annotation is not syntactical if any have the criical | ||
flag | ||
features: [Temporal] | ||
---*/ | ||
|
||
const invalidStrings = [ | ||
"1970-01-01[u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01[!u-ca=iso8601][u-ca=iso8601]", | ||
"1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", | ||
"1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", | ||
"1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", | ||
]; | ||
const instance = new Temporal.Calendar("iso8601"); | ||
invalidStrings.forEach((arg) => { | ||
assert.throws( | ||
RangeError, | ||
() => instance.dateUntil(arg, new Temporal.PlainDate(1977, 11, 19)), | ||
`reject more than one calendar annotation if any critical: ${arg} (first argument)` | ||
); | ||
assert.throws( | ||
RangeError, | ||
() => instance.dateUntil(new Temporal.PlainDate(1977, 11, 19), arg), | ||
`reject more than one calendar annotation if any critical: ${arg} (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
29 changes: 29 additions & 0 deletions
29
test/built-ins/Temporal/Calendar/prototype/day/argument-string-multiple-calendar.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,29 @@ | ||
// Copyright (C) 2023 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.day | ||
description: > | ||
More than one calendar annotation is not syntactical if any have the criical | ||
flag | ||
features: [Temporal] | ||
---*/ | ||
|
||
const invalidStrings = [ | ||
"1970-01-01[u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01[!u-ca=iso8601][u-ca=iso8601]", | ||
"1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", | ||
"1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", | ||
"1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", | ||
]; | ||
const instance = new Temporal.Calendar("iso8601"); | ||
invalidStrings.forEach((arg) => { | ||
assert.throws( | ||
RangeError, | ||
() => instance.day(arg), | ||
`reject more than one calendar annotation if any critical: ${arg}` | ||
); | ||
}); |
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
29 changes: 29 additions & 0 deletions
29
test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-multiple-calendar.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,29 @@ | ||
// Copyright (C) 2023 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.dayofweek | ||
description: > | ||
More than one calendar annotation is not syntactical if any have the criical | ||
flag | ||
features: [Temporal] | ||
---*/ | ||
|
||
const invalidStrings = [ | ||
"1970-01-01[u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01[!u-ca=iso8601][u-ca=iso8601]", | ||
"1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", | ||
"1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", | ||
"1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", | ||
]; | ||
const instance = new Temporal.Calendar("iso8601"); | ||
invalidStrings.forEach((arg) => { | ||
assert.throws( | ||
RangeError, | ||
() => instance.dayOfWeek(arg), | ||
`reject more than one calendar annotation if any critical: ${arg}` | ||
); | ||
}); |
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
29 changes: 29 additions & 0 deletions
29
test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-multiple-calendar.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,29 @@ | ||
// Copyright (C) 2023 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.dayofyear | ||
description: > | ||
More than one calendar annotation is not syntactical if any have the criical | ||
flag | ||
features: [Temporal] | ||
---*/ | ||
|
||
const invalidStrings = [ | ||
"1970-01-01[u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01[!u-ca=iso8601][u-ca=iso8601]", | ||
"1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", | ||
"1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", | ||
"1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", | ||
]; | ||
const instance = new Temporal.Calendar("iso8601"); | ||
invalidStrings.forEach((arg) => { | ||
assert.throws( | ||
RangeError, | ||
() => instance.dayOfYear(arg), | ||
`reject more than one calendar annotation if any critical: ${arg}` | ||
); | ||
}); |
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
29 changes: 29 additions & 0 deletions
29
test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-multiple-calendar.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,29 @@ | ||
// Copyright (C) 2023 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.daysinmonth | ||
description: > | ||
More than one calendar annotation is not syntactical if any have the criical | ||
flag | ||
features: [Temporal] | ||
---*/ | ||
|
||
const invalidStrings = [ | ||
"1970-01-01[u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01[!u-ca=iso8601][u-ca=iso8601]", | ||
"1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", | ||
"1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", | ||
"1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", | ||
]; | ||
const instance = new Temporal.Calendar("iso8601"); | ||
invalidStrings.forEach((arg) => { | ||
assert.throws( | ||
RangeError, | ||
() => instance.daysInMonth(arg), | ||
`reject more than one calendar annotation if any critical: ${arg}` | ||
); | ||
}); |
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
29 changes: 29 additions & 0 deletions
29
test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-multiple-calendar.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,29 @@ | ||
// Copyright (C) 2023 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.daysinweek | ||
description: > | ||
More than one calendar annotation is not syntactical if any have the criical | ||
flag | ||
features: [Temporal] | ||
---*/ | ||
|
||
const invalidStrings = [ | ||
"1970-01-01[u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01[!u-ca=iso8601][u-ca=iso8601]", | ||
"1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", | ||
"1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", | ||
"1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", | ||
]; | ||
const instance = new Temporal.Calendar("iso8601"); | ||
invalidStrings.forEach((arg) => { | ||
assert.throws( | ||
RangeError, | ||
() => instance.daysInWeek(arg), | ||
`reject more than one calendar annotation if any critical: ${arg}` | ||
); | ||
}); |
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
29 changes: 29 additions & 0 deletions
29
test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-multiple-calendar.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,29 @@ | ||
// Copyright (C) 2023 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.daysinyear | ||
description: > | ||
More than one calendar annotation is not syntactical if any have the criical | ||
flag | ||
features: [Temporal] | ||
---*/ | ||
|
||
const invalidStrings = [ | ||
"1970-01-01[u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01[!u-ca=iso8601][u-ca=iso8601]", | ||
"1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", | ||
"1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", | ||
"1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", | ||
]; | ||
const instance = new Temporal.Calendar("iso8601"); | ||
invalidStrings.forEach((arg) => { | ||
assert.throws( | ||
RangeError, | ||
() => instance.daysInYear(arg), | ||
`reject more than one calendar annotation if any critical: ${arg}` | ||
); | ||
}); |
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
29 changes: 29 additions & 0 deletions
29
test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-multiple-calendar.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,29 @@ | ||
// Copyright (C) 2023 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.inleapyear | ||
description: > | ||
More than one calendar annotation is not syntactical if any have the criical | ||
flag | ||
features: [Temporal] | ||
---*/ | ||
|
||
const invalidStrings = [ | ||
"1970-01-01[u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01[!u-ca=iso8601][u-ca=iso8601]", | ||
"1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", | ||
"1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", | ||
"1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", | ||
]; | ||
const instance = new Temporal.Calendar("iso8601"); | ||
invalidStrings.forEach((arg) => { | ||
assert.throws( | ||
RangeError, | ||
() => instance.inLeapYear(arg), | ||
`reject more than one calendar annotation if any critical: ${arg}` | ||
); | ||
}); |
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
29 changes: 29 additions & 0 deletions
29
test/built-ins/Temporal/Calendar/prototype/month/argument-string-multiple-calendar.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,29 @@ | ||
// Copyright (C) 2023 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.calendar.prototype.month | ||
description: > | ||
More than one calendar annotation is not syntactical if any have the criical | ||
flag | ||
features: [Temporal] | ||
---*/ | ||
|
||
const invalidStrings = [ | ||
"1970-01-01[u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01[!u-ca=iso8601][u-ca=iso8601]", | ||
"1970-01-01[UTC][u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01[u-ca=iso8601][foo=bar][!u-ca=iso8601]", | ||
"1970-01-01T00:00[u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01T00:00[!u-ca=iso8601][u-ca=iso8601]", | ||
"1970-01-01T00:00[UTC][u-ca=iso8601][!u-ca=iso8601]", | ||
"1970-01-01T00:00[u-ca=iso8601][foo=bar][!u-ca=iso8601]", | ||
]; | ||
const instance = new Temporal.Calendar("iso8601"); | ||
invalidStrings.forEach((arg) => { | ||
assert.throws( | ||
RangeError, | ||
() => instance.month(arg), | ||
`reject more than one calendar annotation if any critical: ${arg}` | ||
); | ||
}); |
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.