Skip to content
Snippets Groups Projects
Commit 14677d25 authored by Junio C Hamano's avatar Junio C Hamano
Browse files

Merge branch 'ab/test-must-be-empty-for-master'

Test updates.

* ab/test-must-be-empty-for-master:
  tests: make use of the test_must_be_empty function
parents 34f22979 d3c6751b
No related branches found
No related tags found
No related merge requests found
Showing
with 66 additions and 116 deletions
Loading
Loading
@@ -807,10 +807,9 @@ test_expect_success 'trailing whitespace is ignored' '
cat >expect <<EOF &&
whitespace/untracked
EOF
: >err.expect &&
git ls-files -o -X ignore whitespace >actual 2>err &&
test_cmp expect actual &&
test_cmp err.expect err
test_must_be_empty err
'
 
test_expect_success !MINGW 'quoting allows trailing whitespace' '
Loading
Loading
@@ -820,10 +819,9 @@ test_expect_success !MINGW 'quoting allows trailing whitespace' '
>whitespace/untracked &&
echo "whitespace/trailing\\ \\ " >ignore &&
echo whitespace/untracked >expect &&
: >err.expect &&
git ls-files -o -X ignore whitespace >actual 2>err &&
test_cmp expect actual &&
test_cmp err.expect err
test_must_be_empty err
'
 
test_expect_success !MINGW,!CYGWIN 'correct handling of backslashes' '
Loading
Loading
@@ -845,10 +843,9 @@ test_expect_success !MINGW,!CYGWIN 'correct handling of backslashes' '
whitespace/trailing 6 \\a\\Z
EOF
echo whitespace/untracked >expect &&
>err.expect &&
git ls-files -o -X ignore whitespace >actual 2>err &&
test_cmp expect actual &&
test_cmp err.expect err
test_must_be_empty err
'
 
test_expect_success 'info/exclude trumps core.excludesfile' '
Loading
Loading
Loading
Loading
@@ -110,31 +110,30 @@ test_expect_success \
 
test_expect_success \
'only consecutive blank lines should be completely removed' '
> expect &&
 
printf "\n" | git stripspace >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
 
printf "\n\n\n" | git stripspace >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
 
printf "$sss\n$sss\n$sss\n" | git stripspace >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
 
printf "$sss$sss\n$sss\n\n" | git stripspace >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
 
printf "\n$sss\n$sss$sss\n" | git stripspace >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
 
printf "$sss$sss$sss$sss\n\n\n" | git stripspace >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
 
printf "\n$sss$sss$sss$sss\n\n" | git stripspace >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
 
printf "\n\n$sss$sss$sss$sss\n" | git stripspace >actual &&
test_cmp expect actual
test_must_be_empty actual
'
 
test_expect_success \
Loading
Loading
Loading
Loading
@@ -294,8 +294,7 @@ test_expect_success 'helpers can abort the process' '
-c credential.helper="!f() { echo quit=1; }; f" \
-c credential.helper="verbatim foo bar" \
credential fill >stdout &&
>expect &&
test_cmp expect stdout
test_must_be_empty stdout
'
 
test_expect_success 'empty helper spec resets helper list' '
Loading
Loading
Loading
Loading
@@ -227,12 +227,11 @@ test_expect_success 'index removal and worktree narrowing at the same time' '
'
 
test_expect_success 'read-tree --reset removes outside worktree' '
>empty &&
echo init.t >.git/info/sparse-checkout &&
git checkout -f top &&
git reset --hard removed &&
git ls-files sub/added >result &&
test_cmp empty result
test_must_be_empty result
'
 
test_expect_success 'print errors when failed to update worktree' '
Loading
Loading
Loading
Loading
@@ -114,11 +114,10 @@ test_expect_success 'Exclusion in a non-XDG global ignore file' '
'
 
test_expect_success 'Checking XDG ignore file when HOME is unset' '
>expected &&
(sane_unset HOME &&
git config --unset core.excludesfile &&
git ls-files --exclude-standard --ignored >actual) &&
test_cmp expected actual
test_must_be_empty actual
'
 
test_expect_success 'Checking attributes in the XDG attributes file' '
Loading
Loading
@@ -132,10 +131,9 @@ test_expect_success 'Checking attributes in the XDG attributes file' '
'
 
