From 0d748506a391d9b603eb20692fa65bccedd08ea6 Mon Sep 17 00:00:00 2001 From: Ryan Egesdahl Date: Tue, 14 Nov 2023 10:43:07 -0800 Subject: [PATCH] Remove extraneous `!` from test commands The `expect` and `assert` functions both accept `!` as their first argument, which negates the test. However, those functions were putting the `!` into the executed command, which is not correct shell syntax and can cause exrtraneous errors. The `!` is now `shift`ed out of the args and only the tested command is run. --- lib/test/test_assert.sh | 1 + lib/test/test_expect.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/test/test_assert.sh b/lib/test/test_assert.sh index 1fe328c..a3bd4ed 100644 --- a/lib/test/test_assert.sh +++ b/lib/test/test_assert.sh @@ -17,6 +17,7 @@ # :PREFIX:assert() { if [[ "$1" = "!" ]]; then + shift if ! "$@" &>/dev/null; then return 0 fi diff --git a/lib/test/test_expect.sh b/lib/test/test_expect.sh index 8c87e2d..fadd029 100644 --- a/lib/test/test_expect.sh +++ b/lib/test/test_expect.sh @@ -17,6 +17,7 @@ # :PREFIX:expect() { if [[ "$1" = "!" ]]; then + shift if ! "$@" &>/dev/null; then return 0 fi