Re: [PATCH v4 7/7] t/README: Document the do's and don'ts of tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 6, 2010 at 08:35, Jakub Narebski <jnareb@xxxxxxxxx> wrote:
> Junio C Hamano <gitster@xxxxxxxxx> writes:
>> Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> writes:
>>
>> > +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."
>
> I think that the only thing that can and *should* be put outside
> test_expect_* is creating helper file: test vectors ('expect' files),
> configuration files, files that are to be arguments to commands, etc.
> Is it covered by "there is a good reason"?  Isn't it too severe?

Personally I'd put `.. >expect && .. >actual && test_cmp' inside
test_expect_* too if they're only going to be used by that test, but
outside them at the top of the file if they're files that are used by
multiple tests for the duration of the test run.

> There probably should be description when to put creating such files
> in test script, and when to put them as pre-made files in tXXXX/
> subdirectory (non US-ASCII is one reason to put it as pre-made file).

I don't know which one would be preferrable. We have a lot of things
in t/t*/* that could be generated by a test, and vice-versa.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]