Merge branch 'sb/test-cmp-expect-actual'

Test tweak.

* sb/test-cmp-expect-actual:
  tests: fix diff order arguments in test_cmp
This commit is contained in:
Junio C Hamano 2017-10-11 14:52:23 +09:00
commit 97cb362262
14 changed files with 41 additions and 41 deletions

View File

@ -218,7 +218,7 @@ test_expect_success 'D/F' '
echo "100644 $a 2 subdir/file2" echo "100644 $a 2 subdir/file2"
echo "100644 $b 3 subdir/file2/another" echo "100644 $b 3 subdir/file2/another"
) >expect && ) >expect &&
test_cmp actual expect test_cmp expect actual
' '

View File

@ -155,7 +155,7 @@ test_expect_success 'ignore-blank-lines: only new lines' '
" >x && " >x &&
git diff --ignore-blank-lines >out && git diff --ignore-blank-lines >out &&
>expect && >expect &&
test_cmp out expect test_cmp expect out
' '
test_expect_success 'ignore-blank-lines: only new lines with space' ' test_expect_success 'ignore-blank-lines: only new lines with space' '
@ -165,7 +165,7 @@ test_expect_success 'ignore-blank-lines: only new lines with space' '
" >x && " >x &&
git diff -w --ignore-blank-lines >out && git diff -w --ignore-blank-lines >out &&
>expect && >expect &&
test_cmp out expect test_cmp expect out
' '
test_expect_success 'ignore-blank-lines: after change' ' test_expect_success 'ignore-blank-lines: after change' '

View File

