feat: tag support for skip/stop, requiring a force, similar to rm -f
This commit is contained in:
parent
f68a92323c
commit
8cf79c854b
5 changed files with 239 additions and 36 deletions
|
|
@ -32,3 +32,32 @@ load test_helper
|
|||
run_nag stop
|
||||
[ "${status}" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "stop by tag requires -f" {
|
||||
run_nag at "tomorrow 3pm" "tagged alarm"
|
||||
run_nag tag 1 work
|
||||
run "${_NAG}" stop work
|
||||
[ "${status}" -eq 0 ]
|
||||
[[ "${output}" =~ "Would stop" ]]
|
||||
[[ "${output}" =~ "-f" ]]
|
||||
[ -s "${NAG_DIR}/alarms" ]
|
||||
}
|
||||
|
||||
@test "stop by tag with -f removes matching alarms" {
|
||||
run_nag at "tomorrow 3pm" "work alarm"
|
||||
run_nag tag 1 work
|
||||
run_nag at "tomorrow 4pm" "personal alarm"
|
||||
run "${_NAG}" -f stop work
|
||||
[ "${status}" -eq 0 ]
|
||||
[[ "${output}" =~ "Stopped" ]]
|
||||
[[ "${output}" =~ "work alarm" ]]
|
||||
run_nag
|
||||
[[ "${output}" =~ "personal alarm" ]]
|
||||
[[ ! "${output}" =~ "work alarm" ]]
|
||||
}
|
||||
|
||||
@test "stop by tag with no matches fails" {
|
||||
run_nag at "tomorrow 3pm" "test alarm"
|
||||
run "${_NAG}" -f stop work
|
||||
[ "${status}" -eq 1 ]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue