Add test file for _is_auto_notify_ignored

This commit is contained in:
Michael Aquilina 2019-07-17 21:55:42 +01:00
parent 97bf608d4c
commit d6b002ee3b
No known key found for this signature in database
GPG key ID: 636066730B056BD1

View file

@ -0,0 +1,35 @@
#!/usr/bin/env zunit
@setup {
load "../auto-notify.plugin.zsh"
}
@test 'is_auto_notify_ignored - commands outside AUTO_NOTIFY_IGNORE' {
run _is_auto_notify_ignored "echo hello world"
assert $state equals 0
assert "$output" same_as "no"
}
@test 'is_auto_notify_ignored - all commands in AUTO_NOTIFY_IGNORE' {
for command in $AUTO_NOTIFY_IGNORE; do
run _is_auto_notify_ignored $command
assert $state equals 0
assert "$output" same_as "yes"
done
}
@test 'is_auto_notify_ignored - piped commands which are not ignored' {
run _is_auto_notify_ignored "echo hello world | base64 -e"
assert $state equals 0
assert "$output" same_as "no"
}
@test 'is_auto_notify_ignored - piped commands which are ignored' {
run _is_auto_notify_ignored "echo hello world | less -R"
assert $state equals 0
assert "$output" same_as "yes"
}