Skip to content

Commit

Permalink
Hooks: Create custom checkdom function for tests
Browse files Browse the repository at this point in the history
Signed-off-by: xerus2000 <[email protected]>
  • Loading branch information
xeruf authored and lauft committed Mar 8, 2025
1 parent f9e0970 commit ea5bdf6
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions test-hooks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,36 @@ if test "$1" = "q"
then task() { command task "$@" 2>/dev/null; }
else $verbose || task() { command task "$@" 3>&1 1>&2 2>&3 3>&- | (grep -v "override:" || true); }
fi
checkdom() {
test "$(timew get dom.$1)" = "$2"
}

highlight A new task is started with correct time
task add test +t1 +t2 start:2020-04-04 entry:2020-04-03
debug task 1 info
test "$(timew get dom.active.start)" = "2020-04-04T00:00:00"
checkdom active.start "2020-04-04T00:00:00"

highlight Modify start time
task 1 modify start:2020-04-05T12:00
debug timew
test "$(timew get dom.active.start)" = "2020-04-05T12:00:00"
checkdom active.start "2020-04-05T12:00:00"

highlight Modify tags
task 1 modify +t3 project:testing
test "$(timew get dom.tag.count)" = "5"
checkdom tag.count "5"

highlight Modify start time of second task
task add test2 +t2 entry:2020-04-03
task 2 info
task 2 modify start:2020-04-06
test "$(timew get dom.tracked.count)" = "1"
test "$(timew get dom.tag.count)" = "5"
test "$(timew get dom.active.start)" = "2020-04-05T12:00:00"
checkdom tracked.count "1"
checkdom tag.count "5"
checkdom active.start "2020-04-05T12:00:00"

highlight Modify tags of second now started task
task 2 modify +t3
debug timew
test "$(timew get dom.tag.count)" = "5"
test "$(timew get dom.active.start)" = "2020-04-05T12:00:00"
checkdom tag.count "5"
checkdom active.start "2020-04-05T12:00:00"

highlight Start different task
#task start 1

0 comments on commit ea5bdf6

Please sign in to comment.