test_expect_success 'Checking XDG attributes when HOME is unset' '
>expected &&
(sane_unset HOME &&
git check-attr -a f >actual) &&
test_cmp expected actual
test_must_be_empty actual
'
 
test_expect_success '$XDG_CONFIG_HOME overrides $HOME/.config/git/attributes' '
Loading
Loading
Loading
Loading
@@ -26,26 +26,22 @@ test_expect_success 'show-ref' '
git show-ref refs/tags/A >actual &&
test_cmp expect actual &&
 
>expect &&
test_must_fail git show-ref D >actual &&
test_cmp expect actual
test_must_be_empty actual
'
 
test_expect_success 'show-ref -q' '
>expect &&
git show-ref -q A >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
 
git show-ref -q tags/A >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
 
git show-ref -q refs/tags/A >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
 
test_must_fail git show-ref -q D >actual &&
test_cmp expect actual
test_must_be_empty actual
'
 
test_expect_success 'show-ref --verify' '
Loading
Loading
@@ -54,32 +50,28 @@ test_expect_success 'show-ref --verify' '
git show-ref --verify refs/tags/A >actual &&
test_cmp expect actual &&
 
>expect &&
test_must_fail git show-ref --verify A >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
 
test_must_fail git show-ref --verify tags/A >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
 
test_must_fail git show-ref --verify D >actual &&
test_cmp expect actual
test_must_be_empty actual
'
 
test_expect_success 'show-ref --verify -q' '
>expect &&
git show-ref --verify -q refs/tags/A >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
 
test_must_fail git show-ref --verify -q A >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
 
test_must_fail git show-ref --verify -q tags/A >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
 
test_must_fail git show-ref --verify -q D >actual &&
test_cmp expect actual
test_must_be_empty actual
'
 
test_expect_success 'show-ref -d' '
Loading
Loading
@@ -113,19 +105,17 @@ test_expect_success 'show-ref -d' '
git show-ref -d --verify refs/heads/master >actual &&
test_cmp expect actual &&
 
>expect &&
test_must_fail git show-ref -d --verify master >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
 
test_must_fail git show-ref -d --verify heads/master >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
 
test_must_fail git show-ref --verify -d A C >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
 
test_must_fail git show-ref --verify -d tags/A tags/C >actual &&
test_cmp expect actual
test_must_be_empty actual
 
'
 
Loading
Loading
@@ -178,10 +168,8 @@ test_expect_success 'show-ref --verify HEAD' '
git show-ref --verify HEAD >actual &&
test_cmp expect actual &&
 
>expect &&
git show-ref --verify -q HEAD >actual &&
test_cmp expect actual
test_must_be_empty actual
'
 
test_expect_success 'show-ref --verify with dangling ref' '
Loading
Loading
Loading
Loading
@@ -138,8 +138,7 @@ test_expect_success 'branch -d other@{u}' '
git checkout -t -b other master &&
git branch -d @{u} &&
git for-each-ref refs/heads/master >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
 
test_expect_success 'checkout other@{u}' '
Loading
Loading
Loading
Loading
@@ -48,8 +48,7 @@ test_expect_success 'Just "git add" is a no-op' '
>will-not-be-added &&
git add &&
git diff-index --name-status --cached HEAD >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
 
test_done
Loading
Loading
@@ -210,8 +210,7 @@ test_expect_success 'subdirectory ignore (toplevel)' '
cd top &&
git ls-files -o --exclude-standard
) >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
 
test_expect_success 'subdirectory ignore (l1/l2)' '
Loading
Loading
@@ -219,8 +218,7 @@ test_expect_success 'subdirectory ignore (l1/l2)' '
cd top/l1/l2 &&
git ls-files -o --exclude-standard
) >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
 
test_expect_success 'subdirectory ignore (l1)' '
Loading
Loading
@@ -228,8 +226,7 @@ test_expect_success 'subdirectory ignore (l1)' '
cd top/l1 &&
git ls-files -o --exclude-standard
) >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
 
test_expect_success 'show/hide empty ignored directory (setup)' '
Loading
Loading
@@ -251,8 +248,7 @@ test_expect_success 'hide empty ignored directory with --no-empty-directory' '
cd top &&
git ls-files -o -i --exclude l1 --directory --no-empty-directory
) >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
 
