Skip to content

Commit 14677d2

Browse files
committed
Merge branch 'ab/test-must-be-empty-for-master'
Test updates. * ab/test-must-be-empty-for-master: tests: make use of the test_must_be_empty function
2 parents 34f2297 + d3c6751 commit 14677d2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+111
-205
lines changed

t/t0008-ignores.sh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -807,10 +807,9 @@ test_expect_success 'trailing whitespace is ignored' '
807807
cat >expect <<EOF &&
808808
whitespace/untracked
809809
EOF
810-
: >err.expect &&
811810
git ls-files -o -X ignore whitespace >actual 2>err &&
812811
test_cmp expect actual &&
813-
test_cmp err.expect err
812+
test_must_be_empty err
814813
'
815814

816815
test_expect_success !MINGW 'quoting allows trailing whitespace' '
@@ -820,10 +819,9 @@ test_expect_success !MINGW 'quoting allows trailing whitespace' '
820819
>whitespace/untracked &&
821820
echo "whitespace/trailing\\ \\ " >ignore &&
822821
echo whitespace/untracked >expect &&
823-
: >err.expect &&
824822
git ls-files -o -X ignore whitespace >actual 2>err &&
825823
test_cmp expect actual &&
826-
test_cmp err.expect err
824+
test_must_be_empty err
827825
'
828826

829827
test_expect_success !MINGW,!CYGWIN 'correct handling of backslashes' '
@@ -845,10 +843,9 @@ test_expect_success !MINGW,!CYGWIN 'correct handling of backslashes' '
845843
whitespace/trailing 6 \\a\\Z
846844
EOF
847845
echo whitespace/untracked >expect &&
848-
>err.expect &&
849846
git ls-files -o -X ignore whitespace >actual 2>err &&
850847
test_cmp expect actual &&
851-
test_cmp err.expect err
848+
test_must_be_empty err
852849
'
853850

854851
test_expect_success 'info/exclude trumps core.excludesfile' '

t/t0030-stripspace.sh

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,31 +110,30 @@ test_expect_success \
110110

111111
test_expect_success \
112112
'only consecutive blank lines should be completely removed' '
113-
> expect &&
114113
115114
printf "\n" | git stripspace >actual &&
116-
test_cmp expect actual &&
115+
test_must_be_empty actual &&
117116
118117
printf "\n\n\n" | git stripspace >actual &&
119-
test_cmp expect actual &&
118+
test_must_be_empty actual &&
120119
121120
printf "$sss\n$sss\n$sss\n" | git stripspace >actual &&
122-
test_cmp expect actual &&
121+
test_must_be_empty actual &&
123122
124123
printf "$sss$sss\n$sss\n\n" | git stripspace >actual &&
125-
test_cmp expect actual &&
124+
test_must_be_empty actual &&
126125
127126
printf "\n$sss\n$sss$sss\n" | git stripspace >actual &&
128-
test_cmp expect actual &&
127+
test_must_be_empty actual &&
129128
130129
printf "$sss$sss$sss$sss\n\n\n" | git stripspace >actual &&
131-
test_cmp expect actual &&
130+
test_must_be_empty actual &&
132131
133132
printf "\n$sss$sss$sss$sss\n\n" | git stripspace >actual &&
134-
test_cmp expect actual &&
133+
test_must_be_empty actual &&
135134
136135
printf "\n\n$sss$sss$sss$sss\n" | git stripspace >actual &&
137-
test_cmp expect actual
136+
test_must_be_empty actual
138137
'
139138

140139
test_expect_success \

t/t0300-credentials.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,7 @@ test_expect_success 'helpers can abort the process' '
294294
-c credential.helper="!f() { echo quit=1; }; f" \
295295
-c credential.helper="verbatim foo bar" \
296296
credential fill >stdout &&
297-
>expect &&
298-
test_cmp expect stdout
297+
test_must_be_empty stdout
299298
'
300299

