Skip to content

Commit ec21ac8

Browse files
szedergitster
authored andcommitted
tests: use 'test_must_be_empty' instead of 'test_cmp /dev/null <out>'
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f0dc593 commit ec21ac8

10 files changed

+16
-16
lines changed

t/t3210-pack-refs.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ test_expect_success 'explicit pack-refs with dangling packed reference' '
127127
git reflog expire --expire=all --all &&
128128
git prune --expire=all &&
129129
git pack-refs --all 2>result &&
130-
test_cmp /dev/null result
130+
test_must_be_empty result
131131
'
132132

133133
test_expect_success 'delete ref with dangling packed version' '
@@ -139,7 +139,7 @@ test_expect_success 'delete ref with dangling packed version' '
139139
git reflog expire --expire=all --all &&
140140
git prune --expire=all &&
141141
git branch -d lamb 2>result &&
142-
test_cmp /dev/null result
142+
test_must_be_empty result
143143
'
144144

145145
test_expect_success 'delete ref while another dangling packed ref' '
@@ -150,7 +150,7 @@ test_expect_success 'delete ref while another dangling packed ref' '
150150
git reflog expire --expire=all --all &&
151151
git prune --expire=all &&
152152
git branch -d lamb 2>result &&
153-
test_cmp /dev/null result
153+
test_must_be_empty result
154154
'
155155

156156
test_expect_success 'pack ref directly below refs/' '

t/t3308-notes-merge.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ test_expect_success 'merge empty notes ref (z => y)' '
183183
git notes add -m "foo" &&
184184
git notes remove &&
185185
git notes >output_notes_z &&
186-
test_cmp /dev/null output_notes_z &&
186+
test_must_be_empty output_notes_z &&
187187
# Do the merge (z => y)
188188
git config core.notesRef refs/notes/y &&
189189
git notes merge z &&

t/t3310-notes-merge-manual-resolve.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ EOF
337337
git notes merge --commit &&
338338
# No .git/NOTES_MERGE_* files left
339339
test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
340-
test_cmp /dev/null output &&
340+
test_must_be_empty output &&
341341
# Merge commit has pre-merge y and pre-merge z as parents
342342
test "$(git rev-parse refs/notes/m^1)" = "$(cat pre_merge_y)" &&
343343
test "$(git rev-parse refs/notes/m^2)" = "$(cat pre_merge_z)" &&
@@ -399,7 +399,7 @@ test_expect_success 'abort notes merge' '
399399
git notes merge --abort &&
400400
# No .git/NOTES_MERGE_* files left
401401
test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
402-
test_cmp /dev/null output &&
402+
test_must_be_empty output &&
403403
# m has not moved (still == y)
404404
test "$(git rev-parse refs/notes/m)" = "$(cat pre_merge_y)" &&
405405
# Verify that other notes refs has not changed (w, x, y and z)
@@ -466,7 +466,7 @@ EOF
466466
git notes merge --commit &&
467467
# No .git/NOTES_MERGE_* files left
468468
test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
469-
test_cmp /dev/null output &&
469+
test_must_be_empty output &&
470470
# Merge commit has pre-merge y and pre-merge z as parents
471471
test "$(git rev-parse refs/notes/m^1)" = "$(cat pre_merge_y)" &&
472472
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' '
555555
git notes merge --abort &&
556556
# No .git/NOTES_MERGE_* files left
557557
test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
558-
test_cmp /dev/null output &&
558+
test_must_be_empty output &&
559559
# m has not moved (still == w)
560560
test "$(git rev-parse refs/notes/m)" = "$(git rev-parse refs/notes/w)" &&
561561
# Verify that other notes refs has not changed (w, x, y and z)

t/t4047-diff-dirstat.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -940,15 +940,15 @@ test_expect_success 'diff.dirstat=0,lines' '
940940
test_expect_success '--dirstat=future_param,lines,0 should fail loudly' '
941941
test_must_fail git diff --dirstat=future_param,lines,0 HEAD^..HEAD >actual_diff_dirstat 2>actual_error &&
942942
test_debug "cat actual_error" &&
943-
test_cmp /dev/null actual_diff_dirstat &&
943+
test_must_be_empty actual_diff_dirstat &&
944944
test_i18ngrep -q "future_param" actual_error &&
945945
test_i18ngrep -q "\--dirstat" actual_error
946946
'
947947

948948
test_expect_success '--dirstat=dummy1,cumulative,2dummy should report both unrecognized parameters' '
949949
test_must_fail git diff --dirstat=dummy1,cumulative,2dummy HEAD^..HEAD >actual_diff_dirstat 2>actual_error &&
950950
test_debug "cat actual_error" &&
951-
test_cmp /dev/null actual_diff_dirstat &&
951+
test_must_be_empty actual_diff_dirstat &&
952952
test_i18ngrep -q "dummy1" actual_error &&
953953
test_i18ngrep -q "2dummy" actual_error &&
954954
test_i18ngrep -q "\--dirstat" actual_error

t/t4116-apply-reverse.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ test_expect_success 'apply in reverse' '
4242
git reset --hard second &&
4343
git apply --reverse --binary --index patch &&
4444
git diff >diff &&
45-
test_cmp /dev/null diff
45+
test_must_be_empty diff
4646
4747
'
4848

t/t5509-fetch-push-namespaces.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ test_expect_success 'pushing into a repository using a ref namespace' '
4444
test_cmp expected actual &&
4545
# Try a namespace with no content
4646
git ls-remote "ext::git --namespace=garbage %s ../pushee" >actual &&
47-
test_cmp /dev/null actual &&
47+
test_must_be_empty actual &&
4848
git ls-remote pushee-unnamespaced >actual &&
4949
sed -e "s|refs/|refs/namespaces/namespace/refs/|" expected >expected.unnamespaced &&
5050
test_cmp expected.unnamespaced actual

t/t5523-push-upstream.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ test_expect_success TTY 'quiet push' '
113113
ensure_fresh_upstream &&
114114
115115
test_terminal git push --quiet --no-progress upstream master 2>&1 | tee output &&
116-
test_cmp /dev/null output
116+
test_must_be_empty output
117117
'
118118

119119
test_done

t/t5541-http-push-smart.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ test_expect_success TTY 'push --quiet silences status and progress' '
226226
cd "$ROOT_PATH"/test_repo_clone &&
227227
test_commit quiet &&
228228
test_terminal git push --quiet >output 2>&1 &&
229-
test_cmp /dev/null output
229+
test_must_be_empty output
230230
'
231231

232232
test_expect_success TTY 'push --no-progress silences progress but not status' '

t/t7401-submodule-summary.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ test_expect_success 'should not fail in an empty repo' "
300300
git init xyzzy &&
301301
cd xyzzy &&
302302
git submodule summary >output 2>&1 &&
303-
test_cmp output /dev/null
303+
test_must_be_empty output
304304
"
305305

306306
test_done

t/t7810-grep.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ test_expect_success 'grep -L -C' '
483483

484484
test_expect_success 'grep --files-without-match --quiet' '
485485
git grep --files-without-match --quiet nonexistent_string >actual &&
486-
test_cmp /dev/null actual
486+
test_must_be_empty actual
487487
'
488488

489489
cat >expected <<EOF

0 commit comments

Comments
 (0)