Skip to content

Commit eabc2e3

Browse files
committed
Merge branch 'rs/test-cleanup' into next
Test cleanup. * rs/test-cleanup: t7811: don't create unused file t9300: don't create unused file test: use test_must_be_empty F instead of test_cmp empty F test: use test_must_be_empty F instead of test -z $(cat F) t1400: use test_must_be_empty t1410: use test_line_count t1512: use test_line_count
2 parents 4916f80 + 271c351 commit eabc2e3

10 files changed

+16
-23
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,15 +215,14 @@ test_expect_success 'read-tree adds to worktree, dirty case' '
215215
'
216216

217217
test_expect_success 'index removal and worktree narrowing at the same time' '
218-
>empty &&
219218
echo init.t >.git/info/sparse-checkout &&
220219
echo sub/added >>.git/info/sparse-checkout &&
221220
git checkout -f top &&
222221
echo init.t >.git/info/sparse-checkout &&
223222
git checkout removed &&
224223
git ls-files sub/added >result &&
225224
test ! -f sub/added &&
226-
test_cmp empty result
225+
test_must_be_empty result
227226
'
228227

229228
test_expect_success 'read-tree --reset removes outside worktree' '

t/t1309-early-config.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ test_expect_success 'ceiling' '
2929
cd sub &&
3030
test-tool config read_early_config early.config
3131
) >output &&
32-
test -z "$(cat output)"
32+
test_must_be_empty output
3333
'
3434

3535
test_expect_success 'ceiling #2' '

t/t1400-update-ref.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,13 +380,13 @@ test_expect_success 'Query "master@{May 26 2005 23:32:00}" (exactly history star
380380
test_when_finished "rm -f o e" &&
381381
git rev-parse --verify "master@{May 26 2005 23:32:00}" >o 2>e &&
382382
test $C = $(cat o) &&
383-
test "" = "$(cat e)"
383+
test_must_be_empty e
384384
'
385385
test_expect_success 'Query "master@{May 26 2005 23:32:30}" (first non-creation change)' '
386386
test_when_finished "rm -f o e" &&
387387
git rev-parse --verify "master@{May 26 2005 23:32:30}" >o 2>e &&
388388
test $A = $(cat o) &&
389-
test "" = "$(cat e)"
389+
test_must_be_empty e
390390
'
391391
test_expect_success 'Query "master@{2005-05-26 23:33:01}" (middle of history with gap)' '
392392
test_when_finished "rm -f o e" &&
@@ -398,13 +398,13 @@ test_expect_success 'Query "master@{2005-05-26 23:38:00}" (middle of history)' '
398398
test_when_finished "rm -f o e" &&
399399
git rev-parse --verify "master@{2005-05-26 23:38:00}" >o 2>e &&
400400
test $Z = $(cat o) &&
401-
test "" = "$(cat e)"
401+
test_must_be_empty e
402402
'
403403
test_expect_success 'Query "master@{2005-05-26 23:43:00}" (exact end of history)' '
404404
test_when_finished "rm -f o e" &&
405405
git rev-parse --verify "master@{2005-05-26 23:43:00}" >o 2>e &&
406406
test $E = $(cat o) &&
407-
test "" = "$(cat e)"
407+
test_must_be_empty e
408408
'
409409
test_expect_success 'Query "master@{2005-05-28}" (past end of history)' '
410410
test_when_finished "rm -f o e" &&

t/t1410-reflog.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ test_expect_success 'delete' '
195195
196196
git reflog delete master@{1} &&
197197
git reflog show master > output &&
198-
test $(($master_entry_count - 1)) = $(wc -l < output) &&
198+
test_line_count = $(($master_entry_count - 1)) output &&
199199
test $HEAD_entry_count = $(git reflog | wc -l) &&
200200
! grep ox < output &&
201201
@@ -209,7 +209,7 @@ test_expect_success 'delete' '
209209
210210
git reflog delete master@{07.04.2005.15:15:00.-0700} &&
211211
git reflog show master > output &&
212-
test $(($master_entry_count - 1)) = $(wc -l < output) &&
212+
test_line_count = $(($master_entry_count - 1)) output &&
213213
! grep dragon < output
214214
215215
'

