Split off dedicated tests for listpri.

Bonus: Fixed alignment of listpri help message.
This commit is contained in:
Ingo Karkat
2011-05-10 14:54:59 +02:00
parent 56bd927747
commit a830f18dd5
3 changed files with 33 additions and 3 deletions

View File

@@ -87,10 +87,11 @@ TODO: 3 of 3 tasks shown
2 (A) notice the sunflowers 2 (A) notice the sunflowers
TODO: 2 already prioritized (A). TODO: 2 already prioritized (A).
>>> todo.sh -p listpri >>> todo.sh -p list
2 (A) notice the sunflowers 2 (A) notice the sunflowers
1 (B) smell the uppercase Roses +flowers @outside 1 (B) smell the uppercase Roses +flowers @outside
3 stop
-- --
TODO: 2 of 3 tasks shown TODO: 3 of 3 tasks shown
EOF EOF
test_done test_done

29
tests/t1250-listpri.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/sh
test_description='list priority functionality
'
. ./test-lib.sh
test_todo_session 'listpri usage' <<EOF
>>> todo.sh listpri ?
usage: todo.sh listpri PRIORITY
note: PRIORITY must a single letter from A to Z.
=== 1
EOF
cat > todo.txt <<EOF
(B) smell the uppercase Roses +flowers @outside
(C) notice the sunflowers
stop
EOF
test_todo_session 'basic listpri' <<EOF
>>> todo.sh listpri A
--
TODO: 0 of 3 tasks shown
>>> todo.sh -p listpri c
2 (C) notice the sunflowers
--
TODO: 1 of 3 tasks shown
EOF
test_done

View File

@@ -1016,7 +1016,7 @@ case $action in
## A priority was specified ## A priority was specified
pri=$( printf "%s\n" "$1" | tr 'a-z' 'A-Z' | grep '^[A-Z]$' ) || { pri=$( printf "%s\n" "$1" | tr 'a-z' 'A-Z' | grep '^[A-Z]$' ) || {
die "usage: $TODO_SH listpri PRIORITY die "usage: $TODO_SH listpri PRIORITY
note: PRIORITY must a single letter from A to Z." note: PRIORITY must a single letter from A to Z."
} }
else else
## No priority specified; show all priority tasks ## No priority specified; show all priority tasks