Open djmitche opened 1 year ago
From some discussion, it seems that things like -12:12:12
should not parse as datestamps at all (so, should return a variant with _date == 0
), in which case ColTypeDate would reject the input as the tests try to assert.
I skipped these tests for now because what is currently catching the errors (Task::composeJSON
) is being removed with the conversion to taskchampion.
./test/datetime-negative.t
tests that a bunch of invalid dates result in errors. The tests pass, but many of them only by accident. Considerthis is, indeed, an error, as the test expects. However:
-1668769932
; and''
It turns out that there are two places where an identical "is not a valid date in the" is thrown:
src/columns/ColTypeDate.cpp
src/libshared/src/Datetime.cpp
many of the cases in this test script are caught in the first spot, which is the expectation. However, when the input evaluates as an arithmetic expression and the result is not 0,
ColTypeDate.cpp
lets it pass. This date is then added to the new task, and only when that task is written to the backlog, viaTask::composeJSON
, is the error thrown.So, I think we need to do a better job of validating the input in
ColTypeDate.cpp
, preferably by calling the Datetime constructor to raise the exception in only that one spot. However, I don't understand the Variant implementation well enough to know how to do that. Can someone help me out?