Commit 41ac414e authored by Junio C Hamano's avatar Junio C Hamano

Sane use of test_expect_failure

Originally, test_expect_failure was designed to be the opposite
of test_expect_success, but this was a bad decision.  Most tests
run a series of commands that leads to the single command that
needs to be tested, like this:

    test_expect_{success,failure} 'test title' '
	setup1 &&
        setup2 &&
        setup3 &&
        what is to be tested
    '

And expecting a failure exit from the whole sequence misses the
point of writing tests.  Your setup$N that are supposed to
succeed may have failed without even reaching what you are
trying to test.  The only valid use of test_expect_failure is to
check a trivial single command that is expected to fail, which
is a minority in tests of Porcelain-ish commands.

This large-ish patch rewrites all uses of test_expect_failure to
use test_expect_success and rewrites the condition of what is
tested, like this:

    test_expect_success 'test title' '
	setup1 &&
        setup2 &&
        setup3 &&
        ! this command should fail
    '

test_expect_failure is redefined to serve as a reminder that
that test *should* succeed but due to a known breakage in git it
currently does not pass.  So if git-foo command should create a
file 'bar' but you discovered a bug that it doesn't, you can
write a test like this:

    test_expect_failure 'git-foo should create bar' '
        rm -f bar &&
        git foo &&
        test -f bar
    '

