[PATCH 3/3] test: implement and document NOTMUCH_TEST_QUIET variable usage

Tomi Ollila tomi.ollila at iki.fi
Wed Nov 13 00:36:49 PST 2013


On Wed, Nov 13 2013, Austin Clements <amdragon at MIT.EDU> wrote:

> Quoth Tomi Ollila on Nov 12 at 10:41 pm:
>>  		return
>>  	fi
>>  	test_success=$(($test_success + 1))
>> +	if test -n "$NOTMUCH_TEST_QUIET"; then
>> +		return 0
>> +	fi
>>  	say_color pass "%-6s" "PASS"
>>  	echo " $test_subtest_name"
>>  }
>> @@ -713,6 +719,9 @@ test_failure_ () {
>>  		return
>>  	fi
>>  	test_failure=$(($test_failure + 1))
>> +	if test -n "$NOTMUCH_TEST_QUIET"; then
>> +		print_test_description
>
> This prints the test description for *every* failing test.  Was that
> intentional?  I would think that, ideally, it would be only printed
> before the first failing subtest in a test (maybe by setting a
> variable in print_test_description on the first call and making it
> return immediately if this variable is set?  Then you wouldn't even
> need the condition here, just the call to print_test_description.)

Your observation is correct.. I thought about it but dropped -- but
as it *increases* the output it should be addressed. My first solution
would be to do:

print_test_description ()
{
	echo
	echo $this_test: "Testing ${test_description}"
        print_test_description () { : already printed ; }
}

But I presume this receives some resistance from the audience ;/

I think this a bit -- this is post 0.17 release stuff anyway...

>
>> +	fi
>>  	test_failure_message_ "FAIL" "$test_subtest_name" "$@"
>>  	test "$immediate" = "" || { GIT_EXIT_OK=t; exit 1; }
>>  	return 1
>
> Stylistic nit: The three if's above use two different styles ([ vs
> test and hanging 'then').  OTOH, maybe this is consistent with
> test-lib's inconsistent style.

It is consistent with test-lib's inconsistent style: most often if []
is used but those places where I used if test just a line before
the diff context there were if test -format used.

Tomi


More information about the notmuch mailing list