tests: fix diff order arguments in test_cmp

Fix the argument order for test_cmp. When given the expected
result first the diff shows the actual output with '+' and the
expectation with '-', which is the convention for our tests.

Signed-off-by: Stefan Beller <sbeller@google.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Stefan Beller 2017-10-06 12:00:06 -07:00 committed by Junio C Hamano
parent 217f2767cb
commit 9c5b2fab30
15 changed files with 42 additions and 42 deletions

View file

@ -218,7 +218,7 @@ test_expect_success 'D/F' '
echo "100644 $a 2 subdir/file2"
echo "100644 $b 3 subdir/file2/another"
) >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 &&
git diff --ignore-blank-lines >out &&
>expect &&
test_cmp out expect
test_cmp expect out
'
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 &&
git diff -w --ignore-blank-lines >out &&
>expect &&
test_cmp out expect
test_cmp expect out
'
test_expect_success 'ignore-blank-lines: after change' '

View file

@ -590,7 +590,7 @@ test_expect_success '%(trailers:unfold) unfolds trailers' '
test_expect_success ':only and :unfold work together' '
git log --no-walk --pretty="%(trailers:only:unfold)" >actual &&
git log --no-walk --pretty="%(trailers:unfold:only)" >reverse &&
test_cmp actual reverse &&
test_cmp reverse actual &&
{
grep -v patch.description <trailers | unfold &&
echo

View file

@ -57,7 +57,7 @@ test_expect_success '--left-right' '
git rev-list --left-right B...C > actual &&
git name-rev --stdin --name-only --refs="*tags/*" \
< actual > actual.named &&
test_cmp actual.named expect
test_cmp expect actual.named
'
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 name-rev --stdin --name-only --refs="*tags/*" \
< actual > actual.named &&
test_cmp actual.named expect
test_cmp expect actual.named
'
test_expect_success 'bar does not come up empty' '
git rev-list --left-right B...C -- bar > actual &&
git name-rev --stdin --name-only --refs="*tags/*" \
< actual > actual.named &&
test_cmp actual.named expect
test_cmp expect actual.named
'
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 name-rev --stdin --name-only --refs="*tags/*" \
< actual > actual.named &&
test_cmp actual.named expect
test_cmp expect actual.named
'
test_expect_success 'name-rev multiple --refs combine inclusive' '
git rev-list --left-right --cherry-pick F...E -- bar >actual &&
git name-rev --stdin --name-only --refs="*tags/F" --refs="*tags/E" \
<actual >actual.named &&
test_cmp actual.named expect
test_cmp expect actual.named
'
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 name-rev --stdin --name-only --refs="*tags/F" \
<actual >actual.named &&
test_cmp actual.named expect
test_cmp expect actual.named
'
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 name-rev --stdin --name-only --refs="*tags/*" --exclude="*E" \
<actual >actual.named &&
test_cmp actual.named expect
test_cmp expect actual.named
'
test_expect_success 'name-rev --no-refs clears the refs list' '
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" \
<expect >actual &&
test_cmp actual expect
test_cmp expect actual
'
cat >expect <<EOF
@ -148,7 +148,7 @@ test_expect_success '--cherry-mark' '
git rev-list --cherry-mark F...E -- bar > actual &&
git name-rev --stdin --name-only --refs="*tags/*" \
< actual > actual.named &&
test_cmp actual.named expect
test_cmp expect actual.named
'
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 name-rev --stdin --name-only --refs="*tags/*" \
< actual > actual.named &&
test_cmp actual.named expect
test_cmp expect actual.named
'
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 name-rev --stdin --name-only --refs="*tags/*" \
< actual > actual.named &&
test_cmp actual.named expect
test_cmp expect actual.named
'
test_expect_success '--cherry-pick --left-only' '
git rev-list --cherry-pick --left-only E...F -- bar > actual &&
git name-rev --stdin --name-only --refs="*tags/*" \
< actual > actual.named &&
test_cmp actual.named expect
test_cmp expect actual.named
'
cat >expect <<EOF
@ -192,7 +192,7 @@ test_expect_success '--cherry' '
git rev-list --cherry F...E -- bar > actual &&
git name-rev --stdin --name-only --refs="*tags/*" \
< actual > actual.named &&
test_cmp actual.named expect
test_cmp expect actual.named
'
cat >expect <<EOF
@ -201,7 +201,7 @@ EOF
test_expect_success '--cherry --count' '
git rev-list --cherry --count F...E -- bar > actual &&
test_cmp actual expect
test_cmp expect actual
'
cat >expect <<EOF
@ -210,7 +210,7 @@ EOF
test_expect_success '--cherry-mark --count' '
git rev-list --cherry-mark --count F...E -- bar > actual &&
test_cmp actual expect
test_cmp expect actual
'
cat >expect <<EOF
@ -219,7 +219,7 @@ EOF
test_expect_success '--cherry-mark --left-right --count' '
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' '

View file

@ -28,7 +28,7 @@ test_expect_success '--reverse --parents --full-history combines correctly' '
perl -e "print reverse <>" > expected &&
git rev-list --reverse --parents --full-history master -- foo \
> actual &&
test_cmp actual expected
test_cmp expected actual
'
test_expect_success '--boundary does too' '
@ -36,7 +36,7 @@ test_expect_success '--boundary does too' '
perl -e "print reverse <>" > expected &&
git rev-list --boundary --reverse --parents --full-history \
master ^root -- foo > actual &&
test_cmp actual expected
test_cmp expected actual
'
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 &&
echo "directory/hierarchy/sub" >../expect
) &&
test_cmp actual expect
test_cmp expect actual
'
test_expect_failure 'moving nested submodules' '

