updated utils.sh

pull/2/head
Hari Sekhon 8 years ago
parent e653322fb2
commit 231a557fe1

@ -44,12 +44,15 @@ check_output(){
local expected="$1" local expected="$1"
local cmd="${@:2}" local cmd="${@:2}"
local output="$($cmd 2>&1)" local output="$($cmd 2>&1)"
if [ -n "${DEBUG:-}" ]; then
echo "full debug output: $output"
fi
local test_output="$(tail -n1 <<< "$output")" local test_output="$(tail -n1 <<< "$output")"
# intentionally not quoting so that we can use things like google* glob matches for google.com and google.co.uk # intentionally not quoting so that we can use things like google* glob matches for google.com and google.co.uk
if [[ "$test_output" = $expected ]]; then if [[ "$test_output" = $expected ]]; then
echo "SUCCESS: got expected output '$test_output'" echo "SUCCESS: got expected output '$test_output'"
else else
die "FAILED: got '$output', expected '$expected'" die "FAILED: got '$test_output', expected '$expected'"
fi fi
echo echo
} }

Loading…
Cancel
Save