Temporal: Deduplicate strings-with-calendar from strings-without-calendar

The strings with calendar annotations in these tests don't need to be
listed separately, they can be derived from the original strings.
This commit is contained in:
Philip Chimento 2022-08-17 12:34:48 -07:00 committed by Philip Chimento
parent 409d6dc71a
commit ddef61a106
9 changed files with 191 additions and 227 deletions

View File

@ -16,16 +16,11 @@ const ambiguousStrings = [
"1130", // ditto, including DD that doesn't occur in every month "1130", // ditto, including DD that doesn't occur in every month
"12-14", // ambiguity between MM-DD and HH-UU "12-14", // ambiguity between MM-DD and HH-UU
"202112", // ambiguity between YYYYMM and HHMMSS "202112", // ambiguity between YYYYMM and HHMMSS
// same strings as above but with a calendar annotation, which must not cause
// disambiguation in favour of time
"2021-12[u-ca=iso8601]",
"1214[u-ca=iso8601]",
"0229[u-ca=iso8601]",
"1130[u-ca=iso8601]",
"12-14[u-ca=iso8601]",
"202112[u-ca=iso8601]",
]; ];
ambiguousStrings.forEach((string) => { ambiguousStrings.forEach((stringWithoutCalendar) => {
// calendar annotation must not cause disambiguation in favour of time
const stringWithCalendar = stringWithoutCalendar + '[u-ca=iso8601]';
[stringWithoutCalendar, stringWithCalendar].forEach((string) => {
let arg = string; let arg = string;
assert.throws( assert.throws(
RangeError, RangeError,
@ -43,6 +38,7 @@ ambiguousStrings.forEach((string) => {
"space is not accepted as a substitute for T prefix" "space is not accepted as a substitute for T prefix"
); );
}); });
});
// None of these should throw without a T prefix, because they are unambiguously time strings: // None of these should throw without a T prefix, because they are unambiguously time strings:
const unambiguousStrings = [ const unambiguousStrings = [

View File

@ -16,16 +16,11 @@ const ambiguousStrings = [
"1130", // ditto, including DD that doesn't occur in every month "1130", // ditto, including DD that doesn't occur in every month
"12-14", // ambiguity between MM-DD and HH-UU "12-14", // ambiguity between MM-DD and HH-UU
"202112", // ambiguity between YYYYMM and HHMMSS "202112", // ambiguity between YYYYMM and HHMMSS
// same strings as above but with a calendar annotation, which must not cause
// disambiguation in favour of time
"2021-12[u-ca=iso8601]",
"1214[u-ca=iso8601]",
"0229[u-ca=iso8601]",
"1130[u-ca=iso8601]",
"12-14[u-ca=iso8601]",
"202112[u-ca=iso8601]",
]; ];
ambiguousStrings.forEach((string) => { ambiguousStrings.forEach((stringWithoutCalendar) => {
// calendar annotation must not cause disambiguation in favour of time
const stringWithCalendar = stringWithoutCalendar + '[u-ca=iso8601]';
[stringWithoutCalendar, stringWithCalendar].forEach((string) => {
let arg = string; let arg = string;
assert.throws( assert.throws(
RangeError, RangeError,
@ -43,6 +38,7 @@ ambiguousStrings.forEach((string) => {
"space is not accepted as a substitute for T prefix" "space is not accepted as a substitute for T prefix"
); );
}); });
});
// None of these should throw without a T prefix, because they are unambiguously time strings: // None of these should throw without a T prefix, because they are unambiguously time strings:
const unambiguousStrings = [ const unambiguousStrings = [

View File

@ -16,16 +16,11 @@ const ambiguousStrings = [
"1130", // ditto, including DD that doesn't occur in every month "1130", // ditto, including DD that doesn't occur in every month
"12-14", // ambiguity between MM-DD and HH-UU "12-14", // ambiguity between MM-DD and HH-UU
"202112", // ambiguity between YYYYMM and HHMMSS "202112", // ambiguity between YYYYMM and HHMMSS
// same strings as above but with a calendar annotation, which must not cause
// disambiguation in favour of time
"2021-12[u-ca=iso8601]",
"1214[u-ca=iso8601]",
"0229[u-ca=iso8601]",
"1130[u-ca=iso8601]",
"12-14[u-ca=iso8601]",
"202112[u-ca=iso8601]",
]; ];
ambiguousStrings.forEach((string) => { ambiguousStrings.forEach((stringWithoutCalendar) => {
// calendar annotation must not cause disambiguation in favour of time
const stringWithCalendar = stringWithoutCalendar + '[u-ca=iso8601]';
[stringWithoutCalendar, stringWithCalendar].forEach((string) => {
let arg = string; let arg = string;
assert.throws( assert.throws(
RangeError, RangeError,
@ -43,6 +38,7 @@ ambiguousStrings.forEach((string) => {
"space is not accepted as a substitute for T prefix" "space is not accepted as a substitute for T prefix"
); );
}); });
});
// None of these should throw without a T prefix, because they are unambiguously time strings: // None of these should throw without a T prefix, because they are unambiguously time strings:
const unambiguousStrings = [ const unambiguousStrings = [

View File

@ -16,16 +16,11 @@ const ambiguousStrings = [
"1130", // ditto, including DD that doesn't occur in every month "1130", // ditto, including DD that doesn't occur in every month
"12-14", // ambiguity between MM-DD and HH-UU "12-14", // ambiguity between MM-DD and HH-UU
"202112", // ambiguity between YYYYMM and HHMMSS "202112", // ambiguity between YYYYMM and HHMMSS
// same strings as above but with a calendar annotation, which must not cause
// disambiguation in favour of time
"2021-12[u-ca=iso8601]",
"1214[u-ca=iso8601]",
"0229[u-ca=iso8601]",
"1130[u-ca=iso8601]",
"12-14[u-ca=iso8601]",
"202112[u-ca=iso8601]",
]; ];
ambiguousStrings.forEach((string) => { ambiguousStrings.forEach((stringWithoutCalendar) => {
// calendar annotation must not cause disambiguation in favour of time
const stringWithCalendar = stringWithoutCalendar + '[u-ca=iso8601]';
[stringWithoutCalendar, stringWithCalendar].forEach((string) => {
let arg = string; let arg = string;
assert.throws( assert.throws(
RangeError, RangeError,
@ -54,6 +49,7 @@ ambiguousStrings.forEach((string) => {
'space is not accepted as a substitute for T prefix (second argument)' 'space is not accepted as a substitute for T prefix (second argument)'
); );
}); });
});
// None of these should throw without a T prefix, because they are unambiguously time strings: // None of these should throw without a T prefix, because they are unambiguously time strings:
const unambiguousStrings = [ const unambiguousStrings = [

View File

@ -14,16 +14,11 @@ const ambiguousStrings = [
"1130", // ditto, including DD that doesn't occur in every month "1130", // ditto, including DD that doesn't occur in every month
"12-14", // ambiguity between MM-DD and HH-UU "12-14", // ambiguity between MM-DD and HH-UU
"202112", // ambiguity between YYYYMM and HHMMSS "202112", // ambiguity between YYYYMM and HHMMSS
// same strings as above but with a calendar annotation, which must not cause
// disambiguation in favour of time
"2021-12[u-ca=iso8601]",
"1214[u-ca=iso8601]",
"0229[u-ca=iso8601]",
"1130[u-ca=iso8601]",
"12-14[u-ca=iso8601]",
"202112[u-ca=iso8601]",
]; ];
ambiguousStrings.forEach((string) => { ambiguousStrings.forEach((stringWithoutCalendar) => {
// calendar annotation must not cause disambiguation in favour of time
const stringWithCalendar = stringWithoutCalendar + '[u-ca=iso8601]';
[stringWithoutCalendar, stringWithCalendar].forEach((string) => {
let arg = string; let arg = string;
assert.throws( assert.throws(
RangeError, RangeError,
@ -41,6 +36,7 @@ ambiguousStrings.forEach((string) => {
"space is not accepted as a substitute for T prefix" "space is not accepted as a substitute for T prefix"
); );
}); });
});
// None of these should throw without a T prefix, because they are unambiguously time strings: // None of these should throw without a T prefix, because they are unambiguously time strings:
const unambiguousStrings = [ const unambiguousStrings = [

View File

@ -16,16 +16,11 @@ const ambiguousStrings = [
"1130", // ditto, including DD that doesn't occur in every month "1130", // ditto, including DD that doesn't occur in every month
"12-14", // ambiguity between MM-DD and HH-UU "12-14", // ambiguity between MM-DD and HH-UU
"202112", // ambiguity between YYYYMM and HHMMSS "202112", // ambiguity between YYYYMM and HHMMSS
// same strings as above but with a calendar annotation, which must not cause
// disambiguation in favour of time
"2021-12[u-ca=iso8601]",
"1214[u-ca=iso8601]",
"0229[u-ca=iso8601]",
"1130[u-ca=iso8601]",
"12-14[u-ca=iso8601]",
"202112[u-ca=iso8601]",
]; ];
ambiguousStrings.forEach((string) => { ambiguousStrings.forEach((stringWithoutCalendar) => {
// calendar annotation must not cause disambiguation in favour of time
const stringWithCalendar = stringWithoutCalendar + '[u-ca=iso8601]';
[stringWithoutCalendar, stringWithCalendar].forEach((string) => {
let arg = string; let arg = string;
assert.throws( assert.throws(
RangeError, RangeError,
@ -43,6 +38,7 @@ ambiguousStrings.forEach((string) => {
"space is not accepted as a substitute for T prefix" "space is not accepted as a substitute for T prefix"
); );
}); });
});
// None of these should throw without a T prefix, because they are unambiguously time strings: // None of these should throw without a T prefix, because they are unambiguously time strings:
const unambiguousStrings = [ const unambiguousStrings = [

View File

@ -16,16 +16,11 @@ const ambiguousStrings = [
"1130", // ditto, including DD that doesn't occur in every month "1130", // ditto, including DD that doesn't occur in every month
"12-14", // ambiguity between MM-DD and HH-UU "12-14", // ambiguity between MM-DD and HH-UU
"202112", // ambiguity between YYYYMM and HHMMSS "202112", // ambiguity between YYYYMM and HHMMSS
// same strings as above but with a calendar annotation, which must not cause
// disambiguation in favour of time
"2021-12[u-ca=iso8601]",
"1214[u-ca=iso8601]",
"0229[u-ca=iso8601]",
"1130[u-ca=iso8601]",
"12-14[u-ca=iso8601]",
"202112[u-ca=iso8601]",
]; ];
ambiguousStrings.forEach((string) => { ambiguousStrings.forEach((stringWithoutCalendar) => {
// calendar annotation must not cause disambiguation in favour of time
const stringWithCalendar = stringWithoutCalendar + '[u-ca=iso8601]';
[stringWithoutCalendar, stringWithCalendar].forEach((string) => {
let arg = string; let arg = string;
assert.throws( assert.throws(
RangeError, RangeError,
@ -43,6 +38,7 @@ ambiguousStrings.forEach((string) => {
"space is not accepted as a substitute for T prefix" "space is not accepted as a substitute for T prefix"
); );
}); });
});
// None of these should throw without a T prefix, because they are unambiguously time strings: // None of these should throw without a T prefix, because they are unambiguously time strings:
const unambiguousStrings = [ const unambiguousStrings = [

View File

@ -16,16 +16,11 @@ const ambiguousStrings = [
"1130", // ditto, including DD that doesn't occur in every month "1130", // ditto, including DD that doesn't occur in every month
"12-14", // ambiguity between MM-DD and HH-UU "12-14", // ambiguity between MM-DD and HH-UU
"202112", // ambiguity between YYYYMM and HHMMSS "202112", // ambiguity between YYYYMM and HHMMSS
// same strings as above but with a calendar annotation, which must not cause
// disambiguation in favour of time
"2021-12[u-ca=iso8601]",
"1214[u-ca=iso8601]",
"0229[u-ca=iso8601]",
"1130[u-ca=iso8601]",
"12-14[u-ca=iso8601]",
"202112[u-ca=iso8601]",
]; ];
ambiguousStrings.forEach((string) => { ambiguousStrings.forEach((stringWithoutCalendar) => {
// calendar annotation must not cause disambiguation in favour of time
const stringWithCalendar = stringWithoutCalendar + '[u-ca=iso8601]';
[stringWithoutCalendar, stringWithCalendar].forEach((string) => {
let arg = string; let arg = string;
assert.throws( assert.throws(
RangeError, RangeError,
@ -43,6 +38,7 @@ ambiguousStrings.forEach((string) => {
"space is not accepted as a substitute for T prefix" "space is not accepted as a substitute for T prefix"
); );
}); });
});
// None of these should throw without a T prefix, because they are unambiguously time strings: // None of these should throw without a T prefix, because they are unambiguously time strings:
const unambiguousStrings = [ const unambiguousStrings = [

View File

@ -16,16 +16,11 @@ const ambiguousStrings = [
"1130", // ditto, including DD that doesn't occur in every month "1130", // ditto, including DD that doesn't occur in every month
"12-14", // ambiguity between MM-DD and HH-UU "12-14", // ambiguity between MM-DD and HH-UU
"202112", // ambiguity between YYYYMM and HHMMSS "202112", // ambiguity between YYYYMM and HHMMSS
// same strings as above but with a calendar annotation, which must not cause
// disambiguation in favour of time
"2021-12[u-ca=iso8601]",
"1214[u-ca=iso8601]",
"0229[u-ca=iso8601]",
"1130[u-ca=iso8601]",
"12-14[u-ca=iso8601]",
"202112[u-ca=iso8601]",
]; ];
ambiguousStrings.forEach((string) => { ambiguousStrings.forEach((stringWithoutCalendar) => {
// calendar annotation must not cause disambiguation in favour of time
const stringWithCalendar = stringWithoutCalendar + '[u-ca=iso8601]';
[stringWithoutCalendar, stringWithCalendar].forEach((string) => {
let arg = string; let arg = string;
assert.throws( assert.throws(
RangeError, RangeError,
@ -43,6 +38,7 @@ ambiguousStrings.forEach((string) => {
"space is not accepted as a substitute for T prefix" "space is not accepted as a substitute for T prefix"
); );
}); });
});
// None of these should throw without a T prefix, because they are unambiguously time strings: // None of these should throw without a T prefix, because they are unambiguously time strings:
const unambiguousStrings = [ const unambiguousStrings = [