Re: [PATCH 1/2] t0008: document test_expect_success_multi
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 19, 2013, 17:37 UTC
- Message-ID
- <7v621o6w83.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1361282783-1413-1-git-send-email-git@adamspiers.org>
Adam Spiers <git@adamspiers.org> writes:
Show 8 quoted lines
> test_expect_success_multi() helper function warrants some explanation, > since at first sight it may seem like generic test framework plumbing, > but is in fact specific to testing check-ignore, and allows more > thorough testing of the various output formats without significantly > increase the size of t0008. > > Signed-off-by: Adam Spiers <git@adamspiers.org> > ---
Good. I vaguely recall saying why I hate these mini-frameworks invented in individual tests, but with comments like this, they become much more palatable.
Thanks.
Show 24 quoted lines
> t/t0008-ignores.sh | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/t/t0008-ignores.sh b/t/t0008-ignores.sh
> index d7df719..ebe7c70 100755
> --- a/t/t0008-ignores.sh
> +++ b/t/t0008-ignores.sh
> @@ -75,6 +75,16 @@ test_check_ignore () {
> stderr_empty_on_success "$expect_code"
> }
>
> +# Runs the same code with 3 different levels of output verbosity,
> +# expecting success each time. Takes advantage of the fact that
> +# check-ignore --verbose output is the same as normal output except
> +# for the extra first column.
> +#
> +# Arguments:
> +# - (optional) prereqs for this test, e.g. 'SYMLINKS'
> +# - test name
> +# - output to expect from -v / --verbose mode
> +# - code to run (should invoke test_check_ignore)
> test_expect_success_multi () {
> prereq=
> if test $# -eq 4