Verify that check_active_task only counts active tasks
This commit is contained in:
parent
0a3f02198f
commit
e5bf621ec8
|
@ -11,8 +11,12 @@ taskl() {
|
|||
list
|
||||
}
|
||||
|
||||
get_active_task_count() {
|
||||
taskl +ACTIVE | wc -l
|
||||
}
|
||||
|
||||
check_active_task() {
|
||||
taskcount="$(taskl +ACTIVE | wc -l)"
|
||||
taskcount="$(get_active_task_count)"
|
||||
|
||||
if test "$taskcount" -eq 0; then
|
||||
return 1
|
||||
|
|
|
@ -22,6 +22,16 @@ test_taskl_runs_task_with_custom_parameters() {
|
|||
assert_equals "$expected" "$result"
|
||||
}
|
||||
|
||||
test_get_active_task_count_calls_taskl_with_correct_filter() {
|
||||
fake taskl 'echo "taskl ${FAKE_PARAMS[@]}"'
|
||||
fake wc 'cat'
|
||||
expected="taskl +ACTIVE"
|
||||
|
||||
result="$(get_active_task_count)"
|
||||
|
||||
assert_equals "$expected" "$result"
|
||||
}
|
||||
|
||||
test_check_active_task_returns_1_when_no_active_task() {
|
||||
fake task 'printf ""'
|
||||
expected=1
|
||||
|
|
Loading…
Reference in New Issue