1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-13 22:03:52 -05:00

undo assert_output_lines in tests

It was a dumb idea and it wasn't even implemented perfectly.
This commit is contained in:
Mislav Marohnić
2013-04-06 14:10:44 +02:00
parent 969af1567a
commit 7fc5f46bbb
8 changed files with 67 additions and 58 deletions

View File

@@ -26,7 +26,7 @@ assert_success() {
if [ "$status" -ne 0 ]; then
flunk "command failed with exit status $status"
elif [ "$#" -gt 0 ]; then
assert_output_lines "$1"
assert_output "$1"
fi
}
@@ -34,7 +34,7 @@ assert_failure() {
if [ "$status" -eq 0 ]; then
flunk "expected failed exit status"
elif [ "$#" -gt 0 ]; then
assert_output_lines "$1"
assert_output "$1"
fi
}
@@ -47,21 +47,11 @@ assert_equal() {
}
assert_output() {
assert_equal "$1" "$output"
}
# compares lines with leading whitespace trimmed
assert_output_lines() {
local -a expected
IFS=$'\n' expected=($1)
for (( i=0; i < ${#expected[@]}; i++ )); do
local wants="${expected[$i]}"
local got="${lines[$i]}"
assert_equal \
"${wants#"${wants%%[![:space:]]*}"}" \
"${got#"${got%%[![:space:]]*}"}"
done
assert_equal "${expected[$i]}" "${lines[$i]}"
local expected
if [ $# -eq 0 ]; then expected="$(cat -)"
else expected="$1"
fi
assert_equal "$expected" "$output"
}
assert_line() {