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.
36 lines
420 B
Bash
Executable File
36 lines
420 B
Bash
Executable File
#!/bin/bash
|
|
|
|
test_description='archive functionality
|
|
|
|
Ensure we can archive items successfully.
|
|
'
|
|
. ./test-lib.sh
|
|
|
|
cat > todo.txt <<EOF
|
|
one
|
|
two
|
|
three
|
|
one
|
|
x done
|
|
four
|
|
EOF
|
|
|
|
test_todo_session 'archive with duplicates' <<EOF
|
|
>>> todo.sh archive
|
|
x done
|
|
TODO: $HOME/todo.txt archived.
|
|
EOF
|
|
|
|
test_todo_session 'list after archive' <<EOF
|
|
>>> todo.sh ls
|
|
5 four
|
|
1 one
|
|
4 one
|
|
3 three
|
|
2 two
|
|
--
|
|
TODO: 5 of 5 tasks shown
|
|
EOF
|
|
|
|
test_done
|