test-lib tests: split up "write and run" into two functions
commit9f0a45208dbc488da790d0f2ef1491eb2aa858c2
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Wed, 22 Sep 2021 11:19:48 +0000 (22 13:19 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 22 Sep 2021 23:22:41 +0000 (22 16:22 -0700)
tree6f2e2d8124e4a0d2f5cebe85960016aa21db4e67
parent866a3014de34d415300bdd488f2ccd7ae5fb2d65
test-lib tests: split up "write and run" into two functions

Refactor the function to write and run tests of the test-lib.sh output
into two functions.

When this was added back in 565b6fa87bb (tests: refactor mechanics of
testing in a sub test-lib, 2012-12-16) there was no reason to do this,
but since we started supporting test arguments in
517cd55fd51 (test-lib: self-test that --verbose works, 2013-06-23)
we've started to write out duplicate tests simply to test different
arguments, now we'll be able to re-use them.

This change doesn't consolidate any of those tests yet, it just makes
it possible to do so. All the changes in t0000-basic.sh are a simple
search-replacement.

Since the _run_sub_test_lib_test_common() function doesn't handle
running the test anymore we can do away with the sub-shell, which was
used to scope an "unset" and "export" shell variables.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/lib-subtest.sh
t/t0000-basic.sh