]> granicus.if.org Git - git/commitdiff
t7810: use test_expect_code() instead of hand-rolled comparison
authorEric Sunshine <sunshine@sunshineco.com>
Mon, 2 Jul 2018 00:23:52 +0000 (20:23 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 16 Jul 2018 21:38:47 +0000 (14:38 -0700)
This test manually checks the exit code of git-grep for a particular
value. In doing so, it intentionally breaks the &&-chain. Modernize the
test by taking advantage of test_expect_code() and a normal &&-chain.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7810-grep.sh

index 1797f632a388d16f23a47c7693c7a3f0f0deabf6..fecee602c1de3e46676b3c8cd77dcab97a862dcf 100755 (executable)
@@ -845,10 +845,9 @@ test_expect_success 'grep from a subdirectory to search wider area (1)' '
 test_expect_success 'grep from a subdirectory to search wider area (2)' '
        mkdir -p s &&
        (
-               cd s || exit 1
-               ( git grep xxyyzz .. >out ; echo $? >status )
-               ! test -s out &&
-               test 1 = $(cat status)
+               cd s &&
+               test_expect_code 1 git grep xxyyzz .. >out &&
+               ! test -s out
        )
 '