tests: make use of the test_must_be_empty function
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Fri, 27 Jul 2018 17:48:11 +0000 (17:48 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Jul 2018 18:19:34 +0000 (11:19 -0700)
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>
t/t2024-checkout-dwim.sh
t/t2025-worktree-add.sh
index 26dc3f1fc0c25df1b359b5d56aece9f171344f5a..f79dfbbdd693b3fd7443d3c839e86e627663eb4b 100755 (executable)
@@ -24,9 +24,8 @@ test_branch_upstream () {
 }
 
 status_uno_is_clean () {
-       >status.expect &&
        git status -uno --porcelain >status.actual &&
-       test_cmp status.expect status.actual
+       test_must_be_empty status.actual
 }
 
 test_expect_success 'setup' '
index be6e093142cdbeb18fa0ff155f3adf1e7a566ca2..166942c1bd2943b778b7df66e21d2e84861ef958 100755 (executable)
@@ -412,9 +412,8 @@ test_expect_success '"add" <path> <branch> dwims with checkout.defaultRemote' '
                git fetch repo_upstream2 &&
                test_must_fail git worktree add ../foo foo &&
                git -c checkout.defaultRemote=repo_upstream worktree add ../foo foo &&
-               >status.expect &&
                git status -uno --porcelain >status.actual &&
-               test_cmp status.expect status.actual
+               test_must_be_empty status.actual
        ) &&
        (
                cd foo &&