From: Junio C Hamano Date: Thu, 07 Oct 2010 04:57:25 GMT Subject: Re: Test script style (Re: [PATCH 08/18] git notes merge: Initial implementation handling trivial merges only) Message-ID: <7vk4luy4zu.fsf@alter.siamese.dyndns.org> In-Reply-To: <20101007043721.GD2285@burratino> Jonathan Nieder writes: > Thoughts? Would it make sense to eventually put something like this > in t/CodingStyle or nearby? > Tests: > test_expect_success|failure '... some claim...' ' > Commands to test that claim. > Could do all sorts of things, as long as they do not > disturb the invariants established by the > constant_data and setup sections. > ' In practice, I am afraid it would take a lot more discipline than any of the current test script does to actually preserve the invariants. But if we can arrange that, it would be ideal. For one thing, it would finally make the subtest skip feature of GIT_SKIP_TESTS usable. An obvious way to do so would be Tests: test_expect_success|failure '... some claim...' ' + Commands to establish a known precondition without + depending on the state left by previous steps. Commands to test that claim. - Could do all sorts of things, as long as they do not - disturb the invariants established by the - constant_data and setup sections. ' but if done naively, the time it takes to re-establish a known precondition for each and every test would add up to substantial overhead.