@ -57,7 +57,7 @@ test_expect_success '--left-right' '
git rev-list --left-right B...C > actual && git rev-list --left-right B...C > actual &&
git name-rev --stdin --name-only --refs="*tags/*" \ git name-rev --stdin --name-only --refs="*tags/*" \
< actual > actual.named && < actual > actual.named &&
test_cmp actual.named expect test_cmp expect actual.named
' '
test_expect_success '--count' ' test_expect_success '--count' '
@ -77,14 +77,14 @@ test_expect_success '--cherry-pick bar does not come up empty' '
git rev-list --left-right --cherry-pick B...C -- bar > actual && git rev-list --left-right --cherry-pick B...C -- bar > actual &&
git name-rev --stdin --name-only --refs="*tags/*" \ git name-rev --stdin --name-only --refs="*tags/*" \
< actual > actual.named && < actual > actual.named &&
test_cmp actual.named expect test_cmp expect actual.named
' '
test_expect_success 'bar does not come up empty' ' test_expect_success 'bar does not come up empty' '
git rev-list --left-right B...C -- bar > actual && git rev-list --left-right B...C -- bar > actual &&
git name-rev --stdin --name-only --refs="*tags/*" \ git name-rev --stdin --name-only --refs="*tags/*" \
< actual > actual.named && < actual > actual.named &&
test_cmp actual.named expect test_cmp expect actual.named
' '
cat >expect <<EOF cat >expect <<EOF
@ -96,14 +96,14 @@ test_expect_success '--cherry-pick bar does not come up empty (II)' '
git rev-list --left-right --cherry-pick F...E -- bar > actual && git rev-list --left-right --cherry-pick F...E -- bar > actual &&
git name-rev --stdin --name-only --refs="*tags/*" \ git name-rev --stdin --name-only --refs="*tags/*" \
< actual > actual.named && < actual > actual.named &&
test_cmp actual.named expect test_cmp expect actual.named
' '
test_expect_success 'name-rev multiple --refs combine inclusive' ' test_expect_success 'name-rev multiple --refs combine inclusive' '
git rev-list --left-right --cherry-pick F...E -- bar >actual && git rev-list --left-right --cherry-pick F...E -- bar >actual &&
git name-rev --stdin --name-only --refs="*tags/F" --refs="*tags/E" \ git name-rev --stdin --name-only --refs="*tags/F" --refs="*tags/E" \
<actual >actual.named && <actual >actual.named &&
test_cmp actual.named expect test_cmp expect actual.named
' '
cat >expect <<EOF cat >expect <<EOF
@ -115,7 +115,7 @@ test_expect_success 'name-rev --refs excludes non-matched patterns' '
git rev-list --left-right --cherry-pick F...E -- bar >actual && git rev-list --left-right --cherry-pick F...E -- bar >actual &&
git name-rev --stdin --name-only --refs="*tags/F" \ git name-rev --stdin --name-only --refs="*tags/F" \
<actual >actual.named && <actual >actual.named &&
test_cmp actual.named expect test_cmp expect actual.named
' '
cat >expect <<EOF cat >expect <<EOF
@ -127,14 +127,14 @@ test_expect_success 'name-rev --exclude excludes matched patterns' '
git rev-list --left-right --cherry-pick F...E -- bar >actual && git rev-list --left-right --cherry-pick F...E -- bar >actual &&
git name-rev --stdin --name-only --refs="*tags/*" --exclude="*E" \ git name-rev --stdin --name-only --refs="*tags/*" --exclude="*E" \
<actual >actual.named && <actual >actual.named &&
test_cmp actual.named expect test_cmp expect actual.named
' '
test_expect_success 'name-rev --no-refs clears the refs list' ' test_expect_success 'name-rev --no-refs clears the refs list' '
git rev-list --left-right --cherry-pick F...E -- bar >expect && git rev-list --left-right --cherry-pick F...E -- bar >expect &&
git name-rev --stdin --name-only --refs="*tags/F" --refs="*tags/E" --no-refs --refs="*tags/G" \ git name-rev --stdin --name-only --refs="*tags/F" --refs="*tags/E" --no-refs --refs="*tags/G" \
<expect >actual && <expect >actual &&
test_cmp actual expect test_cmp expect actual
' '
cat >expect <<EOF cat >expect <<EOF
@ -148,7 +148,7 @@ test_expect_success '--cherry-mark' '
git rev-list --cherry-mark F...E -- bar > actual && git rev-list --cherry-mark F...E -- bar > actual &&
git name-rev --stdin --name-only --refs="*tags/*" \ git name-rev --stdin --name-only --refs="*tags/*" \
< actual > actual.named && < actual > actual.named &&
test_cmp actual.named expect test_cmp expect actual.named
' '
cat >expect <<EOF cat >expect <<EOF
@ -162,7 +162,7 @@ test_expect_success '--cherry-mark --left-right' '
git rev-list --cherry-mark --left-right F...E -- bar > actual && git rev-list --cherry-mark --left-right F...E -- bar > actual &&
git name-rev --stdin --name-only --refs="*tags/*" \ git name-rev --stdin --name-only --refs="*tags/*" \
< actual > actual.named && < actual > actual.named &&
test_cmp actual.named expect test_cmp expect actual.named
' '
cat >expect <<EOF cat >expect <<EOF
@ -173,14 +173,14 @@ test_expect_success '--cherry-pick --right-only' '
git rev-list --cherry-pick --right-only F...E -- bar > actual && git rev-list --cherry-pick --right-only F...E -- bar > actual &&
git name-rev --stdin --name-only --refs="*tags/*" \ git name-rev --stdin --name-only --refs="*tags/*" \
< actual > actual.named && < actual > actual.named &&
test_cmp actual.named expect test_cmp expect actual.named
' '
test_expect_success '--cherry-pick --left-only' ' test_expect_success '--cherry-pick --left-only' '
git rev-list --cherry-pick --left-only E...F -- bar > actual && git rev-list --cherry-pick --left-only E...F -- bar > actual &&
git name-rev --stdin --name-only --refs="*tags/*" \ git name-rev --stdin --name-only --refs="*tags/*" \
< actual > actual.named && < actual > actual.named &&
test_cmp actual.named expect test_cmp expect actual.named
' '
cat >expect <<EOF cat >expect <<EOF
@ -192,7 +192,7 @@ test_expect_success '--cherry' '
git rev-list --cherry F...E -- bar > actual && git rev-list --cherry F...E -- bar > actual &&
git name-rev --stdin --name-only --refs="*tags/*" \ git name-rev --stdin --name-only --refs="*tags/*" \
< actual > actual.named && < actual > actual.named &&
test_cmp actual.named expect test_cmp expect actual.named
' '
cat >expect <<EOF cat >expect <<EOF
@ -201,7 +201,7 @@ EOF
test_expect_success '--cherry --count' ' test_expect_success '--cherry --count' '
git rev-list --cherry --count F...E -- bar > actual && git rev-list --cherry --count F...E -- bar > actual &&
test_cmp actual expect test_cmp expect actual
' '
cat >expect <<EOF cat >expect <<EOF
@ -210,7 +210,7 @@ EOF
test_expect_success '--cherry-mark --count' ' test_expect_success '--cherry-mark --count' '
git rev-list --cherry-mark --count F...E -- bar > actual && git rev-list --cherry-mark --count F...E -- bar > actual &&
test_cmp actual expect test_cmp expect actual
' '
cat >expect <<EOF cat >expect <<EOF
@ -219,7 +219,7 @@ EOF
test_expect_success '--cherry-mark --left-right --count' ' test_expect_success '--cherry-mark --left-right --count' '
git rev-list --cherry-mark --left-right --count F...E -- bar > actual && git rev-list --cherry-mark --left-right --count F...E -- bar > actual &&
test_cmp actual expect test_cmp expect actual
' '
test_expect_success '--cherry-pick with independent, but identical branches' ' test_expect_success '--cherry-pick with independent, but identical branches' '

