[PATCH 2/3] test: print empty line at the beginning of test script, not at end

Tomi Ollila tomi.ollila at iki.fi
Mon Nov 25 09:08:18 PST 2013


In preparation for quiet mode print empty line before writing the
test description. This is done now in function designed for it --
it will also be called when test fails.
---
 test/notmuch-test                          |  1 +
 test/test-lib.sh                           | 12 +++++++++---
 test/test.expected-output/test-verbose-no  |  1 +
 test/test.expected-output/test-verbose-yes |  1 +
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/test/notmuch-test b/test/notmuch-test
index 18593f6..d6fdd3a 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -96,10 +96,11 @@ for test in $TESTS; do
     fi
 done
 trap - HUP INT TERM
 
 # Report results
+echo
 ./aggregate-results.sh test-results/*
 ev=$?
 
 # Clean up
 rm -rf test-results corpus.mail
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 6e47545..34e0db6 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -188,11 +188,19 @@ if test "$help" = "t"
 then
 	echo "Tests ${test_description}"
 	exit 0
 fi
 
-echo $this_test: "Testing ${test_description}"
+test_description_printed=
+print_test_description ()
+{
+	test -z "$test_description_printed" || return 0
+	echo
+	echo $this_test: "Testing ${test_description}"
+	test_description_printed=1
+}
+print_test_description
 
 exec 5>&1
 
 test_failure=0
 test_count=0
@@ -977,12 +985,10 @@ test_done () {
 	echo "fixed $test_fixed" >> $test_results_path
 	echo "broken $test_broken" >> $test_results_path
 	echo "failed $test_failure" >> $test_results_path
 	echo "" >> $test_results_path
 
-	echo
-
 	[ -n "$EMACS_SERVER" ] && test_emacs '(kill-emacs)'
 
 	if [ "$test_failure" = "0" ]; then
 	    if [ "$test_broken" = "0" ]; then
 		rm -rf "$remove_tmp"
diff --git a/test/test.expected-output/test-verbose-no b/test/test.expected-output/test-verbose-no
index 0bca754..1a2ff61 100644
--- a/test/test.expected-output/test-verbose-no
+++ b/test/test.expected-output/test-verbose-no
@@ -1,5 +1,6 @@
+
 test-verbose: Testing the verbosity options of the test framework itself.
  PASS   print something in test_expect_success and pass
  FAIL   print something in test_expect_success and fail
 	
 	  echo "hello stdout" &&
diff --git a/test/test.expected-output/test-verbose-yes b/test/test.expected-output/test-verbose-yes
index ebe5187..d25466e 100644
--- a/test/test.expected-output/test-verbose-yes
+++ b/test/test.expected-output/test-verbose-yes
@@ -1,5 +1,6 @@
+
 test-verbose: Testing the verbosity options of the test framework itself.
 hello stdout
 hello stderr
  PASS   print something in test_expect_success and pass
 hello stdout
-- 
1.8.4.2



More information about the notmuch mailing list