tests: make use of the test_must_be_empty function

Change various tests that use an idiom of the form:

    >expect &&
    test_cmp expect actual

To instead use:

    test_must_be_empty actual

The test_must_be_empty() wrapper was introduced in ca8d148daf ("test:
test_must_be_empty helper", 2013-06-09). Many of these tests have been
added after that time. This was mostly found with, and manually pruned
from:

    git grep '^\s+>.*expect.* &&$' t

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ævar Arnfjörð Bjarmason
2018-07-27 17:48:11 +00:00
committed by Junio C Hamano
parent ffc6fa0e39
commit d3c6751b18
45 changed files with 111 additions and 205 deletions

View File

@ -26,26 +26,22 @@ test_expect_success 'show-ref' '
git show-ref refs/tags/A >actual &&
test_cmp expect actual &&
>expect &&
test_must_fail git show-ref D >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'show-ref -q' '
>expect &&
git show-ref -q A >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
git show-ref -q tags/A >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
git show-ref -q refs/tags/A >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
test_must_fail git show-ref -q D >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'show-ref --verify' '
@ -54,32 +50,28 @@ test_expect_success 'show-ref --verify' '
git show-ref --verify refs/tags/A >actual &&
test_cmp expect actual &&
>expect &&
test_must_fail git show-ref --verify A >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
test_must_fail git show-ref --verify tags/A >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
test_must_fail git show-ref --verify D >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'show-ref --verify -q' '
>expect &&
git show-ref --verify -q refs/tags/A >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
test_must_fail git show-ref --verify -q A >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
test_must_fail git show-ref --verify -q tags/A >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
test_must_fail git show-ref --verify -q D >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'show-ref -d' '
@ -113,19 +105,17 @@ test_expect_success 'show-ref -d' '
git show-ref -d --verify refs/heads/master >actual &&
test_cmp expect actual &&
>expect &&
test_must_fail git show-ref -d --verify master >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
test_must_fail git show-ref -d --verify heads/master >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
test_must_fail git show-ref --verify -d A C >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
test_must_fail git show-ref --verify -d tags/A tags/C >actual &&
test_cmp expect actual
test_must_be_empty actual
'
@ -178,10 +168,8 @@ test_expect_success 'show-ref --verify HEAD' '
git show-ref --verify HEAD >actual &&
test_cmp expect actual &&
>expect &&
git show-ref --verify -q HEAD >actual &&
test_cmp expect actual
test_must_be_empty actual
'
test_expect_success 'show-ref --verify with dangling ref' '