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>
This commit is contained in:
parent
f0dc593a95
commit
ec21ac8c18
@ -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/' '
|
||||
|
@ -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 &&
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
'
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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' '
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user