summaryrefslogtreecommitdiff
path: root/t/t7810-grep.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-08-27 21:33:43 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-08-27 21:33:43 (GMT)
commit986c5181071ce3aac42d0aaeb7bd691a1a0bdf4a (patch)
tree4ef3f9805cfdbf3b4496cb720a94c138df034204 /t/t7810-grep.sh
parentfc0df933c8fa09603a9e9798085ee07ca1a83f65 (diff)
parent1c5e94f459a0b7c23ef7e855441a65afdc4effab (diff)
downloadgit-986c5181071ce3aac42d0aaeb7bd691a1a0bdf4a.zip
git-986c5181071ce3aac42d0aaeb7bd691a1a0bdf4a.tar.gz
git-986c5181071ce3aac42d0aaeb7bd691a1a0bdf4a.tar.bz2
Merge branch 'sg/test-must-be-empty'
Test fixes. * sg/test-must-be-empty: tests: use 'test_must_be_empty' instead of 'test_cmp <empty> <out>' tests: use 'test_must_be_empty' instead of 'test_cmp /dev/null <out>' tests: use 'test_must_be_empty' instead of 'test ! -s' tests: use 'test_must_be_empty' instead of '! test -s'
Diffstat (limited to 't/t7810-grep.sh')
-rwxr-xr-xt/t7810-grep.sh35
1 files changed, 13 insertions, 22 deletions
diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh
index d826e24..be5c1bd 100755
--- a/t/t7810-grep.sh
+++ b/t/t7810-grep.sh
@@ -217,9 +217,8 @@ do
'
test_expect_success "grep -w $L (w)" '
- : >expected &&
test_must_fail git grep -n -w -e "^w" $H >actual &&
- test_cmp expected actual
+ test_must_be_empty actual
'
test_expect_success "grep -w $L (x)" '
@@ -239,26 +238,24 @@ do
'
test_expect_success "grep -w $L (y-2)" '
- : >expected &&
if git grep -n -w -e "^y y" $H >actual
then
echo should not have matched
cat actual
false
else
- test_cmp expected actual
+ test_must_be_empty actual
fi
'
test_expect_success "grep -w $L (z)" '
- : >expected &&
if git grep -n -w -e "^z" $H >actual
then
echo should not have matched
cat actual
false
else
- test_cmp expected actual
+ test_must_be_empty actual
fi
'
@@ -498,7 +495,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
@@ -619,11 +616,10 @@ z:zzz
EOF
test_expect_success 'grep -q, silently report matches' '
- >empty &&
git grep -q mmap >actual &&
- test_cmp empty actual &&
+ test_must_be_empty actual &&
test_must_fail git grep -q qfwfq >actual &&
- test_cmp empty actual
+ test_must_be_empty actual
'
test_expect_success 'grep -C1 hunk mark between files' '
@@ -716,8 +712,7 @@ test_expect_success 'log grep (9)' '
test_expect_success 'log grep (9)' '
git log -g --grep-reflog="commit: third" --author="non-existent" --pretty=tformat:%s >actual &&
- : >expect &&
- test_cmp expect actual
+ test_must_be_empty actual
'
test_expect_success 'log --grep-reflog can only be used under -g' '
@@ -807,15 +802,13 @@ test_expect_success 'log --all-match --grep --grep --author takes intersection'
'
test_expect_success 'log --author does not search in timestamp' '
- : >expect &&
git log --author="$GIT_AUTHOR_DATE" >actual &&
- test_cmp expect actual
+ test_must_be_empty actual
'
test_expect_success 'log --committer does not search in timestamp' '
- : >expect &&
git log --committer="$GIT_COMMITTER_DATE" >actual &&
- test_cmp expect actual
+ test_must_be_empty actual
'
test_expect_success 'grep with CE_VALID file' '
@@ -956,7 +949,7 @@ test_expect_success 'grep from a subdirectory to search wider area (2)' '
(
cd s &&
test_expect_code 1 git grep xxyyzz .. >out &&
- ! test -s out
+ test_must_be_empty out
)
'
@@ -1065,13 +1058,12 @@ test_expect_success 'inside git repository but with --no-index' '
echo ".gitignore:.*o*" &&
cat is/expect.unignored
} >is/expect.full &&
- : >is/expect.empty &&
echo file2:world >is/expect.sub &&
(
cd is/git &&
git init &&
test_must_fail git grep o >../actual.full &&
- test_cmp ../expect.empty ../actual.full &&
+ test_must_be_empty ../actual.full &&
git grep --untracked o >../actual.unignored &&
test_cmp ../expect.unignored ../actual.unignored &&
@@ -1084,7 +1076,7 @@ test_expect_success 'inside git repository but with --no-index' '
cd sub &&
test_must_fail git grep o >../../actual.sub &&
- test_cmp ../../expect.empty ../../actual.sub &&
+ test_must_be_empty ../../actual.sub &&
git grep --no-index o >../../actual.sub &&
test_cmp ../../expect.sub ../../actual.sub &&
@@ -1250,10 +1242,9 @@ test_expect_success !PCRE 'grep -P pattern errors without PCRE' '
'
test_expect_success 'grep pattern with grep.extendedRegexp=true' '
- >empty &&
test_must_fail git -c grep.extendedregexp=true \
grep "\p{Ps}.*?\p{Pe}" hello.c >actual &&
- test_cmp empty actual
+ test_must_be_empty actual
'
test_expect_success PCRE 'grep -P pattern with grep.extendedRegexp=true' '