[PATCH] test: optionally print subtest number
Tomi Ollila
tomi.ollila at nixu.com
Tue Dec 13 12:30:11 PST 2011
On Tue, 13 Dec 2011 15:56:47 -0400, David Bremner <david at tethera.net> wrote:
> From: David Bremner <bremner at 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.
+1. I would also say '+1' even non-debug format (and update dependend code,
if there is any).
Tomi
>
> 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
>
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
>
--
Tomi Ollila !! tomi.ollila at nixu.fi !! +358 400 888 366
Nixu Oy !! http://www.nixu.fi/ !! Keilaranta 15, FI-02150 Espoo, Finland
More information about the notmuch
mailing list