Permalink
Browse files

test-lib: Show full todo.sh output in verbose mode.

Now that differences in the output (and exit code) are already printed by default, we can make the verbose mode actually "verbose" by including all todo.sh output generated during the test run. This may help in reviewing the tests and for troubleshooting.
By moving the redirection to the output file to test_run_(), all testing-related embellishments have been removed from the command under test itself, resulting in much cleaner test messages.
Additionally, also capture stderr in output. todo.sh itself currently prints everything to stdout (but the die() output probably belongs to stderr), so as of now, that has no consequences, but seems to be more consistent and future-proof.
  • Loading branch information...
1 parent 189779c commit ebe9fb868b9d07ddcb5823f5d6beb4d99d93bfb1 @inkarkat inkarkat committed Jan 25, 2012
Showing with 6 additions and 5 deletions.
  1. +6 −5 tests/test-lib.sh
View
11 tests/test-lib.sh
@@ -199,8 +199,9 @@ test_debug () {
}
test_run_ () {
- eval >&3 2>&4 "$1"
+ eval > output 2>&1 "$1"
eval_ret="$?"
+ cat >&3 output
return 0
}
@@ -594,9 +595,9 @@ test_todo_session () {
"")
if [ ! -z "$cmd" ]; then
if [ $status = 0 ]; then
- test_expect_output "$1 $subnum" "$cmd > output"
+ test_expect_output "$1 $subnum" "$cmd"
else
- test_expect_code_and_output "$status" "$1 $subnum" "$cmd > output"
+ test_expect_code_and_output "$status" "$1 $subnum" "$cmd"
fi
subnum=$(($subnum + 1))
@@ -612,9 +613,9 @@ test_todo_session () {
done
if [ ! -z "$cmd" ]; then
if [ $status = 0 ]; then
- test_expect_output "$1 $subnum" "$cmd > output"
+ test_expect_output "$1 $subnum" "$cmd"
else
- test_expect_code_and_output "$status" "$1 $subnum" "$cmd > output"
+ test_expect_code_and_output "$status" "$1 $subnum" "$cmd"
fi
fi
}

0 comments on commit ebe9fb8

Please sign in to comment.