tests: Reformat exit code error message

Now looks like:

Expected exit code '123' but got '0' from command 'echo' 'hi'
This commit is contained in:
Robert Hensing 2023-07-07 15:08:25 +02:00
parent 6db66ebfc5
commit 3b3822ea1d

View file

@ -195,7 +195,7 @@ expect() {
shift
"$@" && res=0 || res="$?"
if [[ $res -ne $expected ]]; then
echo "Expected '$expected' but got '$res' while running '${*@Q}'" >&2
echo "Expected exit code '$expected' but got '$res' from command ${*@Q}" >&2
return 1
fi
return 0
@ -209,7 +209,7 @@ expectStderr() {
shift
"$@" 2>&1 && res=0 || res="$?"
if [[ $res -ne $expected ]]; then
echo "Expected '$expected' but got '$res' while running '${*@Q}'" >&2
echo "Expected exit code '$expected' but got '$res' from command ${*@Q}" >&2
return 1
fi
return 0