From: Ævar Arnfjörð Bjarmason Date: Tue, 06 Jul 2010 12:50:08 GMT Subject: Re: [PATCH v4 7/7] t/README: Document the do's and don'ts of tests Message-ID: In-Reply-To: <7vaaq58hhb.fsf@alter.siamese.dyndns.org> On Tue, Jul 6, 2010 at 02:35, Junio C Hamano wrote: > Ævar Arnfjörð Bjarmason writes: > >> +Do's, don'ts & things to keep in mind >> +------------------------------------- >> + >> +Here's a few examples of things you probably should and shouldn't do >> +when writing tests. > > "Here are" perhaps? > >> +Do: >> + >> + - Put as much code as possible inside test_expect_success and other >> +   assertions. >> + >> +   Even code that isn't a test per se, but merely some setup code >> +   should be inside a test assertion if at all possible. Test scripts >> +   should only have trivial code outside of their assertions. > > Let's make it even stronger; "should only have trivial" -> "shouldn't have > any ... unless there is a good reason." > >> +Don't: >> + >> + - exit() within a