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 <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
SZEDER Gábor committed
Aug 19, 2018 at 23:57 UTC
ec21ac8c189537df815e49bdf8f08da927665cf2
10 files changed
+16
-16
t/t3210-pack-refs.sh
+3
-3
@@ -127,7 +127,7 @@ test_expect_success 'explicit pack-refs with dangling packed reference' '
127
git reflog expire --expire=all --all &&
128
git prune --expire=all &&
129
git pack-refs --all 2>result &&
130
- test_cmp /dev/null result
130
+ test_must_be_empty result
131
'
132
133
test_expect_success 'delete ref with dangling packed version' '
@@ -139,7 +139,7 @@ test_expect_success 'delete ref with dangling packed version' '
139
git reflog expire --expire=all --all &&
140
git prune --expire=all &&
141
git branch -d lamb 2>result &&
142
- test_cmp /dev/null result
142
+ test_must_be_empty result
143
'
144
145
test_expect_success 'delete ref while another dangling packed ref' '
@@ -150,7 +150,7 @@ test_expect_success 'delete ref while another dangling packed ref' '
150
git reflog expire --expire=all --all &&
151
git prune --expire=all &&
152
git branch -d lamb 2>result &&
153
- test_cmp /dev/null result
153
+ test_must_be_empty result
154
'
155
156
test_expect_success 'pack ref directly below refs/' '
t/t3308-notes-merge.sh
+1
-1
@@ -183,7 +183,7 @@ test_expect_success 'merge empty notes ref (z => y)' '
183
git notes add -m "foo" &&
184
git notes remove &&
185
git notes >output_notes_z &&
186
- test_cmp /dev/null output_notes_z &&
186
+ test_must_be_empty output_notes_z &&
187
# Do the merge (z => y)
188
git config core.notesRef refs/notes/y &&
189
git notes merge z &&
t/t3310-notes-merge-manual-resolve.sh
+4
-4
@@ -337,7 +337,7 @@ EOF
337
git notes merge --commit &&
338
# No .git/NOTES_MERGE_* files left
339
test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
340
- test_cmp /dev/null output &&
340
+ test_must_be_empty output &&
341
# Merge commit has pre-merge y and pre-merge z as parents
342
test "$(git rev-parse refs/notes/m^1)" = "$(cat pre_merge_y)" &&
343
test "$(git rev-parse refs/notes/m^2)" = "$(cat pre_merge_z)" &&
@@ -399,7 +399,7 @@ test_expect_success 'abort notes merge' '
399
git notes merge --abort &&
400
# No .git/NOTES_MERGE_* files left
401
test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
402
- test_cmp /dev/null output &&
402
+ test_must_be_empty output &&
403
# m has not moved (still == y)
404
test "$(git rev-parse refs/notes/m)" = "$(cat pre_merge_y)" &&
405
# Verify that other notes refs has not changed (w, x, y and z)
@@ -466,7 +466,7 @@ EOF
466
git notes merge --commit &&
467
# No .git/NOTES_MERGE_* files left
468
test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
469
- test_cmp /dev/null output &&
469
+ test_must_be_empty output &&
470
# Merge commit has pre-merge y and pre-merge z as parents
471
test "$(git rev-parse refs/notes/m^1)" = "$(cat pre_merge_y)" &&
472
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' '
555
git notes merge --abort &&
556
# No .git/NOTES_MERGE_* files left
557
test_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&
558
- test_cmp /dev/null output &&
558
+ test_must_be_empty output &&
559
# m has not moved (still == w)
560
test "$(git rev-parse refs/notes/m)" = "$(git rev-parse refs/notes/w)" &&
561
# Verify that other notes refs has not changed (w, x, y and z)
t/t4047-diff-dirstat.sh
+2
-2
@@ -940,7 +940,7 @@ test_expect_success 'diff.dirstat=0,lines' '
940
test_expect_success '--dirstat=future_param,lines,0 should fail loudly' '
941
test_must_fail git diff --dirstat=future_param,lines,0 HEAD^..HEAD >actual_diff_dirstat 2>actual_error &&
942
test_debug "cat actual_error" &&
943
- test_cmp /dev/null actual_diff_dirstat &&
943
+ test_must_be_empty actual_diff_dirstat &&
944
test_i18ngrep -q "future_param" actual_error &&
945
test_i18ngrep -q "\--dirstat" actual_error
946
'
@@ -948,7 +948,7 @@ test_expect_success '--dirstat=future_param,lines,0 should fail loudly' '
948
test_expect_success '--dirstat=dummy1,cumulative,2dummy should report both unrecognized parameters' '
949
test_must_fail git diff --dirstat=dummy1,cumulative,2dummy HEAD^..HEAD >actual_diff_dirstat 2>actual_error &&
950
test_debug "cat actual_error" &&
951
- test_cmp /dev/null actual_diff_dirstat &&
951
+ test_must_be_empty actual_diff_dirstat &&
952
test_i18ngrep -q "dummy1" actual_error &&
953
test_i18ngrep -q "2dummy" actual_error &&
954
test_i18ngrep -q "\--dirstat" actual_error
t/t4116-apply-reverse.sh
+1
-1
@@ -42,7 +42,7 @@ test_expect_success 'apply in reverse' '
42
git reset --hard second &&
43
git apply --reverse --binary --index patch &&
44
git diff >diff &&
45
- test_cmp /dev/null diff
45
+ test_must_be_empty diff
46
47
'
48
t/t5509-fetch-push-namespaces.sh
+1
-1
@@ -44,7 +44,7 @@ test_expect_success 'pushing into a repository using a ref namespace' '
44
test_cmp expected actual &&
45
# Try a namespace with no content
46
git ls-remote "ext::git --namespace=garbage %s ../pushee" >actual &&
47
- test_cmp /dev/null actual &&
47
+ test_must_be_empty actual &&
48
git ls-remote pushee-unnamespaced >actual &&
49
sed -e "s|refs/|refs/namespaces/namespace/refs/|" expected >expected.unnamespaced &&
50
test_cmp expected.unnamespaced actual
t/t5523-push-upstream.sh
+1
-1
@@ -113,7 +113,7 @@ test_expect_success TTY 'quiet push' '
113
ensure_fresh_upstream &&
114
115
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
117
'
118
119
test_done
t/t5541-http-push-smart.sh
+1
-1
@@ -226,7 +226,7 @@ test_expect_success TTY 'push --quiet silences status and progress' '
226
cd "$ROOT_PATH"/test_repo_clone &&
227
test_commit quiet &&
228
test_terminal git push --quiet >output 2>&1 &&
229
- test_cmp /dev/null output
229
+ test_must_be_empty output
230
'
231
232
test_expect_success TTY 'push --no-progress silences progress but not status' '
t/t7401-submodule-summary.sh
+1
-1
@@ -300,7 +300,7 @@ test_expect_success 'should not fail in an empty repo' "
300
git init xyzzy &&
301
cd xyzzy &&
302
git submodule summary >output 2>&1 &&
303
- test_cmp output /dev/null
303
+ test_must_be_empty output
304
"
305
306
test_done
t/t7810-grep.sh
+1
-1
@@ -483,7 +483,7 @@ test_expect_success 'grep -L -C' '
483
484
test_expect_success 'grep --files-without-match --quiet' '
485
git grep --files-without-match --quiet nonexistent_string >actual &&
486
- test_cmp /dev/null actual
486
+ test_must_be_empty actual
487
'
488
489
cat >expected <<EOF