Thread (13 messages) flat view 13 messages, 3 authors, 2016-06-15

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

From: Jakub Narebski <hidden>
Date: 2016-06-15 22:49:05

Junio C Hamano [off-list ref] writes:
Ævar Arnfjörð Bjarmason [off-list ref] writes:
quoted
+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?

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).
 
-- 
Jakub Narebski
Poland
ShadeHawk on #git
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help