t1400: use consistent style for test_expect_success calls

Structure calls as

    test_expect_success 'description' '
    	body
    '

Use double quotes for the description if it requires parameter
expansion or contains a single quote.

Signed-off-by: Kyle Meyer <kyle@kyleam.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Kyle Meyer 2017-04-15 22:31:02 -04:00 committed by Junio C Hamano
parent 2405ed07ca
commit 1cec9c2db2

View file

@ -35,14 +35,14 @@ test_expect_success setup '
cd - cd -
' '
test_expect_success \ test_expect_success "create $m" '
"create $m" \ git update-ref $m $A &&
"git update-ref $m $A && test $A = $(cat .git/$m)
test $A"' = $(cat .git/'"$m"')' '
test_expect_success \ test_expect_success "create $m with oldvalue verification" '
"create $m with oldvalue verification" \ git update-ref $m $B $A &&
"git update-ref $m $B $A && test $B = $(cat .git/$m)
test $B"' = $(cat .git/'"$m"')' '
test_expect_success "fail to delete $m with stale ref" ' test_expect_success "fail to delete $m with stale ref" '
test_must_fail git update-ref -d $m $A && test_must_fail git update-ref -d $m $A &&
test $B = "$(cat .git/$m)" test $B = "$(cat .git/$m)"
@ -67,14 +67,14 @@ test_expect_success "fail to create $n" '
test_must_fail git update-ref $n $A test_must_fail git update-ref $n $A
' '
test_expect_success \ test_expect_success "create $m (by HEAD)" '
"create $m (by HEAD)" \ git update-ref HEAD $A &&
"git update-ref HEAD $A && test $A = $(cat .git/$m)
test $A"' = $(cat .git/'"$m"')' '
test_expect_success \ test_expect_success "create $m (by HEAD) with oldvalue verification" '
"create $m (by HEAD) with oldvalue verification" \ git update-ref HEAD $B $A &&
"git update-ref HEAD $B $A && test $B = $(cat .git/$m)
test $B"' = $(cat .git/'"$m"')' '
test_expect_success "fail to delete $m (by HEAD) with stale ref" ' test_expect_success "fail to delete $m (by HEAD) with stale ref" '
test_must_fail git update-ref -d HEAD $A && test_must_fail git update-ref -d HEAD $A &&
test $B = $(cat .git/$m) test $B = $(cat .git/$m)
@ -176,17 +176,17 @@ test_expect_success '--no-create-reflog overrides core.logAllRefUpdates=always'
test_must_fail git reflog exists $outside test_must_fail git reflog exists $outside
' '
test_expect_success \ test_expect_success "create $m (by HEAD)" '
"create $m (by HEAD)" \ git update-ref HEAD $A &&
"git update-ref HEAD $A && test $A = $(cat .git/$m)
test $A"' = $(cat .git/'"$m"')' '
test_expect_success \ test_expect_success 'pack refs' '
"pack refs" \ git pack-refs --all
"git pack-refs --all" '
test_expect_success \ test_expect_success "move $m (by HEAD)" '
"move $m (by HEAD)" \ git update-ref HEAD $B $A &&
"git update-ref HEAD $B $A && test $B = $(cat .git/$m)
test $B"' = $(cat .git/'"$m"')' '
test_expect_success "delete $m (by HEAD) should remove both packed and loose $m" ' test_expect_success "delete $m (by HEAD) should remove both packed and loose $m" '
test_when_finished "rm -f .git/$m" && test_when_finished "rm -f .git/$m" &&
git update-ref -d HEAD $B && git update-ref -d HEAD $B &&
@ -195,13 +195,13 @@ test_expect_success "delete $m (by HEAD) should remove both packed and loose $m"
' '
cp -f .git/HEAD .git/HEAD.orig cp -f .git/HEAD .git/HEAD.orig
test_expect_success "delete symref without dereference" ' test_expect_success 'delete symref without dereference' '
test_when_finished "cp -f .git/HEAD.orig .git/HEAD" && test_when_finished "cp -f .git/HEAD.orig .git/HEAD" &&
git update-ref --no-deref -d HEAD && git update-ref --no-deref -d HEAD &&
test_path_is_missing .git/HEAD test_path_is_missing .git/HEAD
' '
test_expect_success "delete symref without dereference when the referred ref is packed" ' test_expect_success 'delete symref without dereference when the referred ref is packed' '
test_when_finished "cp -f .git/HEAD.orig .git/HEAD" && test_when_finished "cp -f .git/HEAD.orig .git/HEAD" &&
echo foo >foo.c && echo foo >foo.c &&
git add foo.c && git add foo.c &&
@ -239,46 +239,46 @@ test_expect_success 'update-ref --no-deref -d can delete reference to bad ref' '
test_path_is_missing .git/refs/heads/ref-to-bad test_path_is_missing .git/refs/heads/ref-to-bad
' '
test_expect_success '(not) create HEAD with old sha1' " test_expect_success '(not) create HEAD with old sha1' '
test_must_fail git update-ref HEAD $A $B test_must_fail git update-ref HEAD $A $B
" '
test_expect_success "(not) prior created .git/$m" ' test_expect_success "(not) prior created .git/$m" '
test_when_finished "rm -f .git/$m" && test_when_finished "rm -f .git/$m" &&
test_path_is_missing .git/$m test_path_is_missing .git/$m
' '
test_expect_success \ test_expect_success 'create HEAD' '
"create HEAD" \ git update-ref HEAD $A
"git update-ref HEAD $A" '
test_expect_success '(not) change HEAD with wrong SHA1' " test_expect_success '(not) change HEAD with wrong SHA1' '
test_must_fail git update-ref HEAD $B $Z test_must_fail git update-ref HEAD $B $Z
" '
test_expect_success "(not) changed .git/$m" ' test_expect_success "(not) changed .git/$m" '
test_when_finished "rm -f .git/$m" && test_when_finished "rm -f .git/$m" &&
! test $B = $(cat .git/$m) ! test $B = $(cat .git/$m)
' '
rm -f .git/logs/refs/heads/master rm -f .git/logs/refs/heads/master
test_expect_success \ test_expect_success "create $m (logged by touch)" '
"create $m (logged by touch)" \ test_config core.logAllRefUpdates false &&
'test_config core.logAllRefUpdates false && GIT_COMMITTER_DATE="2005-05-26 23:30" \
GIT_COMMITTER_DATE="2005-05-26 23:30" \ git update-ref --create-reflog HEAD $A -m "Initial Creation" &&
git update-ref --create-reflog HEAD '"$A"' -m "Initial Creation" && test $A = $(cat .git/$m)
test '"$A"' = $(cat .git/'"$m"')' '
test_expect_success \ test_expect_success "update $m (logged by touch)" '
"update $m (logged by touch)" \ test_config core.logAllRefUpdates false &&
'test_config core.logAllRefUpdates false && GIT_COMMITTER_DATE="2005-05-26 23:31" \
GIT_COMMITTER_DATE="2005-05-26 23:31" \ git update-ref HEAD $B $A -m "Switch" &&
git update-ref HEAD'" $B $A "'-m "Switch" && test $B = $(cat .git/$m)
test '"$B"' = $(cat .git/'"$m"')' '
test_expect_success \ test_expect_success "set $m (logged by touch)" '
"set $m (logged by touch)" \ test_config core.logAllRefUpdates false &&
'test_config core.logAllRefUpdates false && GIT_COMMITTER_DATE="2005-05-26 23:41" \
GIT_COMMITTER_DATE="2005-05-26 23:41" \ git update-ref HEAD $A &&
git update-ref HEAD'" $A && test $A = $(cat .git/$m)
test $A"' = $(cat .git/'"$m"')' '
test_expect_success "empty directory removal" ' test_expect_success 'empty directory removal' '
git branch d1/d2/r1 HEAD && git branch d1/d2/r1 HEAD &&
git branch d1/r2 HEAD && git branch d1/r2 HEAD &&
test_path_is_file .git/refs/heads/d1/d2/r1 && test_path_is_file .git/refs/heads/d1/d2/r1 &&
@ -290,7 +290,7 @@ test_expect_success "empty directory removal" '
test_path_is_file .git/logs/refs/heads/d1/r2 test_path_is_file .git/logs/refs/heads/d1/r2
' '
test_expect_success "symref empty directory removal" ' test_expect_success 'symref empty directory removal' '
git branch e1/e2/r1 HEAD && git branch e1/e2/r1 HEAD &&
git branch e1/r2 HEAD && git branch e1/r2 HEAD &&
git checkout e1/e2/r1 && git checkout e1/e2/r1 &&
@ -315,34 +315,34 @@ test_expect_success "verifying $m's log (logged by touch)" '
test_cmp expect .git/logs/$m test_cmp expect .git/logs/$m
' '
test_expect_success \ test_expect_success "create $m (logged by config)" '
"create $m (logged by config)" \ test_config core.logAllRefUpdates true &&
'test_config core.logAllRefUpdates true && GIT_COMMITTER_DATE="2005-05-26 23:32" \
GIT_COMMITTER_DATE="2005-05-26 23:32" \ git update-ref HEAD $A -m "Initial Creation" &&
git update-ref HEAD'" $A "'-m "Initial Creation" && test $A = $(cat .git/$m)
test '"$A"' = $(cat .git/'"$m"')' '
test_expect_success \ test_expect_success "update $m (logged by config)" '
"update $m (logged by config)" \ test_config core.logAllRefUpdates true &&
'test_config core.logAllRefUpdates true && GIT_COMMITTER_DATE="2005-05-26 23:33" \
GIT_COMMITTER_DATE="2005-05-26 23:33" \ git update-ref HEAD'" $B $A "'-m "Switch" &&
git update-ref HEAD'" $B $A "'-m "Switch" && test $B = $(cat .git/$m)
test '"$B"' = $(cat .git/'"$m"')' '
test_expect_success \ test_expect_success "set $m (logged by config)" '
"set $m (logged by config)" \ test_config core.logAllRefUpdates true &&
'test_config core.logAllRefUpdates true && GIT_COMMITTER_DATE="2005-05-26 23:43" \
GIT_COMMITTER_DATE="2005-05-26 23:43" \ git update-ref HEAD $A &&
git update-ref HEAD '"$A && test $A = $(cat .git/$m)
test $A"' = $(cat .git/'"$m"')' '
cat >expect <<EOF cat >expect <<EOF
$Z $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150320 +0000 Initial Creation $Z $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150320 +0000 Initial Creation
$A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150380 +0000 Switch $A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150380 +0000 Switch
$B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 +0000 $B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 +0000
EOF EOF
test_expect_success \ test_expect_success "verifying $m's log (logged by config)" '
"verifying $m's log (logged by config)" \ test_when_finished "rm -f .git/$m .git/logs/$m expect" &&
'test_when_finished "rm -f .git/$m .git/logs/$m expect" && test_cmp expect .git/logs/$m
test_cmp expect .git/logs/$m' '
git update-ref $m $D git update-ref $m $D
cat >.git/logs/$m <<EOF cat >.git/logs/$m <<EOF
@ -356,86 +356,85 @@ EOF
ed="Thu, 26 May 2005 18:32:00 -0500" ed="Thu, 26 May 2005 18:32:00 -0500"
gd="Thu, 26 May 2005 18:33:00 -0500" gd="Thu, 26 May 2005 18:33:00 -0500"
ld="Thu, 26 May 2005 18:43:00 -0500" ld="Thu, 26 May 2005 18:43:00 -0500"
test_expect_success \ test_expect_success 'Query "master@{May 25 2005}" (before history)' '
'Query "master@{May 25 2005}" (before history)' \ test_when_finished "rm -f o e" &&
'test_when_finished "rm -f o e" && git rev-parse --verify "master@{May 25 2005}" >o 2>e &&
git rev-parse --verify "master@{May 25 2005}" >o 2>e && test $C = $(cat o) &&
test '"$C"' = $(cat o) && test "warning: Log for '\''master'\'' only goes back to $ed." = "$(cat e)"
test "warning: Log for '\'master\'' only goes back to $ed." = "$(cat e)"' '
test_expect_success \ test_expect_success 'Query master@{2005-05-25} (before history)' '
"Query master@{2005-05-25} (before history)" \ test_when_finished "rm -f o e" &&
'test_when_finished "rm -f o e" && git rev-parse --verify master@{2005-05-25} >o 2>e &&
git rev-parse --verify master@{2005-05-25} >o 2>e && test $C = $(cat o) &&
test '"$C"' = $(cat o) && echo test "warning: Log for '\''master'\'' only goes back to $ed." = "$(cat e)"
echo test "warning: Log for '\'master\'' only goes back to $ed." = "$(cat e)"' '
test_expect_success \ test_expect_success 'Query "master@{May 26 2005 23:31:59}" (1 second before history)' '
'Query "master@{May 26 2005 23:31:59}" (1 second before history)' \ test_when_finished "rm -f o e" &&
'test_when_finished "rm -f o e" && git rev-parse --verify "master@{May 26 2005 23:31:59}" >o 2>e &&
git rev-parse --verify "master@{May 26 2005 23:31:59}" >o 2>e && test $C = $(cat o) &&
test '"$C"' = $(cat o) && test "warning: Log for '\''master'\'' only goes back to $ed." = "$(cat e)"
test "warning: Log for '\''master'\'' only goes back to $ed." = "$(cat e)"' '
test_expect_success \ test_expect_success 'Query "master@{May 26 2005 23:32:00}" (exactly history start)' '
'Query "master@{May 26 2005 23:32:00}" (exactly history start)' \ test_when_finished "rm -f o e" &&
'test_when_finished "rm -f o e" && git rev-parse --verify "master@{May 26 2005 23:32:00}" >o 2>e &&
git rev-parse --verify "master@{May 26 2005 23:32:00}" >o 2>e && test $C = $(cat o) &&
test '"$C"' = $(cat o) && test "" = "$(cat e)"
test "" = "$(cat e)"' '
test_expect_success \ test_expect_success 'Query "master@{May 26 2005 23:32:30}" (first non-creation change)' '
'Query "master@{May 26 2005 23:32:30}" (first non-creation change)' \ test_when_finished "rm -f o e" &&
'test_when_finished "rm -f o e" && git rev-parse --verify "master@{May 26 2005 23:32:30}" >o 2>e &&
git rev-parse --verify "master@{May 26 2005 23:32:30}" >o 2>e && test $A = $(cat o) &&
test '"$A"' = $(cat o) && test "" = "$(cat e)"
test "" = "$(cat e)"' '
test_expect_success \ test_expect_success 'Query "master@{2005-05-26 23:33:01}" (middle of history with gap)' '
'Query "master@{2005-05-26 23:33:01}" (middle of history with gap)' \ test_when_finished "rm -f o e" &&
'test_when_finished "rm -f o e" && git rev-parse --verify "master@{2005-05-26 23:33:01}" >o 2>e &&
git rev-parse --verify "master@{2005-05-26 23:33:01}" >o 2>e && test $B = $(cat o) &&
test '"$B"' = $(cat o) && test "warning: Log for ref $m has gap after $gd." = "$(cat e)"
test "warning: Log for ref '"$m has gap after $gd"'." = "$(cat e)"' '
test_expect_success \ test_expect_success 'Query "master@{2005-05-26 23:38:00}" (middle of history)' '
'Query "master@{2005-05-26 23:38:00}" (middle of history)' \ test_when_finished "rm -f o e" &&
'test_when_finished "rm -f o e" && git rev-parse --verify "master@{2005-05-26 23:38:00}" >o 2>e &&
git rev-parse --verify "master@{2005-05-26 23:38:00}" >o 2>e && test $Z = $(cat o) &&
test '"$Z"' = $(cat o) && test "" = "$(cat e)"
test "" = "$(cat e)"' '
test_expect_success \ test_expect_success 'Query "master@{2005-05-26 23:43:00}" (exact end of history)' '
'Query "master@{2005-05-26 23:43:00}" (exact end of history)' \ test_when_finished "rm -f o e" &&
'test_when_finished "rm -f o e" && git rev-parse --verify "master@{2005-05-26 23:43:00}" >o 2>e &&
git rev-parse --verify "master@{2005-05-26 23:43:00}" >o 2>e && test $E = $(cat o) &&
test '"$E"' = $(cat o) && test "" = "$(cat e)"
test "" = "$(cat e)"' '
test_expect_success \ test_expect_success 'Query "master@{2005-05-28}" (past end of history)' '
'Query "master@{2005-05-28}" (past end of history)' \ test_when_finished "rm -f o e" &&
'test_when_finished "rm -f o e" && git rev-parse --verify "master@{2005-05-28}" >o 2>e &&
git rev-parse --verify "master@{2005-05-28}" >o 2>e && test $D = $(cat o) &&
test '"$D"' = $(cat o) && test "warning: Log for ref $m unexpectedly ended on $ld." = "$(cat e)"
test "warning: Log for ref '"$m unexpectedly ended on $ld"'." = "$(cat e)"' '
rm -f .git/$m .git/logs/$m expect rm -f .git/$m .git/logs/$m expect
test_expect_success \ test_expect_success 'creating initial files' '
'creating initial files' \ test_when_finished rm -f M &&
'test_when_finished rm -f M && echo TEST >F &&
echo TEST >F && git add F &&
git add F && GIT_AUTHOR_DATE="2005-05-26 23:30" \
GIT_AUTHOR_DATE="2005-05-26 23:30" \ GIT_COMMITTER_DATE="2005-05-26 23:30" git commit -m add -a &&
GIT_COMMITTER_DATE="2005-05-26 23:30" git commit -m add -a && h_TEST=$(git rev-parse --verify HEAD) &&
h_TEST=$(git rev-parse --verify HEAD) && echo The other day this did not work. >M &&
echo The other day this did not work. >M && echo And then Bob told me how to fix it. >>M &&
echo And then Bob told me how to fix it. >>M && echo OTHER >F &&
echo OTHER >F && GIT_AUTHOR_DATE="2005-05-26 23:41" \
GIT_AUTHOR_DATE="2005-05-26 23:41" \ GIT_COMMITTER_DATE="2005-05-26 23:41" git commit -F M -a &&
GIT_COMMITTER_DATE="2005-05-26 23:41" git commit -F M -a && h_OTHER=$(git rev-parse --verify HEAD) &&
h_OTHER=$(git rev-parse --verify HEAD) && GIT_AUTHOR_DATE="2005-05-26 23:44" \
GIT_AUTHOR_DATE="2005-05-26 23:44" \ GIT_COMMITTER_DATE="2005-05-26 23:44" git commit --amend &&
GIT_COMMITTER_DATE="2005-05-26 23:44" git commit --amend && h_FIXED=$(git rev-parse --verify HEAD) &&
h_FIXED=$(git rev-parse --verify HEAD) && echo Merged initial commit and a later commit. >M &&
echo Merged initial commit and a later commit. >M && echo $h_TEST >.git/MERGE_HEAD &&
echo $h_TEST >.git/MERGE_HEAD && GIT_AUTHOR_DATE="2005-05-26 23:45" \
GIT_AUTHOR_DATE="2005-05-26 23:45" \ GIT_COMMITTER_DATE="2005-05-26 23:45" git commit -F M &&
GIT_COMMITTER_DATE="2005-05-26 23:45" git commit -F M && h_MERGED=$(git rev-parse --verify HEAD)
h_MERGED=$(git rev-parse --verify HEAD)' '
cat >expect <<EOF cat >expect <<EOF
$Z $h_TEST $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 commit (initial): add $Z $h_TEST $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 commit (initial): add
@ -443,20 +442,20 @@ $h_TEST $h_OTHER $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150860 +0000 com
$h_OTHER $h_FIXED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151040 +0000 commit (amend): The other day this did not work. $h_OTHER $h_FIXED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151040 +0000 commit (amend): The other day this did not work.
$h_FIXED $h_MERGED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151100 +0000 commit (merge): Merged initial commit and a later commit. $h_FIXED $h_MERGED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151100 +0000 commit (merge): Merged initial commit and a later commit.
EOF EOF
test_expect_success \ test_expect_success 'git commit logged updates' '
'git commit logged updates' \ test_cmp expect .git/logs/$m
"test_cmp expect .git/logs/$m" '
unset h_TEST h_OTHER h_FIXED h_MERGED unset h_TEST h_OTHER h_FIXED h_MERGED
test_expect_success \ test_expect_success 'git cat-file blob master:F (expect OTHER)' '
'git cat-file blob master:F (expect OTHER)' \ test OTHER = $(git cat-file blob master:F)
'test OTHER = $(git cat-file blob master:F)' '
test_expect_success \ test_expect_success 'git cat-file blob master@{2005-05-26 23:30}:F (expect TEST)' '
'git cat-file blob master@{2005-05-26 23:30}:F (expect TEST)' \ test TEST = $(git cat-file blob "master@{2005-05-26 23:30}:F")
'test TEST = $(git cat-file blob "master@{2005-05-26 23:30}:F")' '
test_expect_success \ test_expect_success 'git cat-file blob master@{2005-05-26 23:42}:F (expect OTHER)' '
'git cat-file blob master@{2005-05-26 23:42}:F (expect OTHER)' \ test OTHER = $(git cat-file blob "master@{2005-05-26 23:42}:F")
'test OTHER = $(git cat-file blob "master@{2005-05-26 23:42}:F")' '
a=refs/heads/a a=refs/heads/a
b=refs/heads/b b=refs/heads/b