Skip to content

Commit 986c518

Browse files
committed
Merge branch 'sg/test-must-be-empty'
Test fixes. * sg/test-must-be-empty: tests: use 'test_must_be_empty' instead of 'test_cmp <empty> <out>' tests: use 'test_must_be_empty' instead of 'test_cmp /dev/null <out>' tests: use 'test_must_be_empty' instead of 'test ! -s' tests: use 'test_must_be_empty' instead of '! test -s'
2 parents fc0df93 + 1c5e94f commit 986c518

File tree

77 files changed

+231
-344
lines changed

Some content is hidden

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

77 files changed

+231
-344
lines changed

t/t0000-basic.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ check_sub_test_lib_test () {
116116
name="$1" # stdin is the expected output from the test
117117
(
118118
cd "$name" &&
119-
! test -s err &&
119+
test_must_be_empty err &&
120120
sed -e 's/^> //' -e 's/Z$//' >expect &&
121121
test_cmp expect out
122122
)

t/t0001-init.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,8 @@ test_expect_success 'reinit' '
167167
) &&
168168
test_i18ngrep "Initialized empty" again/out1 &&
169169
test_i18ngrep "Reinitialized existing" again/out2 &&
170-
>again/empty &&
171-
test_i18ncmp again/empty again/err1 &&
172-
test_i18ncmp again/empty again/err2
170+
test_must_be_empty again/err1 &&
171+
test_must_be_empty again/err2
173172
'
174173

175174
test_expect_success 'init with --template' '

t/t0003-attributes.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,8 @@ test_expect_success 'attribute test: --all option' '
208208
'
209209

210210
test_expect_success 'attribute test: --cached option' '
211-
: >empty &&
212211
git check-attr --cached --stdin --all <stdin-all | sort >actual &&
213-
test_cmp empty actual &&
212+
test_must_be_empty actual &&
214213
git add .gitattributes a/.gitattributes a/b/.gitattributes &&
215214
git check-attr --cached --stdin --all <stdin-all | sort >actual &&
216215
test_cmp specified-all actual

t/t0030-stripspace.sh

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -320,22 +320,20 @@ test_expect_success \
320320

321321
test_expect_success \
322322
'spaces with newline at end should be replaced with empty string' '
323-
printf "" >expect &&
324-
325323
echo | git stripspace >actual &&
326-
test_cmp expect actual &&
324+
test_must_be_empty actual &&
327325
328326
echo "$sss" | git stripspace >actual &&
329-
test_cmp expect actual &&
327+
test_must_be_empty actual &&
330328
331329
echo "$sss$sss" | git stripspace >actual &&
332-
test_cmp expect actual &&
330+
test_must_be_empty actual &&
333331
334332
echo "$sss$sss$sss" | git stripspace >actual &&
335-
test_cmp expect actual &&
333+
test_must_be_empty actual &&
336334
337335
echo "$sss$sss$sss$sss" | git stripspace >actual &&
338-
test_cmp expect actual
336+
test_must_be_empty actual
339337
'
340338

341339
test_expect_success \
@@ -349,19 +347,17 @@ test_expect_success \
349347

350348
test_expect_success \
351349
'spaces without newline at end should be replaced with empty string' '
352-
printf "" >expect &&
353-
354350
printf "" | git stripspace >actual &&
355-
test_cmp expect actual &&
351+
test_must_be_empty actual &&
356352
357353
printf "$sss$sss" | git stripspace >actual &&
358-
test_cmp expect actual &&
354+
test_must_be_empty actual &&
359355
360356
printf "$sss$sss$sss" | git stripspace >actual &&
361-
test_cmp expect actual &&
357+
test_must_be_empty actual &&
362358
363359
printf "$sss$sss$sss$sss" | git stripspace >actual &&
364-
test_cmp expect actual
360+
test_must_be_empty actual
365361
'
366362

367363
test_expect_success \

t/t0040-parse-options.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,9 @@ test_expect_success 'OPT_CALLBACK() and OPT_BIT() work' '
286286
test_cmp expect output
287287
'
288288

289-
>expect
290-
291289
test_expect_success 'OPT_CALLBACK() and callback errors work' '
292290
test_must_fail test-parse-options --no-length >output 2>output.err &&
293-
test_i18ncmp expect output &&
291+
test_must_be_empty output &&
294292
test_must_be_empty output.err
295293
'
296294

