Skip to content

Commit 9c5b2fa

Browse files
stefanbellergitster
authored andcommitted
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 <[email protected]> Reviewed-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 217f276 commit 9c5b2fa

15 files changed

+42
-42
lines changed

t/t1004-read-tree-m-u-wf.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ test_expect_success 'D/F' '
218218
echo "100644 $a 2 subdir/file2"
219219
echo "100644 $b 3 subdir/file2/another"
220220
) >expect &&
221-
test_cmp actual expect
221+
test_cmp expect actual
222222
223223
'
224224

t/t4015-diff-whitespace.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ test_expect_success 'ignore-blank-lines: only new lines' '
155155
" >x &&
156156
git diff --ignore-blank-lines >out &&
157157
>expect &&
158-
test_cmp out expect
158+
test_cmp expect out
159159
'
160160

161161
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' '
165165
" >x &&
166166
git diff -w --ignore-blank-lines >out &&
167167
>expect &&
168-
test_cmp out expect
168+
test_cmp expect out
169169
'
170170

171171
test_expect_success 'ignore-blank-lines: after change' '

t/t4205-log-pretty-formats.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ test_expect_success '%(trailers:unfold) unfolds trailers' '
590590
test_expect_success ':only and :unfold work together' '
591591
git log --no-walk --pretty="%(trailers:only:unfold)" >actual &&
592592
git log --no-walk --pretty="%(trailers:unfold:only)" >reverse &&
593-
test_cmp actual reverse &&
593+
test_cmp reverse actual &&
594594
{
595595
grep -v patch.description <trailers | unfold &&
596596
echo

t/t6007-rev-list-cherry-pick-file.sh

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ test_expect_success '--left-right' '
5757
git rev-list --left-right B...C > actual &&
5858
git name-rev --stdin --name-only --refs="*tags/*" \
5959
< actual > actual.named &&
60-
test_cmp actual.named expect
60+
test_cmp expect actual.named
6161
'
6262

6363
test_expect_success '--count' '
@@ -77,14 +77,14 @@ test_expect_success '--cherry-pick bar does not come up empty' '
7777
git rev-list --left-right --cherry-pick B...C -- bar > actual &&
7878
git name-rev --stdin --name-only --refs="*tags/*" \
7979
< actual > actual.named &&
80-
test_cmp actual.named expect
80+
test_cmp expect actual.named
8181
'
8282

8383
test_expect_success 'bar does not come up empty' '
8484
git rev-list --left-right B...C -- bar > actual &&
8585
git name-rev --stdin --name-only --refs="*tags/*" \
8686
< actual > actual.named &&
87-
test_cmp actual.named expect
87+
test_cmp expect actual.named
8888
'
8989

9090
cat >expect <<EOF
@@ -96,14 +96,14 @@ test_expect_success '--cherry-pick bar does not come up empty (II)' '
9696
git rev-list --left-right --cherry-pick F...E -- bar > actual &&
9797
git name-rev --stdin --name-only --refs="*tags/*" \
9898
< actual > actual.named &&
99-
test_cmp actual.named expect
99+
test_cmp expect actual.named
100100
'
101101

102102
test_expect_success 'name-rev multiple --refs combine inclusive' '
103103
git rev-list --left-right --cherry-pick F...E -- bar >actual &&
104104
git name-rev --stdin --name-only --refs="*tags/F" --refs="*tags/E" \
105105
<actual >actual.named &&
106-
test_cmp actual.named expect
106+
test_cmp expect actual.named
107107
'
108108

109109
cat >expect <<EOF
@@ -115,7 +115,7 @@ test_expect_success 'name-rev --refs excludes non-matched patterns' '
115115
git rev-list --left-right --cherry-pick F...E -- bar >actual &&
116116
git name-rev --stdin --name-only --refs="*tags/F" \
117117
<actual >actual.named &&
118-
test_cmp actual.named expect
118+
test_cmp expect actual.named
119119
'
120120

121121
cat >expect <<EOF
@@ -127,14 +127,14 @@ test_expect_success 'name-rev --exclude excludes matched patterns' '
127127
git rev-list --left-right --cherry-pick F...E -- bar >actual &&
128128
git name-rev --stdin --name-only --refs="*tags/*" --exclude="*E" \
129129
<actual >actual.named &&
130-
test_cmp actual.named expect
130+
test_cmp expect actual.named
131131
'
132132

133133
test_expect_success 'name-rev --no-refs clears the refs list' '
134134
git rev-list --left-right --cherry-pick F...E -- bar >expect &&
135135
git name-rev --stdin --name-only --refs="*tags/F" --refs="*tags/E" --no-refs --refs="*tags/G" \
136136
<expect >actual &&
137-
test_cmp actual expect
137+
test_cmp expect actual
138138
'
139139

140140
cat >expect <<EOF
@@ -148,7 +148,7 @@ test_expect_success '--cherry-mark' '
148148
git rev-list --cherry-mark F...E -- bar > actual &&
149149
git name-rev --stdin --name-only --refs="*tags/*" \
150150
< actual > actual.named &&
151-
test_cmp actual.named expect
151+
test_cmp expect actual.named
152152
'
153153

154154
cat >expect <<EOF
@@ -162,7 +162,7 @@ test_expect_success '--cherry-mark --left-right' '
162162
git rev-list --cherry-mark --left-right F...E -- bar > actual &&
163163
git name-rev --stdin --name-only --refs="*tags/*" \
164164
< actual > actual.named &&
165-
test_cmp actual.named expect
165+
test_cmp expect actual.named
166166
'
167167

168168
cat >expect <<EOF
@@ -173,14 +173,14 @@ test_expect_success '--cherry-pick --right-only' '
173173
git rev-list --cherry-pick --right-only F...E -- bar > actual &&
174174
git name-rev --stdin --name-only --refs="*tags/*" \
175175
< actual > actual.named &&
176-
test_cmp actual.named expect
176+
test_cmp expect actual.named
177177
'
178178

179179
test_expect_success '--cherry-pick --left-only' '
180180
git rev-list --cherry-pick --left-only E...F -- bar > actual &&
181181
git name-rev --stdin --name-only --refs="*tags/*" \
182182
< actual > actual.named &&
183-
test_cmp actual.named expect
183+
test_cmp expect actual.named
184184
'
185185

186186
cat >expect <<EOF
@@ -192,7 +192,7 @@ test_expect_success '--cherry' '
192192
git rev-list --cherry F...E -- bar > actual &&
193193
git name-rev --stdin --name-only --refs="*tags/*" \
194194
< actual > actual.named &&
195-
test_cmp actual.named expect
195+
test_cmp expect actual.named
196196
'
197197

198198
cat >expect <<EOF
@@ -201,7 +201,7 @@ EOF
201201

202202
test_expect_success '--cherry --count' '
203203
git rev-list --cherry --count F...E -- bar > actual &&
204-
test_cmp actual expect
204+
test_cmp expect actual
205205
'
206206

207207
cat >expect <<EOF
@@ -210,7 +210,7 @@ EOF
210210

211211
test_expect_success '--cherry-mark --count' '
212212
git rev-list --cherry-mark --count F...E -- bar > actual &&
213-
test_cmp actual expect
213+
test_cmp expect actual
214214
'
215215

216216
cat >expect <<EOF
@@ -219,7 +219,7 @@ EOF
219219

220220
test_expect_success '--cherry-mark --left-right --count' '
221221
git rev-list --cherry-mark --left-right --count F...E -- bar > actual &&
222-
test_cmp actual expect
222+
test_cmp expect actual
223223
'
224224

225225
test_expect_success '--cherry-pick with independent, but identical branches' '

t/t6013-rev-list-reverse-parents.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ test_expect_success '--reverse --parents --full-history combines correctly' '
2828
perl -e "print reverse <>" > expected &&
2929
git rev-list --reverse --parents --full-history master -- foo \
3030
> actual &&
31-
test_cmp actual expected
31+
test_cmp expected actual
3232
'
3333

3434
test_expect_success '--boundary does too' '
3535
git rev-list --boundary --parents --full-history master ^root -- foo |
3636
perl -e "print reverse <>" > expected &&
3737
git rev-list --boundary --reverse --parents --full-history \
3838
master ^root -- foo > actual &&
39-
test_cmp actual expected
39+
test_cmp expected actual
4040
'
4141

4242
test_done

t/t7001-mv.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ test_expect_success 'moving a submodule in nested directories' '
488488
git config -f ../.gitmodules submodule.deep/directory/hierarchy/sub.path >../actual &&
489489
echo "directory/hierarchy/sub" >../expect
490490
) &&
491-
test_cmp actual expect
491+
test_cmp expect actual
492492
'
493493

