From ec21ac8c189537df815e49bdf8f08da927665cf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= Date: Sun, 19 Aug 2018 23:57:24 +0200 Subject: tests: use 'test_must_be_empty' instead of 'test_cmp /dev/null ' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano diff --git a/t/t3210-pack-refs.sh b/t/t3210-pack-refs.sh index afa27ff..112cbb0 100755 --- a/t/t3210-pack-refs.sh +++ b/t/t3210-pack-refs.sh @@ -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/' ' diff --git a/t/t3308-notes-merge.sh b/t/t3308-notes-merge.sh index ab946a5..d60588e 100755 --- a/t/t3308-notes-merge.sh +++ b/t/t3308-notes-merge.sh @@ -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 && diff --git a/t/t3310-notes-merge-manual-resolve.sh b/t/t3310-notes-merge-manual-resolve.sh index 9c1bf6e..a1cf4ec 100755 --- a/t/t3310-notes-merge-manual-resolve.sh +++ b/t/t3310-notes-merge-manual-resolve.sh @@ -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) diff --git a/t/t4047-diff-dirstat.sh b/t/t4047-diff-dirstat.sh index 447a8ff..7fec2cb 100755 --- a/t/t4047-diff-dirstat.sh +++ b/t/t4047-diff-dirstat.sh @@ -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 diff --git a/t/t4116-apply-reverse.sh b/t/t4116-apply-reverse.sh index ce8567f..b99e65c 100755 --- a/t/t4116-apply-reverse.sh +++ b/t/t4116-apply-reverse.sh @@ -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 ' diff --git a/t/t5509-fetch-push-namespaces.sh b/t/t5509-fetch-push-namespaces.sh index 75c570a..c88df78 100755 --- a/t/t5509-fetch-push-namespaces.sh +++ b/t/t5509-fetch-push-namespaces.sh @@ -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 diff --git a/t/t5523-push-upstream.sh b/t/t5523-push-upstream.sh index d6981ba..c0df81a 100755 --- a/t/t5523-push-upstream.sh +++ b/t/t5523-push-upstream.sh @@ -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 diff --git a/t/t5541-http-push-smart.sh b/t/t5541-http-push-smart.sh index a2af693..4319ef6 100755 --- a/t/t5541-http-push-smart.sh +++ b/t/t5541-http-push-smart.sh @@ -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' ' diff --git a/t/t7401-submodule-summary.sh b/t/t7401-submodule-summary.sh index 1cd12b3..9bc841d 100755 --- a/t/t7401-submodule-summary.sh +++ b/t/t7401-submodule-summary.sh @@ -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 diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh index 825da14..42d5354 100755 --- a/t/t7810-grep.sh +++ b/t/t7810-grep.sh @@ -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 <