forked from todotxt/todo.txt-cli
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUG: listpri picked up non-priority patterns.
The regexp for the priority wasn't anchored to the beginning of the task. (As the filtering is done inside the _list pipeline, the task number has already been prepended.) Also, by passing the regexp directly to _list, a case-insensitive search was performed, so despite [A-Z], lowercase characters were picked up, too. Need to make use of post_filter_command to inject a separate, case-sensitive grep into the pipeline. Bonus: Added test for highlighting of listpri command.
- Loading branch information
1 parent
f8b66f1
commit 0fa5f6d
Showing
2 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/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_todo_session 'listpri highlighting' <<EOF | ||
>>> todo.sh listpri | ||
[0;32m1 (B) smell the uppercase Roses +flowers @outside[0m | ||
[1;34m2 (C) notice the sunflowers[0m | ||
-- | ||
TODO: 2 of 3 tasks shown | ||
EOF | ||
|
||
cat > todo.txt <<EOF | ||
(B) smell the uppercase Roses +flowers @outside | ||
(C) notice the sunflowers | ||
(m)others will notice this | ||
(n) not a prioritized task | ||
notice the (C)opyright | ||
EOF | ||
test_todo_session 'listpri filtering' <<EOF | ||
>>> todo.sh -p listpri | ||
1 (B) smell the uppercase Roses +flowers @outside | ||
2 (C) notice the sunflowers | ||
-- | ||
TODO: 2 of 5 tasks shown | ||
>>> todo.sh -p listpri b | ||
1 (B) smell the uppercase Roses +flowers @outside | ||
-- | ||
TODO: 1 of 5 tasks shown | ||
>>> todo.sh -p listpri c | ||
2 (C) notice the sunflowers | ||
-- | ||
TODO: 1 of 5 tasks shown | ||
>>> todo.sh -p listpri m | ||
-- | ||
TODO: 0 of 5 tasks shown | ||
>>> todo.sh -p listpri n | ||
-- | ||
TODO: 0 of 5 tasks shown | ||
EOF | ||
|
||
test_done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters