Merge branch 'rs/test-cleanup'

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
This commit is contained in:
Junio C Hamano 2019-12-06 15:09:22 -08:00
commit 4ba74ca901
10 changed files with 16 additions and 23 deletions

View File

@ -215,7 +215,6 @@ test_expect_success 'read-tree adds to worktree, dirty case' '
'
test_expect_success 'index removal and worktree narrowing at the same time' '
>empty &&
echo init.t >.git/info/sparse-checkout &&
echo sub/added >>.git/info/sparse-checkout &&
git checkout -f top &&
@ -223,7 +222,7 @@ test_expect_success 'index removal and worktree narrowing at the same time' '
git checkout removed &&
git ls-files sub/added >result &&
test ! -f sub/added &&
test_cmp empty result
test_must_be_empty result
'
test_expect_success 'read-tree --reset removes outside worktree' '

View File

@ -29,7 +29,7 @@ test_expect_success 'ceiling' '
cd sub &&
test-tool config read_early_config early.config
) >output &&
test -z "$(cat output)"
test_must_be_empty output
'
test_expect_success 'ceiling #2' '

View File

@ -380,13 +380,13 @@ test_expect_success 'Query "master@{May 26 2005 23:32:00}" (exactly history star
test_when_finished "rm -f o e" &&
git rev-parse --verify "master@{May 26 2005 23:32:00}" >o 2>e &&
test $C = $(cat o) &&
test "" = "$(cat e)"
test_must_be_empty e
'
test_expect_success 'Query "master@{May 26 2005 23:32:30}" (first non-creation change)' '
test_when_finished "rm -f o e" &&
git rev-parse --verify "master@{May 26 2005 23:32:30}" >o 2>e &&
test $A = $(cat o) &&
test "" = "$(cat e)"
test_must_be_empty e
'
test_expect_success 'Query "master@{2005-05-26 23:33:01}" (middle of history with gap)' '
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)' '
test_when_finished "rm -f o e" &&
git rev-parse --verify "master@{2005-05-26 23:38:00}" >o 2>e &&
test $Z = $(cat o) &&
test "" = "$(cat e)"
test_must_be_empty e
'
test_expect_success 'Query "master@{2005-05-26 23:43:00}" (exact end of history)' '
test_when_finished "rm -f o e" &&
git rev-parse --verify "master@{2005-05-26 23:43:00}" >o 2>e &&
test $E = $(cat o) &&
test "" = "$(cat e)"
test_must_be_empty e
'
test_expect_success 'Query "master@{2005-05-28}" (past end of history)' '
test_when_finished "rm -f o e" &&

View File

@ -195,7 +195,7 @@ test_expect_success 'delete' '
git reflog delete master@{1} &&
git reflog show master > output &&
test $(($master_entry_count - 1)) = $(wc -l < output) &&
test_line_count = $(($master_entry_count - 1)) output &&
test $HEAD_entry_count = $(git reflog | wc -l) &&
! grep ox < output &&
@ -209,7 +209,7 @@ test_expect_success 'delete' '
git reflog delete master@{07.04.2005.15:15:00.-0700} &&
git reflog show master > output &&
test $(($master_entry_count - 1)) = $(wc -l < output) &&
test_line_count = $(($master_entry_count - 1)) output &&
! grep dragon < output
'

View File

@ -138,10 +138,10 @@ test_expect_success 'incorrect file in :path and :N:path' '
test_expect_success 'invalid @{n} reference' '
test_must_fail git rev-parse master@{99999} >output 2>error &&
test -z "$(cat output)" &&
test_must_be_empty output &&
grep "fatal: Log for [^ ]* only has [0-9][0-9]* entries." error &&
test_must_fail git rev-parse --verify master@{99999} >output 2>error &&
test -z "$(cat output)" &&
test_must_be_empty output &&
grep "fatal: Log for [^ ]* only has [0-9][0-9]* entries." error
'
@ -155,13 +155,13 @@ test_expect_success 'relative path not found' '
test_expect_success 'relative path outside worktree' '
test_must_fail git rev-parse HEAD:../file.txt >output 2>error &&
test -z "$(cat output)" &&
test_must_be_empty output &&
test_i18ngrep "outside repository" error
'
test_expect_success 'relative path when cwd is outside worktree' '
test_must_fail git --git-dir=.git --work-tree=subdir rev-parse HEAD:./file.txt >output 2>error &&
test -z "$(cat output)" &&
test_must_be_empty output &&
grep "relative path syntax can.t be used outside working tree." error
'

View File

@ -282,7 +282,7 @@ test_expect_success 'rev-parse --disambiguate' '
# commits created by commit-tree in earlier tests share a
# different prefix.
git rev-parse --disambiguate=000000000 >actual &&
test $(wc -l <actual) = 16 &&
test_line_count = 16 actual &&
test "$(sed -e "s/^\(.........\).*/\1/" actual | sort -u)" = 000000000
'

View File

@ -143,14 +143,14 @@ test_expect_success 'setup criss-cross' '
test_expect_success 'criss-cross: rev-list --ancestry-path cb..bc' '
(cd criss-cross &&
git rev-list --ancestry-path xcb..xbc > actual &&
test -z "$(cat actual)")
test_must_be_empty actual)
'
# no commits in repository descend from cb
test_expect_success 'criss-cross: rev-list --ancestry-path --all ^cb' '
(cd criss-cross &&
git rev-list --ancestry-path --all ^xcb > actual &&
test -z "$(cat actual)")
test_must_be_empty actual)
'
test_done

View File

@ -113,7 +113,6 @@ test_expect_success 'modified file' '
subdir/grep.c
unrelated
EOF
>empty &&
echo "enum grep_pat_token" >unrelated &&
test_when_finished "git checkout HEAD unrelated" &&

View File

@ -53,8 +53,6 @@ text_no_props () {
printf "%s\n" "$text"
}
>empty
test_expect_success 'empty dump' '
reinit_git &&
echo "SVN-fs-dump-format-version: 2" >input &&
@ -208,7 +206,7 @@ test_expect_failure 'timestamp and empty file' '
test_cmp expect.date actual.date &&
test_cmp expect.files actual.files &&
git checkout HEAD empty-file &&
test_cmp empty file
test_must_be_empty file
'
test_expect_success 'directory with files' '

View File

@ -2477,9 +2477,6 @@ test_expect_success PIPE 'R: copy using cat-file' '
echo $expect_id blob $expect_len >expect.response &&
rm -f blobs &&
cat >frontend <<-\FRONTEND_END &&
#!/bin/sh
FRONTEND_END
mkfifo blobs &&
(