test-lib-main.sh: introduce TESTLIB_TEST_NO_SUBSHELL
commite9398528501c2d14ed39237df28effac5d19e874
authorKyle J. McKay <mackyle@gmail.com>
Fri, 30 Dec 2016 07:48:08 +0000 (29 23:48 -0800)
committerKyle J. McKay <mackyle@gmail.com>
Fri, 30 Dec 2016 07:48:08 +0000 (29 23:48 -0800)
tree92d045ab3457ebc12e444776f05cb464151b98cc
parent371ba938df0fe1c1109f5abe6f97e76ee297a731
test-lib-main.sh: introduce TESTLIB_TEST_NO_SUBSHELL

By default the testing library runs the script code passed to
the test_expect_.../test_tolerate_... functions in a subshell
so that all failures are properly caught and reported and so
that the test code can change HOME, PATH, etc. with impunity.

However, this precludes having the script code make changes to
variables which are expected to persist for inspection.

Generally using a subshell is a good thing since it prevents
unexpected perversion of the testing environment.

However, tests that require a perverted environment can set
TESTLIB_TEST_NO_SUBSHELL to a non-empty value and the code
will no longer be evaluated in a subshell.  Changes to the
value of TESTLIB_TEST_NO_SUBSHELL are effective with the next
test_expect_.../test_tolerate_... call.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
t/test-lib-main.sh