unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] test: optionally print subtest number
@ 2011-12-13 19:56 David Bremner
  2011-12-13 20:15 ` Dmitry Kurochkin
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: David Bremner @ 2011-12-13 19:56 UTC (permalink / raw)
  To: notmuch; +Cc: David Bremner

From: David Bremner <bremner@debian.org>

The idea is that $test_count could be used in tests to label
intermediate files. The output enabled by this patch (and --debug)
helps figure out which OUTPUT.nn file belongs to which test in case
several subtests write to OUTPUT.$test_count
---

Is there something that depends on the test format? I find it pretty
handy to have the subtest numbers, but I don't want to break some
other tools. I followed the existing style of conditionally defining
functions, but maybe someone with more bash-fu can improve that.

 test/test-lib.sh |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index 6be93fe..aaaaf5c 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -116,6 +116,16 @@ do
 	esac
 done
 
+if test -n "$debug"; then
+    print_subtest () {
+	printf "\t[%d]\t" $(($test_count - 1))
+    }
+else
+    print_subtest () {
+	true
+    }
+fi
+
 if test -n "$color"; then
 	say_color () {
 		(
@@ -132,6 +142,7 @@ if test -n "$color"; then
 		printf " "
                 printf "$@"
 		tput sgr0
+		print_subtest
 		)
 	}
 else
@@ -140,6 +151,7 @@ else
 		shift
 		printf " "
                 printf "$@"
+		print_subtest
 	}
 fi
 
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2011-12-17 14:05 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-13 19:56 [PATCH] test: optionally print subtest number David Bremner
2011-12-13 20:15 ` Dmitry Kurochkin
2011-12-13 20:55   ` Tomi Ollila
2011-12-13 20:58     ` Dmitry Kurochkin
2011-12-13 21:23       ` Tomi Ollila
2011-12-13 20:30 ` Tomi Ollila
2011-12-13 22:22 ` Jameson Graef Rollins
2011-12-13 23:18   ` David Bremner
2011-12-13 23:24     ` Dmitry Kurochkin
2011-12-13 23:35       ` Jameson Graef Rollins
2011-12-13 23:51         ` Dmitry Kurochkin
2011-12-13 23:25     ` Jameson Graef Rollins
2011-12-14  0:14       ` David Bremner
2011-12-17 14:04 ` Tomi Ollila

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).