summaryrefslogtreecommitdiff
path: root/tests/programs-zsh.nix
diff options
context:
space:
mode:
authorMichael Hoang <enzime@users.noreply.github.com>2024-10-24 23:55:25 +1100
committerMichael Hoang <enzime@users.noreply.github.com>2024-10-27 21:26:19 +1100
commitfd6660cb9182fde5e593246e311dc3c2dd4b9d13 (patch)
treeb4ff5faff0098a1cd0e4a6f7e18109ecf69a5b6b /tests/programs-zsh.nix
parent2eb472230a5400c81d9008014888b4bff23bcf44 (diff)
tests: fix negative asserts with `grep` not working
Using `grep -v` without `-z` will return 0 even if there is a match found as all the non-matching lines will be matched. Instead of using `grep -vqz`, `(! grep ...)` is more readable. The brackets are necessary as `! grep` will not trigger `set -e`[0], so we run it inside a subshell to use its non-zero exit code. [0]: https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#The-Set-Builtin
Diffstat (limited to 'tests/programs-zsh.nix')
-rw-r--r--tests/programs-zsh.nix2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/programs-zsh.nix b/tests/programs-zsh.nix
index 9c98c33..18680a5 100644
--- a/tests/programs-zsh.nix
+++ b/tests/programs-zsh.nix
@@ -34,7 +34,7 @@
echo >&2 "checking compinit in /etc/zshrc"
grep 'autoload -U compinit && compinit' ${config.out}/etc/zshrc
echo >&2 "checking bashcompinit in /etc/zshrc"
- grep -vq 'bashcompinit' ${config.out}/etc/zshrc
+ (! grep 'bashcompinit' ${config.out}/etc/zshrc)
echo >&2 "checking zprofile.d in /etc/zprofile"
grep 'source /etc/zprofile.d/\*.conf' ${config.out}/etc/zprofile