@matheusbsbs / matheus-bagliano / commits / c54e6be75a
Fork 0

t/test-lib.sh: minor readability improvements

Apply parameter expansion. Also use here document to save test results instead of appending each line with ">>". Signed-off-by: Mathias Lafeldt <misfire@debugon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Mathias Lafeldt committed Apr 29, 2011 at 14:30 UTC c54e6be75ae90e2be45c32f4d1949fff59ad7d9d
1 file changed +9 -7
t/test-lib.sh
+9 -7
@@ -575,7 +575,7 @@ test_external () {
575 test_external_without_stderr () {
576 # The temporary file has no (and must have no) security
577 # implications.
578 - tmp="$TMPDIR"; if [ -z "$tmp" ]; then tmp=/tmp; fi
578 + tmp=${TMPDIR:-/tmp}
579 stderr="$tmp/git-external-stderr.$$.tmp"
580 test_external "$@" 4> "$stderr"
581 [ -f "$stderr" ] || error "Internal error: $stderr disappeared."
@@ -801,12 +801,14 @@ test_done () {
801 mkdir -p "$test_results_dir"
802 test_results_path="$test_results_dir/${0%.sh}-$$.counts"
803
804 - echo "total $test_count" >> $test_results_path
805 - echo "success $test_success" >> $test_results_path
806 - echo "fixed $test_fixed" >> $test_results_path
807 - echo "broken $test_broken" >> $test_results_path
808 - echo "failed $test_failure" >> $test_results_path
809 - echo "" >> $test_results_path
804 + cat >>"$test_results_path" <<-EOF
805 + total $test_count
806 + success $test_success
807 + fixed $test_fixed
808 + broken $test_broken
809 + failed $test_failure
810 +
811 + EOF
812 fi
813
814 if test "$test_fixed" != 0