t/t1506-rev-parse-diagnosis.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ test_expect_success 'incorrect file in :path and :N:path' '
138138

139139
test_expect_success 'invalid @{n} reference' '
140140
test_must_fail git rev-parse master@{99999} >output 2>error &&
141-
test -z "$(cat output)" &&
141+
test_must_be_empty output &&
142142
grep "fatal: Log for [^ ]* only has [0-9][0-9]* entries." error &&
143143
test_must_fail git rev-parse --verify master@{99999} >output 2>error &&
144-
test -z "$(cat output)" &&
144+
test_must_be_empty output &&
145145
grep "fatal: Log for [^ ]* only has [0-9][0-9]* entries." error
146146
'
147147

@@ -155,13 +155,13 @@ test_expect_success 'relative path not found' '
155155

156156
test_expect_success 'relative path outside worktree' '
157157
test_must_fail git rev-parse HEAD:../file.txt >output 2>error &&
158-
test -z "$(cat output)" &&
158+
test_must_be_empty output &&
159159
test_i18ngrep "outside repository" error
160160
'
161161

162162
test_expect_success 'relative path when cwd is outside worktree' '
163163
test_must_fail git --git-dir=.git --work-tree=subdir rev-parse HEAD:./file.txt >output 2>error &&
164-
test -z "$(cat output)" &&
164+
test_must_be_empty output &&
165165
grep "relative path syntax can.t be used outside working tree." error
166166
'
167167

t/t1512-rev-parse-disambiguation.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ test_expect_success 'rev-parse --disambiguate' '
282282
# commits created by commit-tree in earlier tests share a
283283
# different prefix.
284284
git rev-parse --disambiguate=000000000 >actual &&
285-
test $(wc -l <actual) = 16 &&
285+
test_line_count = 16 actual &&
286286
test "$(sed -e "s/^\(.........\).*/\1/" actual | sort -u)" = 000000000
287287
'
288288

t/t6019-rev-list-ancestry-path.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,14 @@ test_expect_success 'setup criss-cross' '
143143
test_expect_success 'criss-cross: rev-list --ancestry-path cb..bc' '
144144
(cd criss-cross &&
145145
git rev-list --ancestry-path xcb..xbc > actual &&
146-
test -z "$(cat actual)")
146+
test_must_be_empty actual)
147147
'
148148

149149
# no commits in repository descend from cb
150150
test_expect_success 'criss-cross: rev-list --ancestry-path --all ^cb' '
151151
(cd criss-cross &&
152152
git rev-list --ancestry-path --all ^xcb > actual &&
153-
test -z "$(cat actual)")
153+
test_must_be_empty actual)
154154
'
155155

156156
test_done

t/t7811-grep-open.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ test_expect_success 'modified file' '
113113
subdir/grep.c
114114
unrelated
115115
EOF
116-
>empty &&
117116
118117
echo "enum grep_pat_token" >unrelated &&
119118
test_when_finished "git checkout HEAD unrelated" &&

t/t9010-svn-fe.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ text_no_props () {
5353
printf "%s\n" "$text"
5454
}
5555

56-
>empty
57-
5856
test_expect_success 'empty dump' '
5957
reinit_git &&
6058
echo "SVN-fs-dump-format-version: 2" >input &&
@@ -208,7 +206,7 @@ test_expect_failure 'timestamp and empty file' '
208206
test_cmp expect.date actual.date &&
209207
test_cmp expect.files actual.files &&
210208
git checkout HEAD empty-file &&
211-
test_cmp empty file
209+
test_must_be_empty file
212210
'
213211

214212
test_expect_success 'directory with files' '

t/t9300-fast-import.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2477,9 +2477,6 @@ test_expect_success PIPE 'R: copy using cat-file' '
24772477
echo $expect_id blob $expect_len >expect.response &&
24782478
24792479
rm -f blobs &&
2480-
cat >frontend <<-\FRONTEND_END &&
2481-
#!/bin/sh
2482-
FRONTEND_END
24832480
24842481
mkfifo blobs &&
24852482
(

0 commit comments

Comments
 (0)