My working unpac space for OCaml projects in development
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[Temporal] Add test coverage for offset string of the form +00:0000

This string shouldn't parse (+00:00:00 or +000000 would be valid).

Add tests for date/time strings containing this offset for
Instant, PlainDateTime, PlainTime, and ZonedDateTime. Also add a
test for ZonedDateTime taking this offset in a property bag, and as
a relativeTo parameter.

authored by

Tim Chevalier and committed by
GitHub
96f304b5 8eedf359

+84 -6
+1
vendor/git/test262/test/built-ins/Temporal/Duration/compare/relativeto-propertybag-invalid-offset-string.js
··· 18 18 null, // must be a string 19 19 true, // must be a string 20 20 1000n, // must be a string 21 + "+00:0000", // separator must be consistent for hours/minutes and minutes/seconds 21 22 ]; 22 23 badOffsets.forEach((offset) => { 23 24 const relativeTo = { year: 2021, month: 10, day: 28, offset, timeZone: "UTC" };
+9 -2
vendor/git/test262/test/built-ins/Temporal/Duration/compare/relativeto-string-zoneddatetime.js
··· 7 7 features: [Temporal] 8 8 ---*/ 9 9 10 + const duration1 = new Temporal.Duration(0, 0, 0, 31); 11 + const duration2 = new Temporal.Duration(0, 1); 12 + 10 13 [ 11 14 '2000-01-01[UTC]', 12 15 '2000-01-01T00:00[UTC]', 13 16 '2000-01-01T00:00+00:00[UTC]', 14 17 '2000-01-01T00:00+00:00[UTC][u-ca=iso8601]', 15 18 ].forEach((relativeTo) => { 16 - const duration1 = new Temporal.Duration(0, 0, 0, 31); 17 - const duration2 = new Temporal.Duration(0, 1); 18 19 const result = Temporal.Duration.compare(duration1, duration2, { relativeTo }); 19 20 assert.sameValue(result, 0); 20 21 }); 22 + 23 + [ 24 + '2025-01-01T00:00:00+00:0000[UTC]' 25 + ].forEach((relativeTo) => { 26 + assert.throws(RangeError, () => Temporal.Duration.compare(duration1, duration2, { relativeTo }), "separators in offset are inconsistent"); 27 + });
+1
vendor/git/test262/test/built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-invalid-offset-string.js
··· 18 18 null, // must be a string 19 19 true, // must be a string 20 20 1000n, // must be a string 21 + "+00:0000", // separator must be consistent for hours/minutes and minutes/seconds 21 22 ]; 22 23 badOffsets.forEach((offset) => { 23 24 const relativeTo = { year: 2021, month: 10, day: 28, offset, timeZone };
+3
vendor/git/test262/test/built-ins/Temporal/Duration/prototype/round/relativeto-string-datetime.js
··· 36 36 assert.throws(RangeError, () => instance.round({ largestUnit: "years", relativeTo }), "date-time + Z throws without an IANA annotation"); 37 37 relativeTo = "2019-11-01T00:00+04:15[UTC]"; 38 38 assert.throws(RangeError, () => instance.round({ largestUnit: "years", relativeTo }), "date-time + offset + IANA annotation throws if wall time and exact time mismatch"); 39 + 40 + relativeTo = "2025-01-01T00:00:00+00:0000"; 41 + assert.throws(RangeError, () => instance.round({ largestUnit: "years", relativeTo }), "date-time with offset like 00:0000 shouldn't parse");
+1
vendor/git/test262/test/built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-invalid-offset-string.js
··· 18 18 null, // must be a string 19 19 true, // must be a string 20 20 1000n, // must be a string 21 + "+00:0000", // separator must be consistent for hours/minutes and minutes/seconds 21 22 ]; 22 23 badOffsets.forEach((offset) => { 23 24 const relativeTo = { year: 2021, month: 10, day: 28, offset, timeZone };
+3
vendor/git/test262/test/built-ins/Temporal/Duration/prototype/total/relativeto-string-datetime.js
··· 35 35 assert.throws(RangeError, () => instance.total({ unit: "days", relativeTo }), "date-time + Z throws without an IANA annotation"); 36 36 relativeTo = "2019-11-01T00:00+04:15[UTC]"; 37 37 assert.throws(RangeError, () => instance.total({ unit: "days", relativeTo }), "date-time + offset + IANA annotation throws if wall time and exact time mismatch"); 38 + 39 + relativeTo = "2025-01-01T00:00:00+00:0000"; 40 + assert.throws(RangeError, () => instance.total({ unit: "days", relativeTo }), "date-time with offset like 00:0000 shouldn't parse");
+3
vendor/git/test262/test/built-ins/Temporal/Instant/from/argument-string-invalid.js
··· 56 56 // valid, but outside the supported range: 57 57 "-999999-01-01T00:00Z", 58 58 "+999999-01-01T00:00Z", 59 + // "00:0000" is invalid (the hour/minute and minute/second separator 60 + // or lack thereof needs to match). 61 + "2025-01-01T00:00:00+00:0000", 59 62 ]; 60 63 for (const arg of invalidStrings) { 61 64 assert.throws(
+3
vendor/git/test262/test/built-ins/Temporal/PlainDateTime/from/argument-string-invalid.js
··· 48 48 // valid, but outside the supported range: 49 49 "-999999-01-01", 50 50 "+999999-01-01", 51 + // "00:0000" is invalid (the hour/minute and minute/second separator 52 + // or lack thereof needs to match). 53 + "2025-01-01T00:00:00+00:0000" 51 54 ]; 52 55 53 56 invalidStrings.forEach((s) => {
+42
vendor/git/test262/test/built-ins/Temporal/PlainTime/from/argument-string-invalid.js
··· 1 + // Copyright (C) 2025 Igalia S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plaintime.from 6 + description: > 7 + RangeError thrown if an invalid ISO string (or syntactically valid ISO string 8 + that is not supported) is used as a PlainTime 9 + features: [Temporal, arrow-function] 10 + ---*/ 11 + 12 + const invalidStrings = [ 13 + // invalid ISO strings: 14 + "", 15 + "invalid iso8601", 16 + "00:00Z", 17 + "Z", 18 + "25:00:00Z", 19 + "01:60:00Z", 20 + "01:60:61Z", 21 + "00:00Zjunk", 22 + "00:00:00Zjunk", 23 + "00:00:00.000000000Zjunk", 24 + "00:00:00+00:00junk", 25 + "00:00:00+00:00[UTC]junk", 26 + "00:00:00+00:00[UTC][u-ca=iso8601]junk", 27 + "001Z", 28 + "01:001Z", 29 + "01:01:001Z", 30 + "00:00-24:00", 31 + "00:00+24:00", 32 + // "00:0000" is invalid (the hour/minute and minute/second separator 33 + // or lack thereof needs to match). 34 + "00:00:00+00:0000", 35 + ]; 36 + for (const arg of invalidStrings) { 37 + assert.throws( 38 + RangeError, 39 + () => Temporal.PlainTime.from(arg), 40 + `"${arg}" should not be a valid ISO string for a PlainTime` 41 + ); 42 + }
+13
vendor/git/test262/test/built-ins/Temporal/ZonedDateTime/from/argument-string-invalid.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.zoneddatetime.from 6 + description: > 7 + Check that UTC offsets are parsed properly 8 + features: [Temporal, Intl.Era-monthcode] 9 + ---*/ 10 + 11 + assert.throws(RangeError, 12 + () => Temporal.ZonedDateTime.from("2025-01-01T00:00:00+00:0000[UTC]"), 13 + "UTCOffset must be of the form hh:mm:ss or hhmmss");
+5 -4
vendor/git/test262/test/built-ins/Temporal/ZonedDateTime/from/offset-string-invalid.js
··· 3 3 4 4 /*--- 5 5 esid: sec-temporal.zoneddatetime.from 6 - description: Validation of monthCode 6 + description: Validation of offset 7 7 features: [Temporal] 8 8 ---*/ 9 9 10 - const bag = { year: 2024, monthCode: "M10", day: 3, timeZone: "UTC" }; 11 - 12 - ["garbage", "00:00", "+000:00", "-00:000", "-00:00:000", "+00:00.0", "+00:00:00.0000000000"].forEach((offset) => { 10 + // "+00:0000" is invalid (the hour/minute and minute/second separator 11 + // or lack thereof needs to match). A valid offset would be either 12 + // +00:00:00 or +000000. 13 + ["garbage", "00:00", "+000:00", "-00:000", "-00:00:000", "+00:00.0", "+00:00:00.0000000000", "+00:0000"].forEach((offset) => { 13 14 assert.throws(RangeError, () => Temporal.ZonedDateTime.from({ offset, year: 2024, monthCode: "M10", day: 3, timeZone: "UTC" }), 14 15 `UTC offset '${offset}' is not well-formed`); 15 16 });