View File

@ -28,7 +28,7 @@ test_expect_success '--reverse --parents --full-history combines correctly' '
perl -e "print reverse <>" > expected && perl -e "print reverse <>" > expected &&
git rev-list --reverse --parents --full-history master -- foo \ git rev-list --reverse --parents --full-history master -- foo \
> actual && > actual &&
test_cmp actual expected test_cmp expected actual
' '
test_expect_success '--boundary does too' ' test_expect_success '--boundary does too' '
@ -36,7 +36,7 @@ test_expect_success '--boundary does too' '
perl -e "print reverse <>" > expected && perl -e "print reverse <>" > expected &&
git rev-list --boundary --reverse --parents --full-history \ git rev-list --boundary --reverse --parents --full-history \
master ^root -- foo > actual && master ^root -- foo > actual &&
test_cmp actual expected test_cmp expected actual
' '
test_done test_done

View File

@ -488,7 +488,7 @@ test_expect_success 'moving a submodule in nested directories' '
git config -f ../.gitmodules submodule.deep/directory/hierarchy/sub.path >../actual && git config -f ../.gitmodules submodule.deep/directory/hierarchy/sub.path >../actual &&
echo "directory/hierarchy/sub" >../expect echo "directory/hierarchy/sub" >../expect
) && ) &&
test_cmp actual expect test_cmp expect actual
' '
test_expect_failure 'moving nested submodules' ' test_expect_failure 'moving nested submodules' '

View File

@ -38,7 +38,7 @@ test_expect_success setup '
test_commit "$msg" && test_commit "$msg" &&
echo "$msg" >expect && echo "$msg" >expect &&
git show -s --format=%s > actual && git show -s --format=%s > actual &&
test_cmp actual expect test_cmp expect actual
' '
@ -85,7 +85,7 @@ do
git --exec-path=. commit --amend && git --exec-path=. commit --amend &&
git show -s --pretty=oneline | git show -s --pretty=oneline |
sed -e "s/^[0-9a-f]* //" >actual && sed -e "s/^[0-9a-f]* //" >actual &&
test_cmp actual expect test_cmp expect actual
' '
done done
@ -107,7 +107,7 @@ do
git --exec-path=. commit --amend && git --exec-path=. commit --amend &&
git show -s --pretty=oneline | git show -s --pretty=oneline |
sed -e "s/^[0-9a-f]* //" >actual && sed -e "s/^[0-9a-f]* //" >actual &&
test_cmp actual expect test_cmp expect actual
' '
done done

