Skip to content

Commit f74f5e7

Browse files
committed
Merge branch 'js/t7006-cleanup'
Code clean-up. * js/t7006-cleanup: t7006: Use test_path_is_* functions in test script
2 parents f3e63ab + 4e1bee9 commit f74f5e7

File tree

1 file changed

+42
-42
lines changed

1 file changed

+42
-42
lines changed

t/t7006-pager.sh

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ test_expect_success 'setup' '
1919
test_expect_success TTY 'some commands use a pager' '
2020
rm -f paginated.out &&
2121
test_terminal git log &&
22-
test -e paginated.out
22+
test_path_is_file paginated.out
2323
'
2424

2525
test_expect_failure TTY 'pager runs from subdir' '
@@ -65,49 +65,49 @@ test_expect_success !MINGW,TTY 'LESS and LV envvars set by git-sh-setup' '
6565
test_expect_success TTY 'some commands do not use a pager' '
6666
rm -f paginated.out &&
6767
test_terminal git rev-list HEAD &&
68-
! test -e paginated.out
68+
test_path_is_missing paginated.out
6969
'
7070

7171
test_expect_success 'no pager when stdout is a pipe' '
7272
rm -f paginated.out &&
7373
git log | cat &&
74-
! test -e paginated.out
74+
test_path_is_missing paginated.out
7575
'
7676

7777
test_expect_success 'no pager when stdout is a regular file' '
7878
rm -f paginated.out &&
7979
git log >file &&
80-
! test -e paginated.out
80+
test_path_is_missing paginated.out
8181
'
8282

8383
test_expect_success TTY 'git --paginate rev-list uses a pager' '
8484
rm -f paginated.out &&
8585
test_terminal git --paginate rev-list HEAD &&
86-
test -e paginated.out
86+
test_path_is_file paginated.out
8787
'
8888

8989
test_expect_success 'no pager even with --paginate when stdout is a pipe' '
9090
rm -f file paginated.out &&
9191
git --paginate log | cat &&
92-
! test -e paginated.out
92+
test_path_is_missing paginated.out
9393
'
9494

9595
test_expect_success TTY 'no pager with --no-pager' '
9696
rm -f paginated.out &&
9797
test_terminal git --no-pager log &&
98-
! test -e paginated.out
98+
test_path_is_missing paginated.out
9999
'
100100

101101
test_expect_success TTY 'configuration can disable pager' '
102102
rm -f paginated.out &&
103103
test_unconfig pager.grep &&
104104
test_terminal git grep initial &&
105-
test -e paginated.out &&
105+
test_path_is_file paginated.out &&
106106
107107
rm -f paginated.out &&
108108
test_config pager.grep false &&
109109
test_terminal git grep initial &&
110-
! test -e paginated.out
110+
test_path_is_missing paginated.out
111111
'
112112

113113
test_expect_success TTY 'configuration can enable pager (from subdir)' '
@@ -122,107 +122,107 @@ test_expect_success TTY 'configuration can enable pager (from subdir)' '
122122
test_terminal git bundle unbundle ../test.bundle
123123
) &&
124124
{
125-
test -e paginated.out ||
126-
test -e subdir/paginated.out
125+
test_path_is_file paginated.out ||
126+
test_path_is_file subdir/paginated.out
127127
}
128128
'
129129

130130
test_expect_success TTY 'git tag -l defaults to paging' '
131131
rm -f paginated.out &&
132132
test_terminal git tag -l &&
133-
test -e paginated.out
133+
test_path_is_file paginated.out
134134
'
135135

136136
test_expect_success TTY 'git tag -l respects pager.tag' '
137137
rm -f paginated.out &&
138138
test_terminal git -c pager.tag=false tag -l &&
139-
! test -e paginated.out
139+
test_path_is_missing paginated.out
140140
'
141141

142142
test_expect_success TTY 'git tag -l respects --no-pager' '
143143
rm -f paginated.out &&
144144
test_terminal git -c pager.tag --no-pager tag -l &&
145-
! test -e paginated.out
145+
test_path_is_missing paginated.out
146146
'
147147

