This extension of test_todo_completion additionally takes the completion function to use, so that customized completions for todo.sh aliases can be tested.
Before adding any more features to todo_completion, I feel like I need test coverage, so this is a first stab at testing the completion results, via a new test function test_todo_completion.
Some basic tests showcase the capabilities.
Note: test-lib.sh now uses arrays, therefore all tests must use /bin/bash, not /bin/sh to avoid errors when sourcing test-lib. For consistency with todo.sh, we should have used Bash everywhere, anyway. Also note that t2000-multiline.sh needs some more quoting to avoid "Bash: ambiguous redirect" errors.
- 'add' and 'addm' now 'addto' with $TODO_FILE instead of user supplied file
- 'addto' now shows the capitalized filename in place of 'TODO:'.
For example, adding to garden.txt produces a output prefixed by 'GARDEN:'
(Probably the most controversial part of this commit and up for
discussion. If kept, the 'listfile' output should be made to match.
Note that this convention would then minimize standard output by
dropping the file name.)
- All existing add/addm/add-date tests pass. Two new test sequences were
added to test 'addto' and 'listfile' functionality.
- A space/tab nuissance was cleared up in the tests/README file.
Merge Phil's README_generate-test into the main README
and also update the test library documentation to reflect
test_todo_session and test_tick.
Signed-off-by: Emil Sit <sit@emilsit.net>
Add a basic test framework, borrowed from the framework used
by git.git. A shell script library (tests/test-lib.sh) helps
generate the fixtures, and simplifies the process of writing
test scripts. Tests can be run as a suite (via 'make test')
or individually (sh tests/t0000-config.sh). Results are aggregated
upon completion. Includes a detailed README.
A basic test of config file processing is part of this commit.
Signed-off-by: Emil Sit <sit@emilsit.net>