Re: [PATCH 1/5] t4015: refactor --color-moved whitespace test
- From
Jeff King <peff@peff.net>
- Date
- Oct 19, 2017, 21:10 UTC
- Message-ID
- <20171019211041.yfzlwcxhqb7uwqgh@sigill.intra.peff.net>
- In-Reply-To
- <CAGZ79kahYb5=BEvr0io-bSJ+JaOfViicyghH4CtRErqmtAXU-g@mail.gmail.com>
On Thu, Oct 19, 2017 at 01:56:55PM -0700, Stefan Beller wrote:
Show 15 quoted lines
> On Thu, Oct 19, 2017 at 1:24 PM, Jeff King <peff@peff.net> wrote: > > > > > +test_expect_success 'clean up whitespace-test colors' ' > > + git config --unset color.diff.oldMoved && > > + git config --unset color.diff.newMoved > > +' > > This could be part of the previous test as > > test_config color.diff.oldMoved "magenta" && > test_config color.diff.newMoved "cyan" && > > in the beginning. (That way we also do not pollute the setup, > but keeping it test local).
It used to be in the previous test as test_config, but part of the setup refactoring is to keep these common bits across several tests. Hence we "git config" in the setup step, and we must "git config --unset" here in the cleanup. There's only the one test between setup/cleanup right now, but the point is to add more.
The other alternative (besides repeating ourselves) would be to put all those common bits into a function and call the function at the top of each test.
-Peff