148148
test_expect_success TTY 'git tag with no args defaults to paging' '
149149
# no args implies -l so this should page like -l
150150
rm -f paginated.out &&
151151
test_terminal git tag &&
152-
test -e paginated.out
152+
test_path_is_file paginated.out
153153
'
154154

155155
test_expect_success TTY 'git tag with no args respects pager.tag' '
156156
# no args implies -l so this should page like -l
157157
rm -f paginated.out &&
158158
test_terminal git -c pager.tag=false tag &&
159-
! test -e paginated.out
159+
test_path_is_missing paginated.out
160160
'
161161

162162
test_expect_success TTY 'git tag --contains defaults to paging' '
163163
# --contains implies -l so this should page like -l
164164
rm -f paginated.out &&
165165
test_terminal git tag --contains &&
166-
test -e paginated.out
166+
test_path_is_file paginated.out
167167
'
168168

169169
test_expect_success TTY 'git tag --contains respects pager.tag' '
170170
# --contains implies -l so this should page like -l
171171
rm -f paginated.out &&
172172
test_terminal git -c pager.tag=false tag --contains &&
173-
! test -e paginated.out
173+
test_path_is_missing paginated.out
174174
'
175175

176176
test_expect_success TTY 'git tag -a defaults to not paging' '
177177
test_when_finished "git tag -d newtag" &&
178178
rm -f paginated.out &&
179179
test_terminal git tag -am message newtag &&
180-
! test -e paginated.out
180+
test_path_is_missing paginated.out
181181
'
182182

183183
test_expect_success TTY 'git tag -a ignores pager.tag' '
184184
test_when_finished "git tag -d newtag" &&
185185
rm -f paginated.out &&
186186
test_terminal git -c pager.tag tag -am message newtag &&
187-
! test -e paginated.out
187+
test_path_is_missing paginated.out
188188
'
189189

190190
test_expect_success TTY 'git tag -a respects --paginate' '
191191
test_when_finished "git tag -d newtag" &&
192192
rm -f paginated.out &&
193193
test_terminal git --paginate tag -am message newtag &&
194-
test -e paginated.out
194+
test_path_is_file paginated.out
195195
'
196196

197197
test_expect_success TTY 'git tag as alias ignores pager.tag with -a' '
198198
test_when_finished "git tag -d newtag" &&
199199
rm -f paginated.out &&
200200
test_terminal git -c pager.tag -c alias.t=tag t -am message newtag &&
201-
! test -e paginated.out
201+
test_path_is_missing paginated.out
202202
'
203203

204204
test_expect_success TTY 'git tag as alias respects pager.tag with -l' '
205205
rm -f paginated.out &&
206206
test_terminal git -c pager.tag=false -c alias.t=tag t -l &&
207-
! test -e paginated.out
207+
test_path_is_missing paginated.out
208208
'
209209

210210
test_expect_success TTY 'git branch defaults to paging' '
211211
rm -f paginated.out &&
212212
test_terminal git branch &&
213-
test -e paginated.out
213+
test_path_is_file paginated.out
214214
'
215215

216216
test_expect_success TTY 'git branch respects pager.branch' '
217217
rm -f paginated.out &&
218218
test_terminal git -c pager.branch=false branch &&
219-
! test -e paginated.out
219+
test_path_is_missing paginated.out
220220
'
221221

222222
test_expect_success TTY 'git branch respects --no-pager' '
223223
rm -f paginated.out &&
224224
test_terminal git --no-pager branch &&
225-
! test -e paginated.out
225+
test_path_is_missing paginated.out
226226
'
227227

228228
test_expect_success TTY 'git branch --edit-description ignores pager.branch' '
@@ -232,8 +232,8 @@ test_expect_success TTY 'git branch --edit-description ignores pager.branch' '
232232
touch editor.used
233233
EOF
234234
EDITOR=./editor test_terminal git -c pager.branch branch --edit-description &&
235-
! test -e paginated.out &&
236-
test -e editor.used
235+
test_path_is_missing paginated.out &&
236+
test_path_is_file editor.used
237237
'
238238

