]> git.ipfire.org Git - thirdparty/git.git/commitdiff
tests: use 'test_must_be_empty' instead of 'test_cmp /dev/null <out>'
authorSZEDER Gábor <szeder.dev@gmail.com>
Sun, 19 Aug 2018 21:57:24 +0000 (23:57 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 21 Aug 2018 18:48:34 +0000 (11:48 -0700)
Using 'test_must_be_empty' is more idiomatic than 'test_cmp /dev/null
out', and its message on error is perhaps a bit more to the point.

This patch was basically created by running:

  sed -i -e 's%test_cmp /dev/null%test_must_be_empty%' t[0-9]*.sh

with the exception of the change in 'should not fail in an empty repo'
in 't7401-submodule-summary.sh', where it was 'test_cmp output
/dev/null'.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t3210-pack-refs.sh
t/t3308-notes-merge.sh
t/t3310-notes-merge-manual-resolve.sh
t/t4047-diff-dirstat.sh
t/t4116-apply-reverse.sh
t/t5509-fetch-push-namespaces.sh
t/t5523-push-upstream.sh
t/t5541-http-push-smart.sh
t/t7401-submodule-summary.sh
t/t7810-grep.sh

index afa27ffe2d869a5e7fdf8318d5b9957208a96c52..112cbb0e6264bd2e23e159fc992d492ea13413de 100755 (executable)
@@ -127,7 +127,7 @@ test_expect_success 'explicit pack-refs with dangling packed reference' '
        git reflog expire --expire=all --all &&
        git prune --expire=all &&
        git pack-refs --all 2>result &&
-       test_cmp /dev/null result
+       test_must_be_empty result
 '
 
 test_expect_success 'delete ref with dangling packed version' '
@@ -139,7 +139,7 @@ test_expect_success 'delete ref with dangling packed version' '
        git reflog expire --expire=all --all &&
        git prune --expire=all &&
        git branch -d lamb 2>result &&
-       test_cmp /dev/null result
+       test_must_be_empty result
 '
 
 test_expect_success 'delete ref while another dangling packed ref' '
@@ -150,7 +150,7 @@ test_expect_success 'delete ref while another dangling packed ref' '
        git reflog expire --expire=all --all &&
        git prune --expire=all &&
        git branch -d lamb 2>result &&
-       test_cmp /dev/null result
+       test_must_be_empty result
 '
 
 test_expect_success 'pack ref directly below refs/' '
index ab946a5153c041de92bde52aed4d47c2a0d80b21..d60588ec8f0038e43d6327537240512afc832c4c 100755 (executable)
@@ -183,7 +183,7 @@ test_expect_success 'merge empty notes ref (z => y)' '
        git notes add -m "foo" &&
        git notes remove &&
        git notes >output_notes_z &&
-       test_cmp /dev/null output_notes_z &&
+       test_must_be_empty output_notes_z &&
        # Do the merge (z => y)
        git config core.notesRef refs/notes/y &&
        git notes merge z &&
index 9c1bf6eb3d46f31c0e1816508dcc8fee4699f823..a1cf4ec385b09f730a3f7951a513ba35c7128dd1 100755 (executable)
@@ -337,7 +337,7 @@ EOF
        git notes merge --commit &&
        # No .git/NOTES_MERGE_* files left
        test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
-       test_cmp /dev/null output &&
+       test_must_be_empty output &&
        # Merge commit has pre-merge y and pre-merge z as parents
        test "$(git rev-parse refs/notes/m^1)" = "$(cat pre_merge_y)" &&
        test "$(git rev-parse refs/notes/m^2)" = "$(cat pre_merge_z)" &&
@@ -399,7 +399,7 @@ test_expect_success 'abort notes merge' '
        git notes merge --abort &&
        # No .git/NOTES_MERGE_* files left
        test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
-       test_cmp /dev/null output &&
+       test_must_be_empty output &&
        # m has not moved (still == y)
        test "$(git rev-parse refs/notes/m)" = "$(cat pre_merge_y)" &&
        # Verify that other notes refs has not changed (w, x, y and z)
@@ -466,7 +466,7 @@ EOF
        git notes merge --commit &&
        # No .git/NOTES_MERGE_* files left
        test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
-       test_cmp /dev/null output &&
+       test_must_be_empty output &&
        # Merge commit has pre-merge y and pre-merge z as parents
        test "$(git rev-parse refs/notes/m^1)" = "$(cat pre_merge_y)" &&
        test "$(git rev-parse refs/notes/m^2)" = "$(cat pre_merge_z)" &&
@@ -555,7 +555,7 @@ test_expect_success 'resolve situation by aborting the notes merge' '
        git notes merge --abort &&
        # No .git/NOTES_MERGE_* files left
        test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
-       test_cmp /dev/null output &&
+       test_must_be_empty output &&
        # m has not moved (still == w)
        test "$(git rev-parse refs/notes/m)" = "$(git rev-parse refs/notes/w)" &&
        # Verify that other notes refs has not changed (w, x, y and z)
index 447a8ffa3a111dcc6ddec8b6081097f4127d2e59..7fec2cb9cd783f5aeff27236c8e54ddb2241e1be 100755 (executable)
@@ -940,7 +940,7 @@ test_expect_success 'diff.dirstat=0,lines' '
 test_expect_success '--dirstat=future_param,lines,0 should fail loudly' '
        test_must_fail git diff --dirstat=future_param,lines,0 HEAD^..HEAD >actual_diff_dirstat 2>actual_error &&
        test_debug "cat actual_error" &&
-       test_cmp /dev/null actual_diff_dirstat &&
+       test_must_be_empty actual_diff_dirstat &&
        test_i18ngrep -q "future_param" actual_error &&
        test_i18ngrep -q "\--dirstat" actual_error
 '
@@ -948,7 +948,7 @@ test_expect_success '--dirstat=future_param,lines,0 should fail loudly' '
 test_expect_success '--dirstat=dummy1,cumulative,2dummy should report both unrecognized parameters' '
        test_must_fail git diff --dirstat=dummy1,cumulative,2dummy HEAD^..HEAD >actual_diff_dirstat 2>actual_error &&
        test_debug "cat actual_error" &&
-       test_cmp /dev/null actual_diff_dirstat &&
+       test_must_be_empty actual_diff_dirstat &&
        test_i18ngrep -q "dummy1" actual_error &&
        test_i18ngrep -q "2dummy" actual_error &&
        test_i18ngrep -q "\--dirstat" actual_error
index ce8567f496438c18501f30632269ecbe7de15fd3..b99e65c086391276aeb809b8651507026509e19a 100755 (executable)
@@ -42,7 +42,7 @@ test_expect_success 'apply in reverse' '
        git reset --hard second &&
        git apply --reverse --binary --index patch &&
        git diff >diff &&
-       test_cmp /dev/null diff
+       test_must_be_empty diff
 
 '
 
index 75c570adcae4f474c15775ec8504521fc806e2a9..c88df78c0bffaae8f09fc2db79427d85a6f8ff48 100755 (executable)
@@ -44,7 +44,7 @@ test_expect_success 'pushing into a repository using a ref namespace' '
                test_cmp expected actual &&
                # Try a namespace with no content
                git ls-remote "ext::git --namespace=garbage %s ../pushee" >actual &&
-               test_cmp /dev/null actual &&
+               test_must_be_empty actual &&
                git ls-remote pushee-unnamespaced >actual &&
                sed -e "s|refs/|refs/namespaces/namespace/refs/|" expected >expected.unnamespaced &&
                test_cmp expected.unnamespaced actual
index d6981ba304b0b1f2da22d8ec14d4b472b54f3415..c0df81a014c360c277f38831a37cb6f9c4e9bad7 100755 (executable)
@@ -113,7 +113,7 @@ test_expect_success TTY 'quiet push' '
        ensure_fresh_upstream &&
 
        test_terminal git push --quiet --no-progress upstream master 2>&1 | tee output &&
-       test_cmp /dev/null output
+       test_must_be_empty output
 '
 
 test_done
index a2af693068fa455838c97df1fefe38bd630ceb2e..4319ef6ec777c1d9797294adba08bba91ab40808 100755 (executable)
@@ -226,7 +226,7 @@ test_expect_success TTY 'push --quiet silences status and progress' '
        cd "$ROOT_PATH"/test_repo_clone &&
        test_commit quiet &&
        test_terminal git push --quiet >output 2>&1 &&
-       test_cmp /dev/null output
+       test_must_be_empty output
 '
 
 test_expect_success TTY 'push --no-progress silences progress but not status' '
index 1cd12b38c53c7fdfedb937151d961527aa990dbd..9bc841d085ee74cbc4a103b3c2f07c7e4b86e82d 100755 (executable)
@@ -300,7 +300,7 @@ test_expect_success 'should not fail in an empty repo' "
        git init xyzzy &&
        cd xyzzy &&
        git submodule summary >output 2>&1 &&
-       test_cmp output /dev/null
+       test_must_be_empty output
 "
 
 test_done
index 825da1404a0a036dfcc0789c951de5c9c53b1d1d..42d5354c2a442518d85bdf5ad9296e562cec9e02 100755 (executable)
@@ -483,7 +483,7 @@ test_expect_success 'grep -L -C' '
 
 test_expect_success 'grep --files-without-match --quiet' '
        git grep --files-without-match --quiet nonexistent_string >actual &&
-       test_cmp /dev/null actual
+       test_must_be_empty actual
 '
 
 cat >expected <<EOF