301300
test_expect_success 'empty helper spec resets helper list' '

t/t1011-read-tree-sparse-checkout.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,12 +227,11 @@ test_expect_success 'index removal and worktree narrowing at the same time' '
227227
'
228228

229229
test_expect_success 'read-tree --reset removes outside worktree' '
230-
>empty &&
231230
echo init.t >.git/info/sparse-checkout &&
232231
git checkout -f top &&
233232
git reset --hard removed &&
234233
git ls-files sub/added >result &&
235-
test_cmp empty result
234+
test_must_be_empty result
236235
'
237236

238237
test_expect_success 'print errors when failed to update worktree' '

t/t1306-xdg-files.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,10 @@ test_expect_success 'Exclusion in a non-XDG global ignore file' '
114114
'
115115

116116
test_expect_success 'Checking XDG ignore file when HOME is unset' '
117-
>expected &&
118117
(sane_unset HOME &&
119118
git config --unset core.excludesfile &&
120119
git ls-files --exclude-standard --ignored >actual) &&
121-
test_cmp expected actual
120+
test_must_be_empty actual
122121
'
123122

124123
test_expect_success 'Checking attributes in the XDG attributes file' '
@@ -132,10 +131,9 @@ test_expect_success 'Checking attributes in the XDG attributes file' '
132131
'
133132

134133
test_expect_success 'Checking XDG attributes when HOME is unset' '
135-
>expected &&
136134
(sane_unset HOME &&
137135
git check-attr -a f >actual) &&
138-
test_cmp expected actual
136+
test_must_be_empty actual
139137
'
140138

141139
test_expect_success '$XDG_CONFIG_HOME overrides $HOME/.config/git/attributes' '

t/t1403-show-ref.sh

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,22 @@ test_expect_success 'show-ref' '
2626
git show-ref refs/tags/A >actual &&
2727
test_cmp expect actual &&
2828
29-
>expect &&
30-
3129
test_must_fail git show-ref D >actual &&
32-
test_cmp expect actual
30+
test_must_be_empty actual
3331
'
3432

3533
test_expect_success 'show-ref -q' '
36-
>expect &&
37-
3834
git show-ref -q A >actual &&
39-
test_cmp expect actual &&
35+
test_must_be_empty actual &&
4036
4137
git show-ref -q tags/A >actual &&
42-
test_cmp expect actual &&
38+
test_must_be_empty actual &&
4339
4440
git show-ref -q refs/tags/A >actual &&
45-
test_cmp expect actual &&
41+
test_must_be_empty actual &&
4642
4743
test_must_fail git show-ref -q D >actual &&
48-
test_cmp expect actual
44+
test_must_be_empty actual
4945
'
5046

5147
test_expect_success 'show-ref --verify' '
@@ -54,32 +50,28 @@ test_expect_success 'show-ref --verify' '
5450
git show-ref --verify refs/tags/A >actual &&
5551
test_cmp expect actual &&
5652
57-
>expect &&
58-
5953
test_must_fail git show-ref --verify A >actual &&
60-
test_cmp expect actual &&
54+
test_must_be_empty actual &&
6155
6256
test_must_fail git show-ref --verify tags/A >actual &&
63-
test_cmp expect actual &&
57+
test_must_be_empty actual &&
6458
6559
test_must_fail git show-ref --verify D >actual &&
66-
test_cmp expect actual
60+
test_must_be_empty actual
6761
'
6862

6963
test_expect_success 'show-ref --verify -q' '
70-
>expect &&
71-
7264
git show-ref --verify -q refs/tags/A >actual &&
73-
test_cmp expect actual &&
65+
test_must_be_empty actual &&
7466
7567
test_must_fail git show-ref --verify -q A >actual &&
76-
test_cmp expect actual &&
68+
test_must_be_empty actual &&
7769
7870
test_must_fail git show-ref --verify -q tags/A >actual &&
79-
test_cmp expect actual &&
71+
test_must_be_empty actual &&
8072
8173
test_must_fail git show-ref --verify -q D >actual &&
82-
test_cmp expect actual
74+
test_must_be_empty actual
8375
'
8476