View File

@ -428,9 +428,9 @@ test_expect_success 'test --mixed <paths>' '
git reset HEAD -- file1 file2 file3 && git reset HEAD -- file1 file2 file3 &&
test_must_fail git diff --quiet && test_must_fail git diff --quiet &&
git diff > output && git diff > output &&
test_cmp output expect && test_cmp expect output &&
git diff --cached > output && git diff --cached > output &&
test_cmp output cached_expect test_cmp cached_expect output
' '
test_expect_success 'test resetting the index at give paths' ' test_expect_success 'test resetting the index at give paths' '

View File

@ -187,7 +187,7 @@ test_expect_success 'format of merge conflict from checkout -m' '
d d
>>>>>>> local >>>>>>> local
EOF EOF
test_cmp two expect test_cmp expect two
' '
test_expect_success 'checkout --merge --conflict=diff3 <branch>' ' test_expect_success 'checkout --merge --conflict=diff3 <branch>' '
@ -213,7 +213,7 @@ test_expect_success 'checkout --merge --conflict=diff3 <branch>' '
d d
>>>>>>> local >>>>>>> local
EOF EOF
test_cmp two expect test_cmp expect two
' '
test_expect_success 'switch to another branch while carrying a deletion' ' test_expect_success 'switch to another branch while carrying a deletion' '

View File

@ -1211,7 +1211,7 @@ test_expect_success 'clone --recurse-submodules with a pathspec works' '
git clone --recurse-submodules="sub0" multisuper multisuper_clone && git clone --recurse-submodules="sub0" multisuper multisuper_clone &&
git -C multisuper_clone submodule status |cut -c1,43- >actual && git -C multisuper_clone submodule status |cut -c1,43- >actual &&
test_cmp actual expected test_cmp expected actual
' '
test_expect_success 'clone with multiple --recurse-submodules options' ' test_expect_success 'clone with multiple --recurse-submodules options' '

View File

@ -119,7 +119,7 @@ test_expect_success 'merge with one side as a fast-forward of the other' '
git ls-tree test-forward sub | cut -f1 | cut -f3 -d" " > actual && git ls-tree test-forward sub | cut -f1 | cut -f3 -d" " > actual &&
(cd sub && (cd sub &&
git rev-parse sub-d > ../expect) && git rev-parse sub-d > ../expect) &&
test_cmp actual expect) test_cmp expect actual)
' '
test_expect_success 'merging should conflict for non fast-forward' ' test_expect_success 'merging should conflict for non fast-forward' '

View File

@ -306,7 +306,7 @@ test_expect_success 'diff with merge conflict in .gitmodules' '
cd super && cd super &&
git diff >../diff_actual 2>&1 git diff >../diff_actual 2>&1
) && ) &&
test_cmp diff_actual diff_expect test_cmp diff_expect diff_actual
' '
test_expect_success 'diff --submodule with merge conflict in .gitmodules' ' test_expect_success 'diff --submodule with merge conflict in .gitmodules' '
@ -314,7 +314,7 @@ test_expect_success 'diff --submodule with merge conflict in .gitmodules' '
cd super && cd super &&
git diff --submodule >../diff_submodule_actual 2>&1 git diff --submodule >../diff_submodule_actual 2>&1
) && ) &&
test_cmp diff_submodule_actual diff_submodule_expect test_cmp diff_submodule_expect diff_submodule_actual
' '
# We'll setup different cases for further testing: # We'll setup different cases for further testing:

View File

