t1000: modernize style

The preferred style in tests is:

    test_expect_success 'short description then sq to open the body' '
	    here comes the test &&
	    and chains over many lines &&
	    with closing sq on its own line
    '

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Stefan Beller 2017-01-09 17:45:40 -08:00 committed by Junio C Hamano
parent 84a7f09625
commit 0b8b25f610

View file

@ -128,29 +128,29 @@ cat >expected <<\EOF
EOF EOF
check_result () { check_result () {
git ls-files --stage | sed -e 's/ '"$_x40"' / X /' >current && git ls-files --stage | sed -e 's/ '"$_x40"' / X /' >current &&
test_cmp expected current test_cmp expected current
} }
# This is done on an empty work directory, which is the normal # This is done on an empty work directory, which is the normal
# merge person behaviour. # merge person behaviour.
test_expect_success \ test_expect_success '3-way merge with git read-tree -m, empty cache' '
'3-way merge with git read-tree -m, empty cache' \ rm -fr [NDMALTS][NDMALTSF] Z &&
"rm -fr [NDMALTS][NDMALTSF] Z && rm .git/index &&
rm .git/index && read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
read_tree_must_succeed -m $tree_O $tree_A $tree_B && check_result
check_result" '
# This starts out with the first head, which is the normal # This starts out with the first head, which is the normal
# patch submitter behaviour. # patch submitter behaviour.
test_expect_success \ test_expect_success '3-way merge with git read-tree -m, match H' '
'3-way merge with git read-tree -m, match H' \ rm -fr [NDMALTS][NDMALTSF] Z &&
"rm -fr [NDMALTS][NDMALTSF] Z && rm .git/index &&
rm .git/index && read_tree_must_succeed $tree_A &&
read_tree_must_succeed $tree_A && git checkout-index -f -u -a &&
git checkout-index -f -u -a && read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
read_tree_must_succeed -m $tree_O $tree_A $tree_B && check_result
check_result" '
: <<\END_OF_CASE_TABLE : <<\END_OF_CASE_TABLE
@ -208,322 +208,304 @@ DF (file) when tree B require DF to be a directory by having DF/DF
END_OF_CASE_TABLE END_OF_CASE_TABLE
test_expect_success '1 - must not have an entry not in A.' " test_expect_success '1 - must not have an entry not in A.' '
rm -f .git/index XX && rm -f .git/index XX &&
echo XX >XX && echo XX >XX &&
git update-index --add XX && git update-index --add XX &&
read_tree_must_fail -m $tree_O $tree_A $tree_B read_tree_must_fail -m $tree_O $tree_A $tree_B
" '
test_expect_success \ test_expect_success '2 - must match B in !O && !A && B case.' '
'2 - must match B in !O && !A && B case.' \ rm -f .git/index NA &&
"rm -f .git/index NA && cp .orig-B/NA NA &&
cp .orig-B/NA NA && git update-index --add NA &&
git update-index --add NA && read_tree_must_succeed -m $tree_O $tree_A $tree_B
read_tree_must_succeed -m $tree_O $tree_A $tree_B" '
test_expect_success \ test_expect_success '2 - matching B alone is OK in !O && !A && B case.' '
'2 - matching B alone is OK in !O && !A && B case.' \ rm -f .git/index NA &&
"rm -f .git/index NA && cp .orig-B/NA NA &&
cp .orig-B/NA NA && git update-index --add NA &&
git update-index --add NA && echo extra >>NA &&
echo extra >>NA && read_tree_must_succeed -m $tree_O $tree_A $tree_B
read_tree_must_succeed -m $tree_O $tree_A $tree_B" '
test_expect_success \ test_expect_success '3 - must match A in !O && A && !B case.' '
'3 - must match A in !O && A && !B case.' \ rm -f .git/index AN &&
"rm -f .git/index AN && cp .orig-A/AN AN &&
cp .orig-A/AN AN && git update-index --add AN &&
git update-index --add AN && read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
read_tree_must_succeed -m $tree_O $tree_A $tree_B && check_result
check_result" '
test_expect_success \ test_expect_success '3 - matching A alone is OK in !O && A && !B case.' '
'3 - matching A alone is OK in !O && A && !B case.' \ rm -f .git/index AN &&
"rm -f .git/index AN && cp .orig-A/AN AN &&
cp .orig-A/AN AN && git update-index --add AN &&
git update-index --add AN && echo extra >>AN &&
echo extra >>AN && read_tree_must_succeed -m $tree_O $tree_A $tree_B
read_tree_must_succeed -m $tree_O $tree_A $tree_B" '
test_expect_success \ test_expect_success '3 (fail) - must match A in !O && A && !B case.' '
'3 (fail) - must match A in !O && A && !B case.' " rm -f .git/index AN &&
rm -f .git/index AN && cp .orig-A/AN AN &&
cp .orig-A/AN AN && echo extra >>AN &&
echo extra >>AN && git update-index --add AN &&
git update-index --add AN && read_tree_must_fail -m $tree_O $tree_A $tree_B
read_tree_must_fail -m $tree_O $tree_A $tree_B '
"
test_expect_success \ test_expect_success '4 - must match and be up-to-date in !O && A && B && A!=B case.' '
'4 - must match and be up-to-date in !O && A && B && A!=B case.' \ rm -f .git/index AA &&
"rm -f .git/index AA && cp .orig-A/AA AA &&
cp .orig-A/AA AA && git update-index --add AA &&
git update-index --add AA && read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
read_tree_must_succeed -m $tree_O $tree_A $tree_B && check_result
check_result" '
test_expect_success \ test_expect_success '4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' '
'4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' " rm -f .git/index AA &&
rm -f .git/index AA && cp .orig-A/AA AA &&
cp .orig-A/AA AA && git update-index --add AA &&
git update-index --add AA && echo extra >>AA &&
echo extra >>AA && read_tree_must_fail -m $tree_O $tree_A $tree_B
read_tree_must_fail -m $tree_O $tree_A $tree_B '
"
test_expect_success \ test_expect_success '4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' '
'4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' " rm -f .git/index AA &&
rm -f .git/index AA && cp .orig-A/AA AA &&
cp .orig-A/AA AA && echo extra >>AA &&
echo extra >>AA && git update-index --add AA &&
git update-index --add AA && read_tree_must_fail -m $tree_O $tree_A $tree_B
read_tree_must_fail -m $tree_O $tree_A $tree_B '
"
test_expect_success \ test_expect_success '5 - must match in !O && A && B && A==B case.' '
'5 - must match in !O && A && B && A==B case.' \ rm -f .git/index LL &&
"rm -f .git/index LL && cp .orig-A/LL LL &&
cp .orig-A/LL LL && git update-index --add LL &&
git update-index --add LL && read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
read_tree_must_succeed -m $tree_O $tree_A $tree_B && check_result
check_result" '
test_expect_success \ test_expect_success '5 - must match in !O && A && B && A==B case.' '
'5 - must match in !O && A && B && A==B case.' \ rm -f .git/index LL &&
"rm -f .git/index LL && cp .orig-A/LL LL &&
cp .orig-A/LL LL && git update-index --add LL &&
git update-index --add LL && echo extra >>LL &&
echo extra >>LL && read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
read_tree_must_succeed -m $tree_O $tree_A $tree_B && check_result
check_result" '
test_expect_success \ test_expect_success '5 (fail) - must match A in !O && A && B && A==B case.' '
'5 (fail) - must match A in !O && A && B && A==B case.' " rm -f .git/index LL &&
rm -f .git/index LL && cp .orig-A/LL LL &&
cp .orig-A/LL LL && echo extra >>LL &&
echo extra >>LL && git update-index --add LL &&
git update-index --add LL && read_tree_must_fail -m $tree_O $tree_A $tree_B
read_tree_must_fail -m $tree_O $tree_A $tree_B '
"
test_expect_success \ test_expect_success '6 - must not exist in O && !A && !B case' '
'6 - must not exist in O && !A && !B case' " rm -f .git/index DD &&
rm -f .git/index DD && echo DD >DD &&
echo DD >DD && git update-index --add DD &&
git update-index --add DD && read_tree_must_fail -m $tree_O $tree_A $tree_B
read_tree_must_fail -m $tree_O $tree_A $tree_B '
"
test_expect_success \ test_expect_success '7 - must not exist in O && !A && B && O!=B case' '
'7 - must not exist in O && !A && B && O!=B case' " rm -f .git/index DM &&
rm -f .git/index DM && cp .orig-B/DM DM &&
cp .orig-B/DM DM && git update-index --add DM &&
git update-index --add DM && read_tree_must_fail -m $tree_O $tree_A $tree_B
read_tree_must_fail -m $tree_O $tree_A $tree_B '
"
test_expect_success \ test_expect_success '8 - must not exist in O && !A && B && O==B case' '
'8 - must not exist in O && !A && B && O==B case' " rm -f .git/index DN &&
rm -f .git/index DN && cp .orig-B/DN DN &&
cp .orig-B/DN DN && git update-index --add DN &&
git update-index --add DN && read_tree_must_fail -m $tree_O $tree_A $tree_B
read_tree_must_fail -m $tree_O $tree_A $tree_B '
"
test_expect_success \ test_expect_success '9 - must match and be up-to-date in O && A && !B && O!=A case' '
'9 - must match and be up-to-date in O && A && !B && O!=A case' \ rm -f .git/index MD &&
"rm -f .git/index MD && cp .orig-A/MD MD &&
cp .orig-A/MD MD && git update-index --add MD &&
git update-index --add MD && read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
read_tree_must_succeed -m $tree_O $tree_A $tree_B && check_result
check_result" '
test_expect_success \ test_expect_success '9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' '
'9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' " rm -f .git/index MD &&
rm -f .git/index MD && cp .orig-A/MD MD &&
cp .orig-A/MD MD && git update-index --add MD &&
git update-index --add MD && echo extra >>MD &&
echo extra >>MD && read_tree_must_fail -m $tree_O $tree_A $tree_B
read_tree_must_fail -m $tree_O $tree_A $tree_B '
"
test_expect_success \ test_expect_success '9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' '
'9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' " rm -f .git/index MD &&
rm -f .git/index MD && cp .orig-A/MD MD &&
cp .orig-A/MD MD && echo extra >>MD &&
echo extra >>MD && git update-index --add MD &&
git update-index --add MD && read_tree_must_fail -m $tree_O $tree_A $tree_B
read_tree_must_fail -m $tree_O $tree_A $tree_B '
"
test_expect_success \ test_expect_success '10 - must match and be up-to-date in O && A && !B && O==A case' '
'10 - must match and be up-to-date in O && A && !B && O==A case' \ rm -f .git/index ND &&
"rm -f .git/index ND && cp .orig-A/ND ND &&
cp .orig-A/ND ND && git update-index --add ND &&
git update-index --add ND && read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
read_tree_must_succeed -m $tree_O $tree_A $tree_B && check_result
check_result" '
test_expect_success \ test_expect_success '10 (fail) - must match and be up-to-date in O && A && !B && O==A case' '
'10 (fail) - must match and be up-to-date in O && A && !B && O==A case' " rm -f .git/index ND &&
rm -f .git/index ND && cp .orig-A/ND ND &&
cp .orig-A/ND ND && git update-index --add ND &&
git update-index --add ND && echo extra >>ND &&
echo extra >>ND && read_tree_must_fail -m $tree_O $tree_A $tree_B
read_tree_must_fail -m $tree_O $tree_A $tree_B '
"
test_expect_success \ test_expect_success '10 (fail) - must match and be up-to-date in O && A && !B && O==A case' '
'10 (fail) - must match and be up-to-date in O && A && !B && O==A case' " rm -f .git/index ND &&
rm -f .git/index ND && cp .orig-A/ND ND &&
cp .orig-A/ND ND && echo extra >>ND &&
echo extra >>ND && git update-index --add ND &&
git update-index --add ND && read_tree_must_fail -m $tree_O $tree_A $tree_B
read_tree_must_fail -m $tree_O $tree_A $tree_B '
"
test_expect_success \ test_expect_success '11 - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' '
'11 - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' \ rm -f .git/index MM &&
"rm -f .git/index MM && cp .orig-A/MM MM &&
cp .orig-A/MM MM && git update-index --add MM &&
git update-index --add MM && read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
read_tree_must_succeed -m $tree_O $tree_A $tree_B && check_result
check_result" '
test_expect_success \ test_expect_success '11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' '
'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 &&
rm -f .git/index MM && cp .orig-A/MM MM &&
cp .orig-A/MM MM && git update-index --add MM &&
git update-index --add MM && echo extra >>MM &&
echo extra >>MM && read_tree_must_fail -m $tree_O $tree_A $tree_B
read_tree_must_fail -m $tree_O $tree_A $tree_B '
"
test_expect_success \ test_expect_success '11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' '
'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 &&
rm -f .git/index MM && cp .orig-A/MM MM &&
cp .orig-A/MM MM && echo extra >>MM &&
echo extra >>MM && git update-index --add MM &&
git update-index --add MM && read_tree_must_fail -m $tree_O $tree_A $tree_B
read_tree_must_fail -m $tree_O $tree_A $tree_B '
"
test_expect_success \ test_expect_success '12 - must match A in O && A && B && O!=A && A==B case' '
'12 - must match A in O && A && B && O!=A && A==B case' \ rm -f .git/index SS &&
"rm -f .git/index SS && cp .orig-A/SS SS &&
cp .orig-A/SS SS && git update-index --add SS &&
git update-index --add SS && read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
read_tree_must_succeed -m $tree_O $tree_A $tree_B && check_result
check_result" '
test_expect_success \ test_expect_success '12 - must match A in O && A && B && O!=A && A==B case' '
'12 - must match A in O && A && B && O!=A && A==B case' \ rm -f .git/index SS &&
"rm -f .git/index SS && cp .orig-A/SS SS &&
cp .orig-A/SS SS && git update-index --add SS &&
git update-index --add SS && echo extra >>SS &&
echo extra >>SS && read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
read_tree_must_succeed -m $tree_O $tree_A $tree_B && check_result
check_result" '
test_expect_success \ test_expect_success '12 (fail) - must match A in O && A && B && O!=A && A==B case' '
'12 (fail) - must match A in O && A && B && O!=A && A==B case' " rm -f .git/index SS &&
rm -f .git/index SS && cp .orig-A/SS SS &&
cp .orig-A/SS SS && echo extra >>SS &&
echo extra >>SS && git update-index --add SS &&
git update-index --add SS && read_tree_must_fail -m $tree_O $tree_A $tree_B
read_tree_must_fail -m $tree_O $tree_A $tree_B '
"
test_expect_success \ test_expect_success '13 - must match A in O && A && B && O!=A && O==B case' '
'13 - must match A in O && A && B && O!=A && O==B case' \ rm -f .git/index MN &&
"rm -f .git/index MN && cp .orig-A/MN MN &&
cp .orig-A/MN MN && git update-index --add MN &&
git update-index --add MN && read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
read_tree_must_succeed -m $tree_O $tree_A $tree_B && check_result
check_result" '
test_expect_success \ test_expect_success '13 - must match A in O && A && B && O!=A && O==B case' '
'13 - must match A in O && A && B && O!=A && O==B case' \ rm -f .git/index MN &&
"rm -f .git/index MN && cp .orig-A/MN MN &&
cp .orig-A/MN MN && git update-index --add MN &&
git update-index --add MN && echo extra >>MN &&
echo extra >>MN && read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
read_tree_must_succeed -m $tree_O $tree_A $tree_B && check_result
check_result" '
test_expect_success \ test_expect_success '14 - must match and be up-to-date in O && A && B && O==A && O!=B case' '
'14 - must match and be up-to-date in O && A && B && O==A && O!=B case' \ rm -f .git/index NM &&
"rm -f .git/index NM && cp .orig-A/NM NM &&
cp .orig-A/NM NM && git update-index --add NM &&
git update-index --add NM && read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
read_tree_must_succeed -m $tree_O $tree_A $tree_B && check_result
check_result" '
test_expect_success \ test_expect_success '14 - may match B in O && A && B && O==A && O!=B case' '
'14 - may match B in O && A && B && O==A && O!=B case' \ rm -f .git/index NM &&
"rm -f .git/index NM && cp .orig-B/NM NM &&
cp .orig-B/NM NM && git update-index --add NM &&
git update-index --add NM && echo extra >>NM &&
echo extra >>NM && read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
read_tree_must_succeed -m $tree_O $tree_A $tree_B && check_result
check_result" '
test_expect_success \ test_expect_success '14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' '
'14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' " rm -f .git/index NM &&
rm -f .git/index NM && cp .orig-A/NM NM &&
cp .orig-A/NM NM && git update-index --add NM &&
git update-index --add NM && echo extra >>NM &&
echo extra >>NM && read_tree_must_fail -m $tree_O $tree_A $tree_B
read_tree_must_fail -m $tree_O $tree_A $tree_B '
"
test_expect_success \ test_expect_success '14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' '
'14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' " rm -f .git/index NM &&
rm -f .git/index NM && cp .orig-A/NM NM &&
cp .orig-A/NM NM && echo extra >>NM &&
echo extra >>NM && git update-index --add NM &&
git update-index --add NM && read_tree_must_fail -m $tree_O $tree_A $tree_B
read_tree_must_fail -m $tree_O $tree_A $tree_B '
"
test_expect_success \ test_expect_success '15 - must match A in O && A && B && O==A && O==B case' '
'15 - must match A in O && A && B && O==A && O==B case' \ rm -f .git/index NN &&
"rm -f .git/index NN && cp .orig-A/NN NN &&
cp .orig-A/NN NN && git update-index --add NN &&
git update-index --add NN && read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
read_tree_must_succeed -m $tree_O $tree_A $tree_B && check_result
check_result" '
test_expect_success \ test_expect_success '15 - must match A in O && A && B && O==A && O==B case' '
'15 - must match A in O && A && B && O==A && O==B case' \ rm -f .git/index NN &&
"rm -f .git/index NN && cp .orig-A/NN NN &&
cp .orig-A/NN NN && git update-index --add NN &&
git update-index --add NN && echo extra >>NN &&
echo extra >>NN && read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
read_tree_must_succeed -m $tree_O $tree_A $tree_B && check_result
check_result" '
test_expect_success \ test_expect_success '15 (fail) - must match A in O && A && B && O==A && O==B case' '
'15 (fail) - must match A in O && A && B && O==A && O==B case' " rm -f .git/index NN &&
rm -f .git/index NN && cp .orig-A/NN NN &&
cp .orig-A/NN NN && echo extra >>NN &&
echo extra >>NN && git update-index --add NN &&
git update-index --add NN && read_tree_must_fail -m $tree_O $tree_A $tree_B
read_tree_must_fail -m $tree_O $tree_A $tree_B '
"
# #16 test_expect_success '16 - A matches in one and B matches in another.' '
test_expect_success \ rm -f .git/index F16 &&
'16 - A matches in one and B matches in another.' \ echo F16 >F16 &&
'rm -f .git/index F16 && git update-index --add F16 &&
echo F16 >F16 && tree0=$(git write-tree) &&
git update-index --add F16 && echo E16 >F16 &&
tree0=$(git write-tree) && git update-index F16 &&
echo E16 >F16 && tree1=$(git write-tree) &&
git update-index F16 && read_tree_must_succeed -m $tree0 $tree1 $tree1 $tree0 &&
tree1=$(git write-tree) && git ls-files --stage
read_tree_must_succeed -m $tree0 $tree1 $tree1 $tree0 && '
git ls-files --stage'
test_done test_done