8577
test_expect_success 'show-ref -d' '
@@ -113,19 +105,17 @@ test_expect_success 'show-ref -d' '
113105
git show-ref -d --verify refs/heads/master >actual &&
114106
test_cmp expect actual &&
115107
116-
>expect &&
117-
118108
test_must_fail git show-ref -d --verify master >actual &&
119-
test_cmp expect actual &&
109+
test_must_be_empty actual &&
120110
121111
test_must_fail git show-ref -d --verify heads/master >actual &&
122-
test_cmp expect actual &&
112+
test_must_be_empty actual &&
123113
124114
test_must_fail git show-ref --verify -d A C >actual &&
125-
test_cmp expect actual &&
115+
test_must_be_empty actual &&
126116
127117
test_must_fail git show-ref --verify -d tags/A tags/C >actual &&
128-
test_cmp expect actual
118+
test_must_be_empty actual
129119
130120
'
131121

@@ -178,10 +168,8 @@ test_expect_success 'show-ref --verify HEAD' '
178168
git show-ref --verify HEAD >actual &&
179169
test_cmp expect actual &&
180170
181-
>expect &&
182-
183171
git show-ref --verify -q HEAD >actual &&
184-
test_cmp expect actual
172+
test_must_be_empty actual
185173
'
186174

187175
test_expect_success 'show-ref --verify with dangling ref' '

t/t1507-rev-parse-upstream.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ test_expect_success 'branch -d other@{u}' '
138138
git checkout -t -b other master &&
139139
git branch -d @{u} &&
140140
git for-each-ref refs/heads/master >actual &&
141-
>expect &&
142-
test_cmp expect actual
141+
test_must_be_empty actual
143142
'
144143

145144
test_expect_success 'checkout other@{u}' '

t/t2202-add-addremove.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ test_expect_success 'Just "git add" is a no-op' '
4848
>will-not-be-added &&
4949
git add &&
5050
git diff-index --name-status --cached HEAD >actual &&
51-
>expect &&
52-
test_cmp expect actual
51+
test_must_be_empty actual
5352
'
5453

5554
test_done

t/t3001-ls-files-others-exclude.sh

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -210,26 +210,23 @@ test_expect_success 'subdirectory ignore (toplevel)' '
210210
cd top &&
211211
git ls-files -o --exclude-standard
212212
) >actual &&
213-
>expect &&
214-
test_cmp expect actual
213+
test_must_be_empty actual
215214
'
216215

217216
test_expect_success 'subdirectory ignore (l1/l2)' '
218217
(
219218
cd top/l1/l2 &&
220219
git ls-files -o --exclude-standard
221220
) >actual &&
222-
>expect &&
223-
test_cmp expect actual
221+
test_must_be_empty actual
224222
'
225223

226224
test_expect_success 'subdirectory ignore (l1)' '
227225
(
228226
cd top/l1 &&
229227
git ls-files -o --exclude-standard
230228
) >actual &&
231-
>expect &&
232-
test_cmp expect actual
229+
test_must_be_empty actual
233230
'
234231

235232
test_expect_success 'show/hide empty ignored directory (setup)' '
@@ -251,8 +248,7 @@ test_expect_success 'hide empty ignored directory with --no-empty-directory' '
251248
cd top &&
252249
git ls-files -o -i --exclude l1 --directory --no-empty-directory
253250
) >actual &&
254-
>expect &&
255-
test_cmp expect actual
251+
test_must_be_empty actual
256252
'
257253