@ -697,7 +697,7 @@ test_expect_success 'merge --no-ff --edit' '
git cat-file commit HEAD >raw && git cat-file commit HEAD >raw &&
grep "work done on the side branch" raw && grep "work done on the side branch" raw &&
sed "1,/^$/d" >actual raw && sed "1,/^$/d" >actual raw &&
test_cmp actual expected test_cmp expected actual
' '
test_expect_success GPG 'merge --ff-only tag' ' test_expect_success GPG 'merge --ff-only tag' '
@ -709,7 +709,7 @@ test_expect_success GPG 'merge --ff-only tag' '
git merge --ff-only signed && git merge --ff-only signed &&
git rev-parse signed^0 >expect && git rev-parse signed^0 >expect &&
git rev-parse HEAD >actual && git rev-parse HEAD >actual &&
test_cmp actual expect test_cmp expect actual
' '
test_expect_success GPG 'merge --no-edit tag should skip editor' ' test_expect_success GPG 'merge --no-edit tag should skip editor' '
@ -721,7 +721,7 @@ test_expect_success GPG 'merge --no-edit tag should skip editor' '
EDITOR=false git merge --no-edit signed && EDITOR=false git merge --no-edit signed &&
git rev-parse signed^0 >expect && git rev-parse signed^0 >expect &&
git rev-parse HEAD^2 >actual && git rev-parse HEAD^2 >actual &&
test_cmp actual expect test_cmp expect actual
' '
test_expect_success 'set up mod-256 conflict scenario' ' test_expect_success 'set up mod-256 conflict scenario' '

View File

@ -621,7 +621,7 @@ test_expect_success 'file with no base' '
test_must_fail git merge master && test_must_fail git merge master &&
git mergetool --no-prompt --tool mybase -- both && git mergetool --no-prompt --tool mybase -- both &&
>expected && >expected &&
test_cmp both expected test_cmp expected both
' '
test_expect_success 'custom commands override built-ins' ' test_expect_success 'custom commands override built-ins' '
@ -632,7 +632,7 @@ test_expect_success 'custom commands override built-ins' '
test_must_fail git merge master && test_must_fail git merge master &&
git mergetool --no-prompt --tool defaults -- both && git mergetool --no-prompt --tool defaults -- both &&
echo master both added >expected && echo master both added >expected &&
test_cmp both expected test_cmp expected both
' '
test_expect_success 'filenames seen by tools start with ./' ' test_expect_success 'filenames seen by tools start with ./' '

View File

@ -1266,7 +1266,7 @@ test_expect_success $PREREQ 'asks about and fixes 8bit encodings' '
grep email-using-8bit stdout && grep email-using-8bit stdout &&
grep "Which 8bit encoding" stdout && grep "Which 8bit encoding" stdout &&
egrep "Content|MIME" msgtxt1 >actual && egrep "Content|MIME" msgtxt1 >actual &&
test_cmp actual content-type-decl test_cmp content-type-decl actual
' '
test_expect_success $PREREQ 'sendemail.8bitEncoding works' ' test_expect_success $PREREQ 'sendemail.8bitEncoding works' '
@ -1277,7 +1277,7 @@ test_expect_success $PREREQ 'sendemail.8bitEncoding works' '
--smtp-server="$(pwd)/fake.sendmail" \ --smtp-server="$(pwd)/fake.sendmail" \
email-using-8bit >stdout && email-using-8bit >stdout &&
egrep "Content|MIME" msgtxt1 >actual && egrep "Content|MIME" msgtxt1 >actual &&
test_cmp actual content-type-decl test_cmp content-type-decl actual
' '
test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' ' test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' '
@ -1289,7 +1289,7 @@ test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' '
--8bit-encoding=UTF-8 \ --8bit-encoding=UTF-8 \
email-using-8bit >stdout && email-using-8bit >stdout &&
egrep "Content|MIME" msgtxt1 >actual && egrep "Content|MIME" msgtxt1 >actual &&
test_cmp actual content-type-decl test_cmp content-type-decl actual
' '
test_expect_success $PREREQ 'setup expect' ' test_expect_success $PREREQ 'setup expect' '