Skip to content

Commit c54e6be

Browse files
mlafeldtgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent dabdbee commit c54e6be

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

t/test-lib.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ test_external () {
575575
test_external_without_stderr () {
576576
# The temporary file has no (and must have no) security
577577
# implications.
578-
tmp="$TMPDIR"; if [ -z "$tmp" ]; then tmp=/tmp; fi
578+
tmp=${TMPDIR:-/tmp}
579579
stderr="$tmp/git-external-stderr.$$.tmp"
580580
test_external "$@" 4> "$stderr"
581581
[ -f "$stderr" ] || error "Internal error: $stderr disappeared."
@@ -801,12 +801,14 @@ test_done () {
801801
mkdir -p "$test_results_dir"
802802
test_results_path="$test_results_dir/${0%.sh}-$$.counts"
803803

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
810812
fi
811813

812814
if test "$test_fixed" != 0

0 commit comments

Comments
 (0)