t/t0061-run-command.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ cat >hello-script <<-EOF
1111
#!$SHELL_PATH
1212
cat hello-script
1313
EOF
14-
>empty
1514

1615
test_expect_success 'start_command reports ENOENT' '
1716
test-tool run-command start-command-ENOENT ./does-not-exist
@@ -23,7 +22,7 @@ test_expect_success 'run_command can run a command' '
2322
test-tool run-command run-command ./hello.sh >actual 2>err &&
2423
2524
test_cmp hello-script actual &&
26-
test_cmp empty err
25+
test_must_be_empty err
2726
'
2827

2928
test_expect_success !MINGW 'run_command can run a script without a #! line' '
@@ -34,7 +33,7 @@ test_expect_success !MINGW 'run_command can run a script without a #! line' '
3433
test-tool run-command run-command ./hello >actual 2>err &&
3534
3635
test_cmp hello-script actual &&
37-
test_cmp empty err
36+
test_must_be_empty err
3837
'
3938

4039
test_expect_success 'run_command does not try to execute a directory' '
@@ -47,7 +46,7 @@ test_expect_success 'run_command does not try to execute a directory' '
4746
PATH=$PWD/bin1:$PWD/bin2:$PATH \
4847
test-tool run-command run-command greet >actual 2>err &&
4948
test_cmp bin2/greet actual &&
50-
test_cmp empty err
49+
test_must_be_empty err
5150
'
5251

5352
test_expect_success POSIXPERM 'run_command passes over non-executable file' '
@@ -64,7 +63,7 @@ test_expect_success POSIXPERM 'run_command passes over non-executable file' '
6463
PATH=$PWD/bin1:$PWD/bin2:$PATH \
6564
test-tool run-command run-command greet >actual 2>err &&
6665
test_cmp bin2/greet actual &&
67-
test_cmp empty err
66+
test_must_be_empty err
6867
'
6968

7069
test_expect_success POSIXPERM 'run_command reports EACCES' '

t/t0090-cache-tree.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ test_expect_success 'no phantom error when switching trees' '
239239
>newdir/one &&
240240
git add newdir/one &&
241241
git checkout 2>errors &&
242-
! test -s errors
242+
test_must_be_empty errors
243243
'
244244

245245
test_expect_success 'switching trees does not invalidate shared index' '

t/t0203-gettext-setlocale-sanity.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ test_expect_success 'git show a ISO-8859-1 commit under C locale' '
1111
. "$TEST_DIRECTORY"/t3901/8859-1.txt &&
1212
test_commit "iso-c-commit" iso-under-c &&
1313
git show >out 2>err &&
14-
! test -s err &&
14+
test_must_be_empty err &&
1515
grep -q "iso-c-commit" out
1616
'
1717

1818
test_expect_success GETTEXT_LOCALE 'git show a ISO-8859-1 commit under a UTF-8 locale' '
1919
. "$TEST_DIRECTORY"/t3901/8859-1.txt &&
2020
test_commit "iso-utf8-commit" iso-under-utf8 &&
2121
LANGUAGE=is LC_ALL="$is_IS_locale" git show >out 2>err &&
22-
! test -s err &&
22+
test_must_be_empty err &&
2323
grep -q "iso-utf8-commit" out
2424
'
2525

t/t1300-config.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,12 +346,9 @@ test_expect_success 'working --list' '
346346
git config --list > output &&
347347
test_cmp expect output
348348
'
349-
cat > expect << EOF
350-
EOF
351-
352349
test_expect_success '--list without repo produces empty output' '
353350
git --git-dir=nonexistent config --list >output &&
354-
test_cmp expect output
351+
test_must_be_empty output
355352
'
356353

357354
cat > expect << EOF

t/t1410-reflog.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,8 @@ test_expect_success 'stale dirs do not cause d/f conflicts (reflogs off)' '
290290
# same as before, but we only create a reflog for "one" if
291291
# it already exists, which it does not
292292
git -c core.logallrefupdates=false branch one master &&
293-
: >expect &&
294293
git log -g --format="%gd %gs" one >actual &&
295-
test_cmp expect actual
294+
test_must_be_empty actual
296295
'
297296

298297
# Triggering the bug detected by this test requires a newline to fall

0 commit comments

Comments
 (0)