239239
test_expect_success TTY 'git branch --set-upstream-to ignores pager.branch' '
@@ -242,13 +242,13 @@ test_expect_success TTY 'git branch --set-upstream-to ignores pager.branch' '
242242
test_when_finished "git branch -D other" &&
243243
test_terminal git -c pager.branch branch --set-upstream-to=other &&
244244
test_when_finished "git branch --unset-upstream" &&
245-
! test -e paginated.out
245+
test_path_is_missing paginated.out
246246
'
247247

248248
test_expect_success TTY 'git config ignores pager.config when setting' '
249249
rm -f paginated.out &&
250250
test_terminal git -c pager.config config foo.bar bar &&
251-
! test -e paginated.out
251+
test_path_is_missing paginated.out
252252
'
253253

254254
test_expect_success TTY 'git config --edit ignores pager.config' '
@@ -257,33 +257,33 @@ test_expect_success TTY 'git config --edit ignores pager.config' '
257257
touch editor.used
258258
EOF
259259
EDITOR=./editor test_terminal git -c pager.config config --edit &&
260-
! test -e paginated.out &&
261-
test -e editor.used
260+
test_path_is_missing paginated.out &&
261+
test_path_is_file editor.used
262262
'
263263

264264
test_expect_success TTY 'git config --get ignores pager.config' '
265265
rm -f paginated.out &&
266266
test_terminal git -c pager.config config --get foo.bar &&
267-
! test -e paginated.out
267+
test_path_is_missing paginated.out
268268
'
269269

270270
test_expect_success TTY 'git config --get-urlmatch defaults to paging' '
271271
rm -f paginated.out &&
272272
test_terminal git -c http."https://foo.com/".bar=foo \
273273
config --get-urlmatch http https://foo.com &&
274-
test -e paginated.out
274+
test_path_is_file paginated.out
275275
'
276276

277277
test_expect_success TTY 'git config --get-all respects pager.config' '
278278
rm -f paginated.out &&
279279
test_terminal git -c pager.config=false config --get-all foo.bar &&
280-
! test -e paginated.out
280+
test_path_is_missing paginated.out
281281
'
282282

283283
test_expect_success TTY 'git config --list defaults to paging' '
284284
rm -f paginated.out &&
285285
test_terminal git config --list &&
286-
test -e paginated.out
286+
test_path_is_file paginated.out
287287
'
288288

289289

@@ -392,7 +392,7 @@ test_default_pager() {
392392
export PATH &&
393393
$full_command
394394
) &&
395-
test -e default_pager_used
395+
test_path_is_file default_pager_used
396396
"
397397
}
398398

@@ -406,7 +406,7 @@ test_PAGER_overrides() {
406406
PAGER='wc >PAGER_used' &&
407407
export PAGER &&
408408
$full_command &&
409-
test -e PAGER_used
409+
test_path_is_file PAGER_used
410410
"
411411
}
412412

@@ -432,7 +432,7 @@ test_core_pager() {
432432
export PAGER &&
433433
test_config core.pager 'wc >core.pager_used' &&
434434
$full_command &&
435-
${if_local_config}test -e core.pager_used
435+
${if_local_config}test_path_is_file core.pager_used
436436
"
437437
}
438438

@@ -464,7 +464,7 @@ test_pager_subdir_helper() {
464464
cd sub &&
465465
$full_command
466466
) &&
467-
${if_local_config}test -e core.pager_used
467+
${if_local_config}test_path_is_file core.pager_used
468468
"
469469
}
470470

@@ -477,7 +477,7 @@ test_GIT_PAGER_overrides() {
477477
GIT_PAGER='wc >GIT_PAGER_used' &&
478478
export GIT_PAGER &&
479479
$full_command &&
480-
test -e GIT_PAGER_used
480+
test_path_is_file GIT_PAGER_used
481481
"
482482
}
483483

@@ -489,7 +489,7 @@ test_doesnt_paginate() {
489489
GIT_PAGER='wc >GIT_PAGER_used' &&
490490
export GIT_PAGER &&
491491
$full_command &&
492-
! test -e GIT_PAGER_used
492+
test_path_is_missing GIT_PAGER_used
493493
"
494494
}
495495

0 commit comments

Comments
 (0)