From 2845e64b74d364c9f5eff9e0c9cad6f92c9441df Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Wed, 19 Apr 2017 01:59:12 -0400 Subject: [PATCH] Output hexdump comparisons on expect failure * src/spec.sh (fail): Output xxd hexdump of std{in,out}. (bail): Output to stderr. --- src/spec.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/spec.sh b/src/spec.sh index 74d3b5e..7ea9b0a 100644 --- a/src/spec.sh +++ b/src/spec.sh @@ -243,10 +243,10 @@ fail() echo "expected to $*" >&2 echo ' stdout:' - sed 's/^/ /g' <<< "$__spec_result" + sed 's/^/ /g' < <( xxd < "$__spec_outpath" ) echo echo ' stderr:' - sed 's/^/ /g' "$__spec_errpath" + sed 's/^/ /g' < <( xxd < "$__spec_errpath" ) echo echo " exit code: $__spec_rexit" @@ -274,10 +274,10 @@ shspec::bail() read line file <<< "$__spec_caller" fi - echo -n "error: $1" >&2 + echo -n "error: $msg" >&2 [ -n "$file" ] && echo -n " at $file:$line" >&2 - echo + echo >&2 exit 1 }