Subject: Re: [PATCH v6] format-patch --signature-file <file>

From: Junio C Hamano <[email-masked]>
Date: Wed, 21 May 2014 15:48:45 -0700

Jeremiah Mahler <[email-masked]> writes:

> On Wed, May 21, 2014 at 03:15:55PM -0700, Junio C Hamano wrote:
>> Jeff King <[email-masked]> writes:
>> 
>> Yeah, placing it in its own setup may be the best.  There are quite
>> a many set-ups outside the tests in this script from the olden days,
>> so I am OK if left it as-is and have a separate clean-up patch after
>> this topic settles.  I am also OK to add a new one "the new right way"
>> so that a later clean-up patch does not have to change what is added
>> in this step.
>
> I like the idea of limiting the scope of this data so it couldn't
> inadvertently impact later tests.
>
> But placing the same data inside multiple test cases creates duplication.
>
> Is there a way to define data once for a limited set of tests?

That is what Jeff ment by "used across many tests. ... it could go
in its own setup".

In other words,

	test_expect_success 'prepare mail-signature input' '
        	cat >mail-signature <<-\EOF
                ...
                EOF
	'

	test_expect_success 'one test that uses mail-signature' '
        	use mail-signature &&
                test the output
	'

	test_expect_success 'another test that uses mail-signature' '
        	use mail-signature in a different way &&
                test the output
	'