diff --git a/tests/p_which/which_basic.sh b/tests/p_which/which_basic.sh index aba83f3..5328f33 100755 --- a/tests/p_which/which_basic.sh +++ b/tests/p_which/which_basic.sh @@ -1,6 +1,6 @@ #!/bin/bash # Author: Alice Kaerast -t_Log "$0 - Checking which can find itself" +t_Log "Running $0 - Checking which can find itself" /usr/bin/which which | grep -q "/usr/bin/which" t_CheckExitStatus $? diff --git a/tests/p_which/which_fail.sh b/tests/p_which/which_fail.sh new file mode 100755 index 0000000..a3420b6 --- /dev/null +++ b/tests/p_which/which_fail.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Author: Alice Kaerast + +t_Log "Running $0 - Checking which can fails on non-existing commands" +which abc123 2> /dev/null +[ $? -eq 1 ] || { t_Log "Which should have exited with 1 for a non-existing file"; exit $FAIL; } +t_CheckExitStatus $?