Output hexdump comparisons on expect failure

* src/spec.sh (fail): Output xxd hexdump of std{in,out}.
  (bail): Output to stderr.
master
Mike Gerwitz 2017-04-19 01:59:12 -04:00
parent a368e809a3
commit 2845e64b74
Signed by: mikegerwitz
GPG Key ID: 8C917B7F5DC51BA2
1 changed files with 4 additions and 4 deletions

View File

@ -243,10 +243,10 @@ fail()
echo "expected to $*" >&2 echo "expected to $*" >&2
echo ' stdout:' echo ' stdout:'
sed 's/^/ /g' <<< "$__spec_result" sed 's/^/ /g' < <( xxd < "$__spec_outpath" )
echo echo
echo ' stderr:' echo ' stderr:'
sed 's/^/ /g' "$__spec_errpath" sed 's/^/ /g' < <( xxd < "$__spec_errpath" )
echo echo
echo " exit code: $__spec_rexit" echo " exit code: $__spec_rexit"
@ -274,10 +274,10 @@ shspec::bail()
read line file <<< "$__spec_caller" read line file <<< "$__spec_caller"
fi fi
echo -n "error: $1" >&2 echo -n "error: $msg" >&2
[ -n "$file" ] && echo -n " at $file:$line" >&2 [ -n "$file" ] && echo -n " at $file:$line" >&2
echo echo >&2
exit 1 exit 1
} }