View file

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

View file

@ -428,9 +428,9 @@ test_expect_success 'test --mixed <paths>' '
git reset HEAD -- file1 file2 file3 &&
test_must_fail git diff --quiet &&
git diff > output &&
test_cmp output expect &&
test_cmp expect 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' '

View file

@ -187,7 +187,7 @@ test_expect_success 'format of merge conflict from checkout -m' '
d
>>>>>>> local
EOF
test_cmp two expect
test_cmp expect two
'
test_expect_success 'checkout --merge --conflict=diff3 <branch>' '
@ -213,7 +213,7 @@ test_expect_success 'checkout --merge --conflict=diff3 <branch>' '
d
>>>>>>> local
EOF
test_cmp two expect
test_cmp expect two
'
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 -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' '

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 &&
(cd sub &&
git rev-parse sub-d > ../expect) &&
test_cmp actual expect)
test_cmp expect actual)
'
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 &&
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' '
@ -314,7 +314,7 @@ test_expect_success 'diff --submodule with merge conflict in .gitmodules' '
cd super &&
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:

View file

@ -697,7 +697,7 @@ test_expect_success 'merge --no-ff --edit' '
git cat-file commit HEAD >raw &&
grep "work done on the side branch" raw &&
sed "1,/^$/d" >actual raw &&
test_cmp actual expected
test_cmp expected actual
'
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 rev-parse signed^0 >expect &&
git rev-parse HEAD >actual &&
test_cmp actual expect
test_cmp expect actual
'
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 &&
git rev-parse signed^0 >expect &&
git rev-parse HEAD^2 >actual &&
test_cmp actual expect
test_cmp expect actual
'
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 &&
git mergetool --no-prompt --tool mybase -- both &&
>expected &&
test_cmp both expected
test_cmp expected both
'
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 &&
git mergetool --no-prompt --tool defaults -- both &&
echo master both added >expected &&
test_cmp both expected
test_cmp expected both
'
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 "Which 8bit encoding" stdout &&
egrep "Content|MIME" msgtxt1 >actual &&
test_cmp actual content-type-decl
test_cmp content-type-decl actual
'
test_expect_success $PREREQ 'sendemail.8bitEncoding works' '
@ -1277,7 +1277,7 @@ test_expect_success $PREREQ 'sendemail.8bitEncoding works' '
--smtp-server="$(pwd)/fake.sendmail" \
email-using-8bit >stdout &&
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' '
@ -1289,7 +1289,7 @@ test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' '
--8bit-encoding=UTF-8 \
email-using-8bit >stdout &&
egrep "Content|MIME" msgtxt1 >actual &&
test_cmp actual content-type-decl
test_cmp content-type-decl actual
'
test_expect_success $PREREQ 'setup expect' '