]> git.ipfire.org Git - thirdparty/git.git/commit - t/lib-subtest.sh
test-lib tests: avoid subshell for "test_cmp" for readability
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Wed, 22 Sep 2021 11:19:50 +0000 (13:19 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 22 Sep 2021 23:22:41 +0000 (16:22 -0700)
commit12fe4909fa26ea0a1c653867f11b01888055840a
tree2674373f9c6bc04ad6d7214ccb6d28a939702617
parentc3ff7be6fb04c3150a8496271901a4a918c2c70c
test-lib tests: avoid subshell for "test_cmp" for readability

The use of a sub-shell for running the test_cmp of stdout/stderr for
the test author was introduced in this form in 565b6fa87bb (tests:
refactor mechanics of testing in a sub test-lib, 2012-12-16), but from
looking at the history that seemed to have diligently copied my
original ad-hoc implementation in 7b905119703 (t/t0000-basic.sh: Run
the passing TODO test inside its own test-lib, 2010-08-19).

There's no reason to use a subshell here, we try to avoid it in
general. It also improves readability, if the test fails we print out
the relative path in the trash directory that needs to be looked
at.

Before that was mostly obscured, since the "write_sub_test_lib_test"
will pick the directory for you from the test name.

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