258254
test_expect_success 'show/hide empty ignored sub-directory (setup)' '
@@ -277,8 +273,7 @@ test_expect_success 'hide empty ignored sub-directory with --no-empty-directory'
277273
cd top &&
278274
git ls-files -o -i --exclude l1 --directory --no-empty-directory
279275
) >actual &&
280-
>expect &&
281-
test_cmp expect actual
276+
test_must_be_empty actual
282277
'
283278

284279
test_expect_success 'pattern matches prefix completely' '

t/t3070-wildmatch.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ match_with_ls_files() {
101101

102102
match_stdout_stderr_cmp="
103103
tr -d '\0' <actual.raw >actual &&
104-
>expect.err &&
105-
test_cmp expect.err actual.err &&
104+
test_must_be_empty actual.err &&
106105
test_cmp expect actual"
107106

108107
if test "$match_expect" = 'E'

t/t3201-branch-contains.sh

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,14 @@ test_expect_success 'branch --contains master' '
4848
test_expect_success 'branch --no-contains=master' '
4949
5050
git branch --no-contains=master >actual &&
51-
>expect &&
52-
test_cmp expect actual
51+
test_must_be_empty actual
5352
5453
'
5554

5655
test_expect_success 'branch --no-contains master' '
5756
5857
git branch --no-contains master >actual &&
59-
>expect &&
60-
test_cmp expect actual
58+
test_must_be_empty actual
6159
6260
'
6361

@@ -94,8 +92,7 @@ test_expect_success 'branch --contains with pattern implies --list' '
9492
test_expect_success 'branch --no-contains with pattern implies --list' '
9593
9694
git branch --no-contains=master master >actual &&
97-
>expect &&
98-
test_cmp expect actual
95+
test_must_be_empty actual
9996
10097
'
10198

@@ -123,8 +120,7 @@ test_expect_success 'branch --merged with pattern implies --list' '
123120
test_expect_success 'side: branch --no-merged' '
124121
125122
git branch --no-merged >actual &&
126-
>expect &&
127-
test_cmp expect actual
123+
test_must_be_empty actual
128124
129125
'
130126

@@ -152,8 +148,7 @@ test_expect_success 'master: branch --no-merged' '
152148
test_expect_success 'branch --no-merged with pattern implies --list' '
153149
154150
git branch --no-merged=master master >actual &&
155-
>expect &&
156-
test_cmp expect actual
151+
test_must_be_empty actual
157152
158153
'
159154

t/t3700-add.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,8 @@ test_expect_success 'git add --refresh with pathspec' '
188188
git add foo bar baz && H=$(git rev-parse :foo) && git rm -f foo &&
189189
echo "100644 $H 3 foo" | git update-index --index-info &&
190190
test-tool chmtime -60 bar baz &&
191-
>expect &&
192191
git add --refresh bar >actual &&
193-
test_cmp expect actual &&
192+
test_must_be_empty actual &&
194193
195194
git diff-files --name-only >actual &&
196195
! grep bar actual&&

t/t3910-mac-os-precompose.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,8 @@ test_expect_failure 'handle existing decomposed filenames' '
187187
echo content >"verbatim.$Adiarnfd" &&
188188
git -c core.precomposeunicode=false add "verbatim.$Adiarnfd" &&
189189
git commit -m "existing decomposed file" &&
190-
>expect &&
191190
git ls-files --exclude-standard -o "verbatim*" >untracked &&
192-
test_cmp expect untracked
191+
test_must_be_empty untracked
193192
'
194193

195194
# Test if the global core.precomposeunicode stops autosensing

t/t4010-diff-pathspec.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ test_expect_success 'diff-tree pathspec' '
7474
tree2=$(git write-tree) &&
7575
echo "$tree2" &&
7676
git diff-tree -r --name-only $tree $tree2 -- pa path1/a >current &&
77-
>expected &&
78-
test_cmp expected current
77+
test_must_be_empty current
7978
'
8079

8180
test_expect_success 'diff-tree with wildcard shows dir also matches' '

0 commit comments

Comments
 (0)