Test for unusual task data (#3770)

* Test for unusual task data

A task might have any combination of keys and values, but Taskwarrior
often assumes that only valid values can occur, and crashes otherwise.
This is highly inconvenient, as it's often impossible to do anything
with the invalid task -- Taskwarrior just fails without modifying it.

So, this is the beginning of some testing for such invalid tasks, with
the goal of making Taskwarrior due something reasonable. In general, an
invalid attribute value is treated as if it was not set. This is not
exhaustive, and there are likely still bugs of this sort, but as we find
them we can fix and add regression tests to this script.

This introduces a new test-only binary that creates a "bare" task using
TaskChampion, avoiding Taskwarrior's efforts to not create "unusual"
tasks.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Dustin J. Mitchell 2025-02-05 08:20:35 -05:00 committed by GitHub
parent e1fc283da5
commit fdb7e5e020
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 368 additions and 41 deletions

View file

@ -188,6 +188,7 @@ set (pythonTests
undo.test.py
unicode.test.py
unique.test.py
unusual_task.test.py
upgrade.test.py
urgency.test.py
urgency_inherit.test.py
@ -207,6 +208,15 @@ foreach (python_Test ${pythonTests})
)
endforeach(python_Test)
# Create a `make_tc_task` binary, used for unusual_task.test.py. In order to build this
# for the tests, it's added as a dependency of `test_runner`.
add_executable (make_tc_task make_tc_task.cpp)
target_link_libraries (make_tc_task task commands columns libshared task commands columns libshared task commands columns libshared ${TASK_LIBRARIES})
if (DARWIN)
target_link_libraries (make_tc_task "-framework CoreFoundation -framework Security -framework SystemConfiguration")
endif (DARWIN)
add_dependencies(test_runner make_tc_task)
# -- Shell tests
set (shell_SRCS