test_expect_success 'show/hide empty ignored sub-directory (setup)' '
Loading
Loading
@@ -277,8 +273,7 @@ test_expect_success 'hide empty ignored sub-directory with --no-empty-directory'
cd top &&
git ls-files -o -i --exclude l1 --directory --no-empty-directory
) >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
 
test_expect_success 'pattern matches prefix completely' '
Loading
Loading
Loading
Loading
@@ -101,8 +101,7 @@ match_with_ls_files() {
 
match_stdout_stderr_cmp="
tr -d '\0' <actual.raw >actual &&
>expect.err &&
test_cmp expect.err actual.err &&
test_must_be_empty actual.err &&
test_cmp expect actual"
 
if test "$match_expect" = 'E'
Loading
Loading
Loading
Loading
@@ -48,16 +48,14 @@ test_expect_success 'branch --contains master' '
test_expect_success 'branch --no-contains=master' '
 
git branch --no-contains=master >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
 
'
 
test_expect_success 'branch --no-contains master' '
 
git branch --no-contains master >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
 
'
 
Loading
Loading
@@ -94,8 +92,7 @@ test_expect_success 'branch --contains with pattern implies --list' '
test_expect_success 'branch --no-contains with pattern implies --list' '
 
git branch --no-contains=master master >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
 
'
 
Loading
Loading
@@ -123,8 +120,7 @@ test_expect_success 'branch --merged with pattern implies --list' '
test_expect_success 'side: branch --no-merged' '
 
git branch --no-merged >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
 
'
 
Loading
Loading
@@ -152,8 +148,7 @@ test_expect_success 'master: branch --no-merged' '
test_expect_success 'branch --no-merged with pattern implies --list' '
 
git branch --no-merged=master master >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
 
'
 
Loading
Loading
Loading
Loading
@@ -188,9 +188,8 @@ test_expect_success 'git add --refresh with pathspec' '
git add foo bar baz && H=$(git rev-parse :foo) && git rm -f foo &&
echo "100644 $H 3 foo" | git update-index --index-info &&
test-tool chmtime -60 bar baz &&
>expect &&
git add --refresh bar >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
 
git diff-files --name-only >actual &&
! grep bar actual&&
Loading
Loading
Loading
Loading
@@ -187,9 +187,8 @@ test_expect_failure 'handle existing decomposed filenames' '
echo content >"verbatim.$Adiarnfd" &&
git -c core.precomposeunicode=false add "verbatim.$Adiarnfd" &&
git commit -m "existing decomposed file" &&
>expect &&
git ls-files --exclude-standard -o "verbatim*" >untracked &&
test_cmp expect untracked
test_must_be_empty untracked
'
 
# Test if the global core.precomposeunicode stops autosensing
Loading
Loading
Loading
Loading
@@ -74,8 +74,7 @@ test_expect_success 'diff-tree pathspec' '
tree2=$(git write-tree) &&
echo "$tree2" &&
git diff-tree -r --name-only $tree $tree2 -- pa path1/a >current &&
>expected &&
test_cmp expected current
test_must_be_empty current
'
 
test_expect_success 'diff-tree with wildcard shows dir also matches' '
Loading
Loading
Loading
Loading
@@ -93,21 +93,20 @@ test_expect_success 'another test, without options' '
git diff >out &&
test_cmp expect out &&
 
>expect &&
git diff -w >out &&
test_cmp expect out &&
test_must_be_empty out &&
 
git diff -w -b >out &&
test_cmp expect out &&
test_must_be_empty out &&
 
git diff -w --ignore-space-at-eol >out &&
test_cmp expect out &&
test_must_be_empty out &&
 
git diff -w -b --ignore-space-at-eol >out &&
test_cmp expect out &&
test_must_be_empty out &&
 
git diff -w --ignore-cr-at-eol >out &&
test_cmp expect out &&
test_must_be_empty out &&
 
tr "Q_" "\015 " <<-\EOF >expect &&
diff --git a/x b/x
Loading
Loading
@@ -182,8 +181,7 @@ test_expect_success 'ignore-blank-lines: only new lines' '
test_seq 5 | sed "/3/i\\
" >x &&
git diff --ignore-blank-lines >out &&
>expect &&
test_cmp expect out
test_must_be_empty out
'
 
test_expect_success 'ignore-blank-lines: only new lines with space' '
Loading
Loading
@@ -192,8 +190,7 @@ test_expect_success 'ignore-blank-lines: only new lines with space' '
test_seq 5 | sed "/3/i\\
" >x &&
git diff -w --ignore-blank-lines >out &&
>expect &&
test_cmp expect out
test_must_be_empty out
'
 
test_expect_success 'ignore-blank-lines: after change' '
Loading
Loading
Loading
Loading
@@ -34,9 +34,8 @@ test_expect_success POSIXPERM 'find-copies-harder is not confused by mode bits'
git add exec &&
git commit -m exec &&
git update-index --assume-unchanged exec &&
>expect &&
git diff-files --find-copies-harder -- exec >actual &&
test_cmp expect actual
test_must_be_empty actual
'
 
test_done
Loading
Loading
@@ -267,8 +267,7 @@ rerere_gc_custom_expiry_test () {
git -c "gc.rerereresolved=$right_now" \
-c "gc.rerereunresolved=$right_now" rerere gc &&
find .git/rr-cache -type f | sort >actual &&
>expect &&
test_cmp expect actual
test_must_be_empty actual
'
}
 
Loading
Loading
@@ -536,9 +535,8 @@ test_expect_success 'multiple identical conflicts' '
 
# We resolved file1 and file2
git rerere &&
>expect &&
git rerere remaining >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
 
# We must have recorded both of them
count_pre_post 2 2 &&
Loading
Loading
@@ -548,9 +546,8 @@ test_expect_success 'multiple identical conflicts' '
test_must_fail git merge six.1 &&
git rerere &&
 
>expect &&
git rerere remaining >actual &&
test_cmp expect actual &&
test_must_be_empty actual &&
 
concat_insert short 6.1 6.2 >file1.expect &&
concat_insert long 6.1 6.2 >file2.expect &&
Loading
Loading
Loading
Loading
@@ -340,10 +340,9 @@ test_expect_success PCRE 'log -F -E --perl-regexp --grep=<pcre> uses PCRE' '
'
 
test_expect_success 'log with grep.patternType configuration' '
>expect &&
git -c grep.patterntype=fixed \
log -1 --pretty=tformat:%s --grep=s.c.nd >actual &&
test_cmp expect actual
test_must_be_empty actual
'
 
test_expect_success 'log with grep.patternType configuration and command line' '
Loading
Loading
@@ -1662,9 +1661,8 @@ test_expect_success 'log diagnoses bogus HEAD' '
'
 
test_expect_success 'log does not default to HEAD when rev input is given' '
>expect &&
git log --branches=does-not-exist >actual &&
test_cmp expect actual
test_must_be_empty actual
'
 
test_expect_success 'set up --source tests' '
Loading
Loading
Loading
Loading
@@ -44,15 +44,13 @@ test_expect_success !MINGW 'log --grep searches in log output encoding (latin1)'
'
 
test_expect_success !MINGW 'log --grep does not find non-reencoded values (utf8)' '
>expect &&
git log --encoding=utf8 --format=%s --grep=$latin1_e >actual &&
test_cmp expect actual
test_must_be_empty actual
'
 
test_expect_success 'log --grep does not find non-reencoded values (latin1)' '
>expect &&
git log --encoding=ISO-8859-1 --format=%s --grep=$utf8_e >actual &&
test_cmp expect actual
test_must_be_empty actual
'
 
test_done
Loading
Loading
@@ -309,9 +309,8 @@ test_expect_success 'pack reuse respects --honor-pack-keep' '
done &&
reusable_pack --honor-pack-keep >empty.pack &&
git index-pack empty.pack &&
>expect &&
git show-index <empty.idx >actual &&
test_cmp expect actual
test_must_be_empty actual
'
 
test_expect_success 'pack reuse respects --local' '
Loading
Loading
@@ -319,17 +318,15 @@ test_expect_success 'pack reuse respects --local' '
test_when_finished "mv alt.git/objects/pack/* .git/objects/pack/" &&
reusable_pack --local >empty.pack &&
git index-pack empty.pack &&
>expect &&
git show-index <empty.idx >actual &&
test_cmp expect actual
test_must_be_empty actual
'
 
test_expect_success 'pack reuse respects --incremental' '
reusable_pack --incremental >empty.pack &&
git index-pack empty.pack &&
>expect &&
git show-index <empty.idx >actual &&
test_cmp expect actual
test_must_be_empty actual
'
 
test_expect_success 'truncated bitmap fails gracefully' '
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment