forked from tc39/test262
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Temporal: Make U+2212 MINUS SIGN invalid in ISO strings
These are the test adjustments corresponding to the normative PR tc39/ecma262#3334 which reached consensus at the June 2024 TC39 meeting.
- Loading branch information
Showing
49 changed files
with
812 additions
and
68 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
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
28 changes: 28 additions & 0 deletions
28
test/built-ins/Temporal/Instant/compare/argument-string-minus-sign.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,28 @@ | ||
// Copyright (C) 2024 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.instant.compare | ||
description: Non-ASCII minus sign is not acceptable | ||
features: [Temporal] | ||
---*/ | ||
|
||
const invalidStrings = [ | ||
"1976-11-18T15:23:30.12\u221202:00", | ||
"\u2212009999-11-18T15:23:30.12", | ||
]; | ||
|
||
const epoch = new Temporal.Instant(0n); | ||
invalidStrings.forEach((arg) => { | ||
assert.throws( | ||
RangeError, | ||
() => Temporal.Instant.compare(arg, epoch), | ||
`variant minus sign: ${arg} (first argument)` | ||
); | ||
|
||
assert.throws( | ||
RangeError, | ||
() => Temporal.Instant.compare(epoch, arg), | ||
`variant minus sign: ${arg} (second argument)` | ||
); | ||
}); |
21 changes: 21 additions & 0 deletions
21
test/built-ins/Temporal/Instant/from/argument-string-minus-sign.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,21 @@ | ||
// Copyright (C) 2024 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.instant.from | ||
description: Non-ASCII minus sign is not acceptable | ||
features: [Temporal] | ||
---*/ | ||
|
||
const invalidStrings = [ | ||
"1976-11-18T15:23:30.12\u221202:00", | ||
"\u2212009999-11-18T15:23:30.12", | ||
]; | ||
|
||
invalidStrings.forEach((arg) => { | ||
assert.throws( | ||
RangeError, | ||
() => Temporal.Instant.from(arg), | ||
`variant minus sign: ${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
21 changes: 21 additions & 0 deletions
21
test/built-ins/Temporal/Instant/prototype/equals/argument-string-minus-sign.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,21 @@ | ||
// Copyright (C) 2024 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.instant.prototype.equals | ||
description: Non-ASCII minus sign is not acceptable | ||
features: [Temporal] | ||
---*/ | ||
|
||
const invalidStrings = [ | ||
"1976-11-18T15:23:30.12\u221202:00", | ||
"\u2212009999-11-18T15:23:30.12", | ||
]; | ||
const instance = new Temporal.Instant(0n); | ||
invalidStrings.forEach((arg) => { | ||
assert.throws( | ||
RangeError, | ||
() => instance.equals(arg), | ||
`variant minus sign: ${arg}` | ||
); | ||
}); |
21 changes: 21 additions & 0 deletions
21
test/built-ins/Temporal/Instant/prototype/since/argument-string-minus-sign.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,21 @@ | ||
// Copyright (C) 2024 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.instant.prototype.since | ||
description: Non-ASCII minus sign is not acceptable | ||
features: [Temporal] | ||
---*/ | ||
|
||
const invalidStrings = [ | ||
"1976-11-18T15:23:30.12\u221202:00", | ||
"\u2212009999-11-18T15:23:30.12", | ||
]; | ||
const instance = new Temporal.Instant(0n); | ||
invalidStrings.forEach((arg) => { | ||
assert.throws( | ||
RangeError, | ||
() => instance.since(arg), | ||
`variant minus sign: ${arg}` | ||
); | ||
}); |
21 changes: 21 additions & 0 deletions
21
test/built-ins/Temporal/Instant/prototype/until/argument-string-minus-sign.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,21 @@ | ||
// Copyright (C) 2024 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.instant.prototype.until | ||
description: Non-ASCII minus sign is not acceptable | ||
features: [Temporal] | ||
---*/ | ||
|
||
const invalidStrings = [ | ||
"1976-11-18T15:23:30.12\u221202:00", | ||
"\u2212009999-11-18T15:23:30.12", | ||
]; | ||
const instance = new Temporal.Instant(0n); | ||
invalidStrings.forEach((arg) => { | ||
assert.throws( | ||
RangeError, | ||
() => instance.until(arg), | ||
`variant minus sign: ${arg}` | ||
); | ||
}); |
27 changes: 27 additions & 0 deletions
27
test/built-ins/Temporal/PlainDate/compare/argument-string-minus-sign.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,27 @@ | ||
// Copyright (C) 2024 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: Non-ASCII minus sign is not acceptable | ||
features: [Temporal] | ||
---*/ | ||
|
||
const invalidStrings = [ | ||
"1976-11-18T15:23:30.12\u221202:00", | ||
"\u2212009999-11-18T15:23:30.12", | ||
]; | ||
|
||
invalidStrings.forEach((arg) => { | ||
assert.throws( | ||
RangeError, | ||
() => Temporal.PlainDate.compare(arg, new Temporal.PlainDate(1976, 11, 18)), | ||
`variant minus sign: ${arg} (first argument)` | ||
); | ||
|
||
assert.throws( | ||
RangeError, | ||
() => Temporal.PlainDate.compare(new Temporal.PlainDate(1976, 11, 18), arg), | ||
`variant minus sign: ${arg} (second argument)` | ||
); | ||
}); |
21 changes: 21 additions & 0 deletions
21
test/built-ins/Temporal/PlainDate/from/argument-string-minus-sign.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,21 @@ | ||
// Copyright (C) 2024 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.plaindate.from | ||
description: Non-ASCII minus sign is not acceptable | ||
features: [Temporal] | ||
---*/ | ||
|
||
const invalidStrings = [ | ||
"1976-11-18T15:23:30.12\u221202:00", | ||
"\u2212009999-11-18T15:23:30.12", | ||
]; | ||
|
||
invalidStrings.forEach((arg) => { | ||
assert.throws( | ||
RangeError, | ||
() => Temporal.PlainDate.from(arg), | ||
`variant minus sign: ${arg}` | ||
); | ||
}); |
21 changes: 21 additions & 0 deletions
21
test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-minus-sign.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,21 @@ | ||
// Copyright (C) 2024 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.plaindate.prototype.equals | ||
description: Non-ASCII minus sign is not acceptable | ||
features: [Temporal] | ||
---*/ | ||
|
||
const invalidStrings = [ | ||
"1976-11-18T15:23:30.12\u221202:00", | ||
"\u2212009999-11-18T15:23:30.12", | ||
]; | ||
const instance = new Temporal.PlainDate(2000, 5, 2); | ||
invalidStrings.forEach((arg) => { | ||
assert.throws( | ||
RangeError, | ||
() => instance.equals(arg), | ||
`variant minus sign: ${arg}` | ||
); | ||
}); |
21 changes: 21 additions & 0 deletions
21
test/built-ins/Temporal/PlainDate/prototype/since/argument-string-minus-sign.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,21 @@ | ||
// Copyright (C) 2024 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.plaindate.prototype.since | ||
description: Non-ASCII minus sign is not acceptable | ||
features: [Temporal] | ||
---*/ | ||
|
||
const invalidStrings = [ | ||
"1976-11-18T15:23:30.12\u221202:00", | ||
"\u2212009999-11-18T15:23:30.12", | ||
]; | ||
const instance = new Temporal.PlainDate(2000, 5, 2); | ||
invalidStrings.forEach((arg) => { | ||
assert.throws( | ||
RangeError, | ||
() => instance.since(arg), | ||
`variant minus sign: ${arg}` | ||
); | ||
}); |
21 changes: 21 additions & 0 deletions
21
test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-minus-sign.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,21 @@ | ||
// Copyright (C) 2024 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.plaindate.prototype.toplaindatetime | ||
description: Non-ASCII minus sign is not acceptable | ||
features: [Temporal] | ||
---*/ | ||
|
||
const invalidStrings = [ | ||
"1976-11-18T15:23:30.12\u221202:00", | ||
"\u2212009999-11-18T15:23:30.12", | ||
]; | ||
const instance = new Temporal.PlainDate(2000, 5, 2); | ||
invalidStrings.forEach((arg) => { | ||
assert.throws( | ||
RangeError, | ||
() => instance.toPlainDateTime(arg), | ||
`variant minus sign: ${arg}` | ||
); | ||
}); |
21 changes: 21 additions & 0 deletions
21
test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-minus-sign.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,21 @@ | ||
// Copyright (C) 2024 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: Non-ASCII minus sign is not acceptable | ||
features: [Temporal] | ||
---*/ | ||
|
||
const invalidStrings = [ | ||
"1976-11-18T15:23:30.12\u221202:00", | ||
"\u2212009999-11-18T15:23:30.12", | ||
]; | ||
const instance = new Temporal.PlainDate(2000, 5, 2); | ||
invalidStrings.forEach((arg) => { | ||
assert.throws( | ||
RangeError, | ||
() => instance.toZonedDateTime({ plainTime: arg, timeZone: "UTC" }), | ||
`variant minus sign: ${arg}` | ||
); | ||
}); |
21 changes: 21 additions & 0 deletions
21
test/built-ins/Temporal/PlainDate/prototype/until/argument-string-minus-sign.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,21 @@ | ||
// Copyright (C) 2024 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.plaindate.prototype.until | ||
description: Non-ASCII minus sign is not acceptable | ||
features: [Temporal] | ||
---*/ | ||
|
||
const invalidStrings = [ | ||
"1976-11-18T15:23:30.12\u221202:00", | ||
"\u2212009999-11-18T15:23:30.12", | ||
]; | ||
const instance = new Temporal.PlainDate(2000, 5, 2); | ||
invalidStrings.forEach((arg) => { | ||
assert.throws( | ||
RangeError, | ||
() => instance.until(arg), | ||
`variant minus sign: ${arg}` | ||
); | ||
}); |
27 changes: 27 additions & 0 deletions
27
test/built-ins/Temporal/PlainDateTime/compare/argument-string-minus-sign.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,27 @@ | ||
// Copyright (C) 2024 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: Non-ASCII minus sign is not acceptable | ||
features: [Temporal] | ||
---*/ | ||
|
||
const invalidStrings = [ | ||
"1976-11-18T15:23:30.12\u221202:00", | ||
"\u2212009999-11-18T15:23:30.12", | ||
]; | ||
|
||
invalidStrings.forEach((arg) => { | ||
assert.throws( | ||
RangeError, | ||
() => Temporal.PlainDateTime.compare(arg, new Temporal.PlainDateTime(1976, 11, 18)), | ||
`variant minus sign: ${arg} (first argument)` | ||
); | ||
|
||
assert.throws( | ||
RangeError, | ||
() => Temporal.PlainDateTime.compare(new Temporal.PlainDateTime(1976, 11, 18), arg), | ||
`variant minus sign: ${arg} (second argument)` | ||
); | ||
}); |
26 changes: 13 additions & 13 deletions
26
test/built-ins/Temporal/PlainDateTime/from/argument-string-minus-sign.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 |
---|---|---|
@@ -1,21 +1,21 @@ | ||
// Copyright (C) 2022 Igalia, S.L. All rights reserved. | ||
// Copyright (C) 2024 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.plaindatetime.from | ||
description: Non-ASCII minus sign is acceptable | ||
description: Non-ASCII minus sign is not acceptable | ||
features: [Temporal] | ||
includes: [temporalHelpers.js] | ||
---*/ | ||
|
||
TemporalHelpers.assertPlainDateTime( | ||
Temporal.PlainDateTime.from("1976-11-18T15:23:30.12\u221202:00"), | ||
1976, 11, "M11", 18, 15, 23, 30, 120, 0, 0, | ||
"variant minus sign (offset)" | ||
); | ||
const invalidStrings = [ | ||
"1976-11-18T15:23:30.12\u221202:00", | ||
"\u2212009999-11-18T15:23:30.12", | ||
]; | ||
|
||
TemporalHelpers.assertPlainDateTime( | ||
Temporal.PlainDateTime.from("\u2212009999-11-18T15:23:30.12"), | ||
-9999, 11, "M11", 18, 15, 23, 30, 120, 0, 0, | ||
"variant minus sign (leading minus)" | ||
); | ||
invalidStrings.forEach((arg) => { | ||
assert.throws( | ||
RangeError, | ||
() => Temporal.PlainDateTime.from(arg), | ||
`variant minus sign: ${arg}` | ||
); | ||
}); |
21 changes: 21 additions & 0 deletions
21
test/built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-minus-sign.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,21 @@ | ||
// Copyright (C) 2024 Igalia, S.L. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
esid: sec-temporal.plaindatetime.prototype.equals | ||
description: Non-ASCII minus sign is not acceptable | ||
features: [Temporal] | ||
---*/ | ||
|
||
const invalidStrings = [ | ||
"1976-11-18T15:23:30.12\u221202:00", | ||
"\u2212009999-11-18T15:23:30.12", | ||
]; | ||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321); | ||
invalidStrings.forEach((arg) => { | ||
assert.throws( | ||
RangeError, | ||
() => instance.equals(arg), | ||
`variant minus sign: ${arg}` | ||
); | ||
}); |
Oops, something went wrong.