This construct acts similar to test_expect_success, but instead
of reporting "ok/FAIL" like test_expect_success does, the
outcome is reported as "FIXED/still broken".
Signed-off-by: default avatarJunio C Hamano <[email protected]>
parent 6ce8e44a
......@@ -160,14 +160,12 @@ library for your script to use.
- test_expect_failure <message> <script>
This is the opposite of test_expect_success. If <script>
yields success, test is considered a failure.
Example:
test_expect_failure \
'git-update-index without --add should fail adding.' \
'git-update-index should-be-empty'
This is NOT the opposite of test_expect_success, but is used
to mark a test that demonstrates a known breakage. Unlike
the usual test_expect_success tests, which say "ok" on
success and "FAIL" on failure, this will say "FIXED" on
success and "still broken" on failure. Failures from these
tests won't cause -i (immediate) to stop.
- test_debug <script>
......
......@@ -46,13 +46,25 @@ test_expect_success \
'.git/objects should have 3 subdirectories.' \
'test $(wc -l < full-of-directories) = 3'
################################################################
# Test harness
test_expect_success 'success is reported like this' '
:
'
test_expect_failure 'pretend we have a known breakage' '
false
'
test_expect_failure 'pretend we have fixed a known breakage' '
:
'
################################################################
# Basics of the basics
# updating a new file without --add should fail.
test_expect_failure \
'git update-index without --add should fail adding.' \
'git update-index should-be-empty'
test_expect_success 'git update-index without --add should fail adding.' '
! git update-index should-be-empty
'
# and with --add it should succeed, even if it is empty (it used to fail).
test_expect_success \
......@@ -70,9 +82,9 @@ test_expect_success \
# Removing paths.
rm -f should-be-empty full-of-directories
test_expect_failure \
'git update-index without --remove should fail removing.' \
'git update-index should-be-empty'
test_expect_success 'git update-index without --remove should fail removing.' '
! git update-index should-be-empty
'
test_expect_success \
'git update-index with --remove should be able to remove.' \
......@@ -204,9 +216,9 @@ test_expect_success \
'put invalid objects into the index.' \
'git update-index --index-info < badobjects'
test_expect_failure \
'writing this tree without --missing-ok.' \
'git write-tree'
test_expect_success 'writing this tree without --missing-ok.' '
! git write-tree
'
test_expect_success \
'writing this tree with --missing-ok.' \
......
......@@ -243,14 +243,14 @@ test_expect_success \
test `printf "$ttt$sss$sss$sss" | git stripspace | wc -l` -gt 0
'
test_expect_failure \
test_expect_success \
'text plus spaces without newline at end should not show spaces' '
printf "$ttt$sss" | git stripspace | grep -q " " ||
printf "$ttt$ttt$sss" | git stripspace | grep -q " " ||
printf "$ttt$ttt$ttt$sss" | git stripspace | grep -q " " ||
printf "$ttt$sss$sss" | git stripspace | grep -q " " ||
printf "$ttt$ttt$sss$sss" | git stripspace | grep -q " " ||
printf "$ttt$sss$sss$sss" | git stripspace | grep -q " "
! (printf "$ttt$sss" | git stripspace | grep -q " ") &&
! (printf "$ttt$ttt$sss" | git stripspace | grep -q " ") &&
! (printf "$ttt$ttt$ttt$sss" | git stripspace | grep -q " ") &&
! (printf "$ttt$sss$sss" | git stripspace | grep -q " ") &&
! (printf "$ttt$ttt$sss$sss" | git stripspace | grep -q " ") &&
! (printf "$ttt$sss$sss$sss" | git stripspace | grep -q " ")
'
test_expect_success \
......@@ -280,14 +280,14 @@ test_expect_success \
git diff expect actual
'
test_expect_failure \
test_expect_success \
'text plus spaces at end should not show spaces' '
echo "$ttt$sss" | git stripspace | grep -q " " ||
echo "$ttt$ttt$sss" | git stripspace | grep -q " " ||
echo "$ttt$ttt$ttt$sss" | git stripspace | grep -q " " ||
echo "$ttt$sss$sss" | git stripspace | grep -q " " ||
echo "$ttt$ttt$sss$sss" | git stripspace | grep -q " " ||
echo "$ttt$sss$sss$sss" | git stripspace | grep -q " "
! (echo "$ttt$sss" | git stripspace | grep -q " ") &&
! (echo "$ttt$ttt$sss" | git stripspace | grep -q " ") &&
! (echo "$ttt$ttt$ttt$sss" | git stripspace | grep -q " ") &&
! (echo "$ttt$sss$sss" | git stripspace | grep -q " ") &&
! (echo "$ttt$ttt$sss$sss" | git stripspace | grep -q " ") &&
! (echo "$ttt$sss$sss$sss" | git stripspace | grep -q " ")
'
test_expect_success \
......@@ -339,13 +339,13 @@ test_expect_success \
git diff expect actual
'
test_expect_failure \
test_expect_success \
'spaces without newline at end should not show spaces' '
printf "" | git stripspace | grep -q " " ||
printf "$sss" | git stripspace | grep -q " " ||
printf "$sss$sss" | git stripspace | grep -q " " ||
printf "$sss$sss$sss" | git stripspace | grep -q " " ||
printf "$sss$sss$sss$sss" | git stripspace | grep -q " "
! (printf "" | git stripspace | grep -q " ") &&
! (printf "$sss" | git stripspace | grep -q " ") &&
! (printf "$sss$sss" | git stripspace | grep -q " ") &&
! (printf "$sss$sss$sss" | git stripspace | grep -q " ") &&
! (printf "$sss$sss$sss$sss" | git stripspace | grep -q " ")
'
test_expect_success \
......
......@@ -87,9 +87,9 @@ test_expect_success 'unambiguously abbreviated option with "="' '
git diff expect output
'
test_expect_failure 'ambiguously abbreviated option' '
test_expect_success 'ambiguously abbreviated option' '
test-parse-options --strin 123;
test $? != 129
test $? = 129
'
cat > expect << EOF
......
......@@ -210,12 +210,12 @@ DF (file) when tree B require DF to be a directory by having DF/DF
END_OF_CASE_TABLE
test_expect_failure \
'1 - must not have an entry not in A.' \
"rm -f .git/index XX &&
test_expect_success '1 - must not have an entry not in A.' "
rm -f .git/index XX &&
echo XX >XX &&
git update-index --add XX &&
git read-tree -m $tree_O $tree_A $tree_B"
! git read-tree -m $tree_O $tree_A $tree_B
"
test_expect_success \
'2 - must match B in !O && !A && B case.' \
......@@ -248,13 +248,14 @@ test_expect_success \
echo extra >>AN &&
git read-tree -m $tree_O $tree_A $tree_B"
test_expect_failure \
'3 (fail) - must match A in !O && A && !B case.' \
"rm -f .git/index AN &&
test_expect_success \
'3 (fail) - must match A in !O && A && !B case.' "
rm -f .git/index AN &&
cp .orig-A/AN AN &&
echo extra >>AN &&
git update-index --add AN &&
git read-tree -m $tree_O $tree_A $tree_B"
! git read-tree -m $tree_O $tree_A $tree_B
"
test_expect_success \
'4 - must match and be up-to-date in !O && A && B && A!=B case.' \
......@@ -264,21 +265,23 @@ test_expect_success \
git read-tree -m $tree_O $tree_A $tree_B &&
check_result"
test_expect_failure \
'4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' \
"rm -f .git/index AA &&
test_expect_success \
'4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' "
rm -f .git/index AA &&
cp .orig-A/AA AA &&
git update-index --add AA &&
echo extra >>AA &&
git read-tree -m $tree_O $tree_A $tree_B"
! git read-tree -m $tree_O $tree_A $tree_B
"
test_expect_failure \
'4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' \
"rm -f .git/index AA &&
test_expect_success \
'4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' "
rm -f .git/index AA &&
cp .orig-A/AA AA &&
echo extra >>AA &&
git update-index --add AA &&
git read-tree -m $tree_O $tree_A $tree_B"
! git read-tree -m $tree_O $tree_A $tree_B
"
test_expect_success \
'5 - must match in !O && A && B && A==B case.' \
......@@ -297,34 +300,38 @@ test_expect_success \
git read-tree -m $tree_O $tree_A $tree_B &&
check_result"
test_expect_failure \
'5 (fail) - must match A in !O && A && B && A==B case.' \
"rm -f .git/index LL &&
test_expect_success \
'5 (fail) - must match A in !O && A && B && A==B case.' "
rm -f .git/index LL &&
cp .orig-A/LL LL &&
echo extra >>LL &&
git update-index --add LL &&
git read-tree -m $tree_O $tree_A $tree_B"
! git read-tree -m $tree_O $tree_A $tree_B
"
test_expect_failure \
'6 - must not exist in O && !A && !B case' \
"rm -f .git/index DD &&
test_expect_success \
'6 - must not exist in O && !A && !B case' "
rm -f .git/index DD &&
echo DD >DD
git update-index --add DD &&
git read-tree -m $tree_O $tree_A $tree_B"
! git read-tree -m $tree_O $tree_A $tree_B
"
test_expect_failure \
'7 - must not exist in O && !A && B && O!=B case' \
"rm -f .git/index DM &&
test_expect_success \
'7 - must not exist in O && !A && B && O!=B case' "
rm -f .git/index DM &&
cp .orig-B/DM DM &&
git update-index --add DM &&
git read-tree -m $tree_O $tree_A $tree_B"
! git read-tree -m $tree_O $tree_A $tree_B
"
test_expect_failure \
'8 - must not exist in O && !A && B && O==B case' \
"rm -f .git/index DN &&
test_expect_success \
'8 - must not exist in O && !A && B && O==B case' "
rm -f .git/index DN &&
cp .orig-B/DN DN &&
git update-index --add DN &&
git read-tree -m $tree_O $tree_A $tree_B"
! git read-tree -m $tree_O $tree_A $tree_B
"
test_expect_success \
'9 - must match and be up-to-date in O && A && !B && O!=A case' \
......@@ -334,21 +341,23 @@ test_expect_success \
git read-tree -m $tree_O $tree_A $tree_B &&
check_result"
test_expect_failure \
'9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' \
"rm -f .git/index MD &&
test_expect_success \
'9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' "
rm -f .git/index MD &&
cp .orig-A/MD MD &&
git update-index --add MD &&
echo extra >>MD &&
git read-tree -m $tree_O $tree_A $tree_B"
! git read-tree -m $tree_O $tree_A $tree_B
"
test_expect_failure \
'9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' \
"rm -f .git/index MD &&
test_expect_success \
'9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' "
rm -f .git/index MD &&
cp .orig-A/MD MD &&
echo extra >>MD &&
git update-index --add MD &&
git read-tree -m $tree_O $tree_A $tree_B"
! git read-tree -m $tree_O $tree_A $tree_B
"
test_expect_success \
'10 - must match and be up-to-date in O && A && !B && O==A case' \
......@@ -358,21 +367,23 @@ test_expect_success \
git read-tree -m $tree_O $tree_A $tree_B &&
check_result"
test_expect_failure \
'10 (fail) - must match and be up-to-date in O && A && !B && O==A case' \
"rm -f .git/index ND &&
test_expect_success \
'10 (fail) - must match and be up-to-date in O && A && !B && O==A case' "
rm -f .git/index ND &&
cp .orig-A/ND ND &&
git update-index --add ND &&
echo extra >>ND &&
git read-tree -m $tree_O $tree_A $tree_B"
! git read-tree -m $tree_O $tree_A $tree_B
"
test_expect_failure \
'10 (fail) - must match and be up-to-date in O && A && !B && O==A case' \
"rm -f .git/index ND &&
test_expect_success \
'10 (fail) - must match and be up-to-date in O && A && !B && O==A case' "
rm -f .git/index ND &&
cp .orig-A/ND ND &&
echo extra >>ND &&
git update-index --add ND &&
git read-tree -m $tree_O $tree_A $tree_B"
! git read-tree -m $tree_O $tree_A $tree_B
"
test_expect_success \
'11 - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' \
......@@ -382,21 +393,23 @@ test_expect_success \
git read-tree -m $tree_O $tree_A $tree_B &&
check_result"
test_expect_failure \
'11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' \
"rm -f .git/index MM &&
test_expect_success \
'11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' "
rm -f .git/index MM &&
cp .orig-A/MM MM &&
git update-index --add MM &&
echo extra >>MM &&
git read-tree -m $tree_O $tree_A $tree_B"
! git read-tree -m $tree_O $tree_A $tree_B
"
test_expect_failure \
'11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' \
"rm -f .git/index MM &&
test_expect_success \
'11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' "
rm -f .git/index MM &&
cp .orig-A/MM MM &&
echo extra >>MM &&
git update-index --add MM &&
git read-tree -m $tree_O $tree_A $tree_B"
! git read-tree -m $tree_O $tree_A $tree_B
"
test_expect_success \
'12 - must match A in O && A && B && O!=A && A==B case' \
......@@ -415,13 +428,14 @@ test_expect_success \
git read-tree -m $tree_O $tree_A $tree_B &&
check_result"
test_expect_failure \
'12 (fail) - must match A in O && A && B && O!=A && A==B case' \
"rm -f .git/index SS &&
test_expect_success \
'12 (fail) - must match A in O && A && B && O!=A && A==B case' "
rm -f .git/index SS &&
cp .orig-A/SS SS &&
echo extra >>SS &&
git update-index --add SS &&
git read-tree -m $tree_O $tree_A $tree_B"
! git read-tree -m $tree_O $tree_A $tree_B
"
test_expect_success \
'13 - must match A in O && A && B && O!=A && O==B case' \
......@@ -457,21 +471,23 @@ test_expect_success \
git read-tree -m $tree_O $tree_A $tree_B &&
check_result"
test_expect_failure \
'14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' \
"rm -f .git/index NM &&
test_expect_success \
'14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' "
rm -f .git/index NM &&
cp .orig-A/NM NM &&
git update-index --add NM &&
echo extra >>NM &&
git read-tree -m $tree_O $tree_A $tree_B"
! git read-tree -m $tree_O $tree_A $tree_B
"
test_expect_failure \
'14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' \
"rm -f .git/index NM &&
test_expect_success \
'14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' "
rm -f .git/index NM &&
cp .orig-A/NM NM &&
echo extra >>NM &&
git update-index --add NM &&
git read-tree -m $tree_O $tree_A $tree_B"
! git read-tree -m $tree_O $tree_A $tree_B
"
test_expect_success \
'15 - must match A in O && A && B && O==A && O==B case' \
......@@ -490,13 +506,14 @@ test_expect_success \
git read-tree -m $tree_O $tree_A $tree_B &&
check_result"
test_expect_failure \
'15 (fail) - must match A in O && A && B && O==A && O==B case' \
"rm -f .git/index NN &&
test_expect_success \
'15 (fail) - must match A in O && A && B && O==A && O==B case' "
rm -f .git/index NN &&
cp .orig-A/NN NN &&
echo extra >>NN &&
git update-index --add NN &&
git read-tree -m $tree_O $tree_A $tree_B"
! git read-tree -m $tree_O $tree_A $tree_B
"
# #16
test_expect_success \
......
......@@ -101,8 +101,8 @@ echo "Play, play, play" >>hello
echo "Lots of fun" >>example
git commit -m 'Some fun.' -i hello example
test_expect_failure 'git resolve now fails' '
git merge -m "Merge work in mybranch" mybranch
test_expect_success 'git resolve now fails' '
! git merge -m "Merge work in mybranch" mybranch
'
cat > hello << EOF
......@@ -156,6 +156,8 @@ test_expect_success 'git show-branch' 'cmp show-branch2.expect show-branch2.outp
test_expect_success 'git repack' 'git repack'
test_expect_success 'git prune-packed' 'git prune-packed'
test_expect_failure '-> only packed objects' 'find -type f .git/objects/[0-9a-f][0-9a-f]'
test_expect_success '-> only packed objects' '
! find -type f .git/objects/[0-9a-f][0-9a-f]
'
test_done
......@@ -181,8 +181,9 @@ test_expect_success 'non-match' \
test_expect_success 'non-match value' \
'test wow = $(git config --get nextsection.nonewline !for)'
test_expect_failure 'ambiguous get' \
'git config --get nextsection.nonewline'
test_expect_success 'ambiguous get' '
! git config --get nextsection.nonewline
'
test_expect_success 'get multivar' \
'git config --get-all nextsection.nonewline'
......@@ -202,13 +203,17 @@ EOF
test_expect_success 'multivar replace' 'cmp .git/config expect'
test_expect_failure 'ambiguous value' 'git config nextsection.nonewline'
test_expect_success 'ambiguous value' '
! git config nextsection.nonewline
'
test_expect_failure 'ambiguous unset' \
'git config --unset nextsection.nonewline'
test_expect_success 'ambiguous unset' '
! git config --unset nextsection.nonewline
'
test_expect_failure 'invalid unset' \
'git config --unset somesection.nonewline'
test_expect_success 'invalid unset' '
! git config --unset somesection.nonewline
'
git config --unset nextsection.nonewline "wow3$"
......@@ -224,7 +229,7 @@ EOF
test_expect_success 'multivar unset' 'cmp .git/config expect'
test_expect_failure 'invalid key' 'git config inval.2key blabla'
test_expect_success 'invalid key' '! git config inval.2key blabla'
test_expect_success 'correct key' 'git config 123456.a123 987'
......@@ -382,8 +387,9 @@ EOF
test_expect_success "rename succeeded" "git diff expect .git/config"
test_expect_failure "rename non-existing section" \
'git config --rename-section branch."world domination" branch.drei'
test_expect_success "rename non-existing section" '
! git config --rename-section branch."world domination" branch.drei
'
test_expect_success "rename succeeded" "git diff expect .git/config"
......@@ -494,14 +500,14 @@ test_expect_success bool '
done &&
cmp expect result'
test_expect_failure 'invalid bool (--get)' '
test_expect_success 'invalid bool (--get)' '
git config bool.nobool foobar &&
git config --bool --get bool.nobool'
! git config --bool --get bool.nobool'
test_expect_failure 'invalid bool (set)' '
test_expect_success 'invalid bool (set)' '
git config --bool bool.nobool foobar'
! git config --bool bool.nobool foobar'
rm .git/config
......@@ -562,8 +568,9 @@ EOF
test_expect_success 'quoting' 'cmp .git/config expect'
test_expect_failure 'key with newline' 'git config key.with\\\
newline 123'
test_expect_success 'key with newline' '
! git config "key.with
newline" 123'
test_expect_success 'value with newline' 'git config key.sub value.with\\\
newline'
......
......@@ -40,7 +40,8 @@ test_expect_success 'gitdir required mode on normal repos' '
(git apply --check --index test.patch &&
cd test && git apply --check --index ../test.patch)'
test_expect_failure 'gitdir required mode on unsupported repo' '
(cd test2 && git apply --check --index ../test.patch)'
test_expect_success 'gitdir required mode on unsupported repo' '
(cd test2 && ! git apply --check --index ../test.patch)
'
test_done
......@@ -51,23 +51,23 @@ test_expect_success \
test $B"' = $(cat .git/'"$m"')'
rm -f .git/$m
test_expect_failure \
'(not) create HEAD with old sha1' \
"git update-ref HEAD $A $B"
test_expect_failure \
"(not) prior created .git/$m" \
"test -f .git/$m"
test_expect_success '(not) create HEAD with old sha1' "
! git update-ref HEAD $A $B
"
test_expect_success "(not) prior created .git/$m" "
! test -f .git/$m
"
rm -f .git/$m
test_expect_success \
"create HEAD" \
"git update-ref HEAD $A"
test_expect_failure \
'(not) change HEAD with wrong SHA1' \
"git update-ref HEAD $B $Z"
test_expect_failure \
"(not) changed .git/$m" \
"test $B"' = $(cat .git/'"$m"')'
test_expect_success '(not) change HEAD with wrong SHA1' "
! git update-ref HEAD $B $Z
"
test_expect_success "(not) changed .git/$m" "
! test $B"' = $(cat .git/'"$m"')
'
rm -f .git/$m
: a repository with working tree always has reflog these days...
......
......@@ -36,9 +36,9 @@ mkdir path0
date >path0/file0
date >path1
test_expect_failure \
test_expect_success \
'git checkout-index without -f should fail on conflicting work tree.' \
'git checkout-index -a'
'! git checkout-index -a'
test_expect_success \
'git checkout-index with -f should succeed.' \
......
......@@ -16,12 +16,12 @@ echo frotz >path0 &&
git update-index --add path0 &&
t=$(git write-tree)'
test_expect_failure \
test_expect_success \
'without -u, git checkout-index smudges stat information.' '
rm -f path0 &&
git read-tree $t &&
git checkout-index -f -a &&
git diff-files | diff - /dev/null'
! git diff-files | diff - /dev/null'
test_expect_success \
'with -u, git checkout-index picks up stat information from new files.' '
......
......@@ -67,16 +67,16 @@ test_expect_success 'checkout with simple prefix' '
'
test_expect_failure 'relative path outside tree should fail' \
'git checkout HEAD -- ../../Makefile'
test_expect_success 'relative path outside tree should fail' \
'! git checkout HEAD -- ../../Makefile'
test_expect_failure 'incorrect relative path to file should fail (1)' \
'git checkout HEAD -- ../file0'
test_expect_success 'incorrect relative path to file should fail (1)' \
'! git checkout HEAD -- ../file0'
test_expect_failure 'incorrect relative path should fail (2)' \
'( cd dir1 && git checkout HEAD -- ./file0 )'
test_expect_success 'incorrect relative path should fail (2)' \
'( cd dir1 && ! git checkout HEAD -- ./file0 )'
test_expect_failure 'incorrect relative path should fail (3)' \
'( cd dir1 && git checkout HEAD -- ../../file0 )'
test_expect_success 'incorrect relative path should fail (3)' \
'( cd dir1 && ! git checkout HEAD -- ../../file0 )'
test_done
......@@ -44,8 +44,8 @@ date >path1/file1
for p in path0/file0 path1/file1 path2 path3
do
test_expect_failure \
test_expect_success \
"git update-index to add conflicting path $p should fail." \
"git update-index --add -- $p"
"! git update-index --add -- $p"
done
test_done
......@@ -15,9 +15,9 @@ touch foo bar
git update-index --add foo bar
git-commit -m "add foo bar"
test_expect_failure \
test_expect_success \
'git ls-files --error-unmatch should fail with unmatched path.' \
'git ls-files --error-unmatch foo bar-does-not-match'
'! git ls-files --error-unmatch foo bar-does-not-match'
test_expect_success \
'git ls-files --error-unmatch should succeed eith matched paths.' \
......
......@@ -17,10 +17,11 @@ test_expect_success \
git-commit -m "Initial commit." &&
HEAD=$(git rev-parse --verify HEAD)'
test_expect_failure \
'git branch --help should not have created a bogus branch' \
'git branch --help </dev/null >/dev/null 2>/dev/null || :
test -f .git/refs/heads/--help'
test_expect_success \
'git branch --help should not have created a bogus branch' '
git branch --help </dev/null >/dev/null 2>/dev/null;
! test -f .git/refs/heads/--help
'
test_expect_success \
'git branch abc should create a branch' \
......@@ -71,17 +72,17 @@ test_expect_success \
git branch -m n/n n
test -f .git/logs/refs/heads/n'
test_expect_failure \
'git branch -m o/o o should fail when o/p exists' \
'git branch o/o &&
test_expect_success 'git branch -m o/o o should fail when o/p exists' '
git branch o/o &&
git branch o/p &&
git branch -m o/o o'
! git branch -m o/o o
'
test_expect_failure \
'git branch -m q r/q should fail when r exists' \
'git branch q &&
git branch r &&
git branch -m q r/q'
test_expect_success 'git branch -m q r/q should fail when r exists' '
git branch q &&
git branch r &&
! git branch -m q r/q
'
mv .git/config .git/config-saved
......@@ -108,12 +109,13 @@ test_expect_success 'config information was renamed, too' \
"test $(git config branch.s.dummy) = Hello &&
! git config branch.s/s/dummy"
test_expect_failure \
'git branch -m u v should fail when the reflog for u is a symlink' \
'git branch -l u &&
test_expect_success \
'git branch -m u v should fail when the reflog for u is a symlink' '
git branch -l u &&
mv .git/logs/refs/heads/u real-u &&
ln -s real-u .git/logs/refs/heads/u &&
git branch -m u v'
! git branch -m u v
'
test_expect_success 'test tracking setup via --track' \
'git config remote.local.url . &&
......
......@@ -39,12 +39,12 @@ test_expect_success \
git show-ref b >result &&
diff expect result'
test_expect_failure \
'git branch c/d should barf if branch c exists' \
'git branch c &&
test_expect_success 'git branch c/d should barf if branch c exists' '