494494
test_expect_failure 'moving nested submodules' '

t/t7005-editor.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ test_expect_success setup '
3838
test_commit "$msg" &&
3939
echo "$msg" >expect &&
4040
git show -s --format=%s > actual &&
41-
test_cmp actual expect
41+
test_cmp expect actual
4242
4343
'
4444

@@ -85,7 +85,7 @@ do
8585
git --exec-path=. commit --amend &&
8686
git show -s --pretty=oneline |
8787
sed -e "s/^[0-9a-f]* //" >actual &&
88-
test_cmp actual expect
88+
test_cmp expect actual
8989
'
9090
done
9191

@@ -107,7 +107,7 @@ do
107107
git --exec-path=. commit --amend &&
108108
git show -s --pretty=oneline |
109109
sed -e "s/^[0-9a-f]* //" >actual &&
110-
test_cmp actual expect
110+
test_cmp expect actual
111111
'
112112
done
113113

t/t7102-reset.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,9 +428,9 @@ test_expect_success 'test --mixed <paths>' '
428428
git reset HEAD -- file1 file2 file3 &&
429429
test_must_fail git diff --quiet &&
430430
git diff > output &&
431-
test_cmp output expect &&
431+
test_cmp expect output &&
432432
git diff --cached > output &&
433-
test_cmp output cached_expect
433+
test_cmp cached_expect output
434434
'
435435

436436
test_expect_success 'test resetting the index at give paths' '

t/t7201-co.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ test_expect_success 'format of merge conflict from checkout -m' '
187187
d
188188
>>>>>>> local
189189
EOF
190-
test_cmp two expect
190+
test_cmp expect two
191191
'
192192

193193
test_expect_success 'checkout --merge --conflict=diff3 <branch>' '
@@ -213,7 +213,7 @@ test_expect_success 'checkout --merge --conflict=diff3 <branch>' '
213213
d
214214
>>>>>>> local
215215
EOF
216-
test_cmp two expect
216+
test_cmp expect two
217217
'
218218

219219
test_expect_success 'switch to another branch while carrying a deletion' '

t/t7400-submodule-basic.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ test_expect_success 'clone --recurse-submodules with a pathspec works' '
12111211
12121212
git clone --recurse-submodules="sub0" multisuper multisuper_clone &&
12131213
git -C multisuper_clone submodule status |cut -c1,43- >actual &&
1214-
test_cmp actual expected
1214+
test_cmp expected actual
12151215
'
12161216

12171217
test_expect_success 'clone with multiple --recurse-submodules options' '

0 commit comments

Comments
 (0)