зеркало из https://github.com/microsoft/git.git
Use test_expect_success for test setups
Several tests did not use test_expect_success for their setup commands. Putting these start commands into the testing framework means both that errors during setup will be caught quickly and that non-error text will be suppressed without -v. Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
a673cfede6
Коммит
4a45f7dd49
|
@ -11,9 +11,11 @@ line.
|
||||||
'
|
'
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
touch foo bar
|
test_expect_success 'setup' '
|
||||||
git update-index --add foo bar
|
touch foo bar &&
|
||||||
git commit -m "add foo bar"
|
git update-index --add foo bar &&
|
||||||
|
git commit -m "add foo bar"
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'git ls-files --error-unmatch should fail with unmatched path.' \
|
'git ls-files --error-unmatch should fail with unmatched path.' \
|
||||||
|
|
|
@ -22,10 +22,12 @@ check_verify_failure () {
|
||||||
###########################################################
|
###########################################################
|
||||||
# first create a commit, so we have a valid object/type
|
# first create a commit, so we have a valid object/type
|
||||||
# for the tag.
|
# for the tag.
|
||||||
echo Hello >A
|
test_expect_success 'setup' '
|
||||||
git update-index --add A
|
echo Hello >A &&
|
||||||
git commit -m "Initial commit"
|
git update-index --add A &&
|
||||||
head=$(git rev-parse --verify HEAD)
|
git commit -m "Initial commit" &&
|
||||||
|
head=$(git rev-parse --verify HEAD)
|
||||||
|
'
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
# 1. length check
|
# 1. length check
|
||||||
|
|
|
@ -20,23 +20,25 @@ EOF
|
||||||
cat file1 >file2
|
cat file1 >file2
|
||||||
cat file1 >file4
|
cat file1 >file4
|
||||||
|
|
||||||
git update-index --add --remove file1 file2 file4
|
test_expect_success 'setup' "
|
||||||
git commit -m 'Initial Version' 2>/dev/null
|
git update-index --add --remove file1 file2 file4 &&
|
||||||
|
git commit -m 'Initial Version' 2>/dev/null &&
|
||||||
|
|
||||||
git checkout -b binary
|
git checkout -b binary &&
|
||||||
perl -pe 'y/x/\000/' <file1 >file3
|
perl -pe 'y/x/\000/' <file1 >file3 &&
|
||||||
cat file3 >file4
|
cat file3 >file4 &&
|
||||||
git add file2
|
git add file2 &&
|
||||||
perl -pe 'y/\000/v/' <file3 >file1
|
perl -pe 'y/\000/v/' <file3 >file1 &&
|
||||||
rm -f file2
|
rm -f file2 &&
|
||||||
git update-index --add --remove file1 file2 file3 file4
|
git update-index --add --remove file1 file2 file3 file4 &&
|
||||||
git commit -m 'Second Version'
|
git commit -m 'Second Version' &&
|
||||||
|
|
||||||
git diff-tree -p master binary >B.diff
|
git diff-tree -p master binary >B.diff &&
|
||||||
git diff-tree -p -C master binary >C.diff
|
git diff-tree -p -C master binary >C.diff &&
|
||||||
|
|
||||||
git diff-tree -p --binary master binary >BF.diff
|
git diff-tree -p --binary master binary >BF.diff &&
|
||||||
git diff-tree -p --binary -C master binary >CF.diff
|
git diff-tree -p --binary -C master binary >CF.diff
|
||||||
|
"
|
||||||
|
|
||||||
test_expect_success 'stat binary diff -- should not fail.' \
|
test_expect_success 'stat binary diff -- should not fail.' \
|
||||||
'git checkout master
|
'git checkout master
|
||||||
|
|
|
@ -8,40 +8,42 @@ test_description='git rerere
|
||||||
|
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
cat > a1 << EOF
|
test_expect_success 'setup' "
|
||||||
Some title
|
cat > a1 <<- EOF &&
|
||||||
==========
|
Some title
|
||||||
Whether 'tis nobler in the mind to suffer
|
==========
|
||||||
The slings and arrows of outrageous fortune,
|
Whether 'tis nobler in the mind to suffer
|
||||||
Or to take arms against a sea of troubles,
|
The slings and arrows of outrageous fortune,
|
||||||
And by opposing end them? To die: to sleep;
|
Or to take arms against a sea of troubles,
|
||||||
No more; and by a sleep to say we end
|
And by opposing end them? To die: to sleep;
|
||||||
The heart-ache and the thousand natural shocks
|
No more; and by a sleep to say we end
|
||||||
That flesh is heir to, 'tis a consummation
|
The heart-ache and the thousand natural shocks
|
||||||
Devoutly to be wish'd.
|
That flesh is heir to, 'tis a consummation
|
||||||
EOF
|
Devoutly to be wish'd.
|
||||||
|
EOF
|
||||||
|
|
||||||
git add a1
|
git add a1 &&
|
||||||
git commit -q -a -m initial
|
git commit -q -a -m initial &&
|
||||||
|
|
||||||
git checkout -b first
|
git checkout -b first &&
|
||||||
cat >> a1 << EOF
|
cat >> a1 <<- EOF &&
|
||||||
Some title
|
Some title
|
||||||
==========
|
==========
|
||||||
To die, to sleep;
|
To die, to sleep;
|
||||||
To sleep: perchance to dream: ay, there's the rub;
|
To sleep: perchance to dream: ay, there's the rub;
|
||||||
For in that sleep of death what dreams may come
|
For in that sleep of death what dreams may come
|
||||||
When we have shuffled off this mortal coil,
|
When we have shuffled off this mortal coil,
|
||||||
Must give us pause: there's the respect
|
Must give us pause: there's the respect
|
||||||
That makes calamity of so long life;
|
That makes calamity of so long life;
|
||||||
EOF
|
EOF
|
||||||
git commit -q -a -m first
|
git commit -q -a -m first &&
|
||||||
|
|
||||||
git checkout -b second master
|
git checkout -b second master &&
|
||||||
git show first:a1 |
|
git show first:a1 |
|
||||||
sed -e 's/To die, t/To die! T/' -e 's/Some title/Some Title/' > a1
|
sed -e 's/To die, t/To die! T/' -e 's/Some title/Some Title/' > a1 &&
|
||||||
echo "* END *" >>a1
|
echo '* END *' >>a1 &&
|
||||||
git commit -q -a -m second
|
git commit -q -a -m second
|
||||||
|
"
|
||||||
|
|
||||||
test_expect_success 'nothing recorded without rerere' '
|
test_expect_success 'nothing recorded without rerere' '
|
||||||
(rm -rf .git/rr-cache; git config rerere.enabled false) &&
|
(rm -rf .git/rr-cache; git config rerere.enabled false) &&
|
||||||
|
|
|
@ -15,9 +15,10 @@ code and message.'
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
# snapshot settings
|
# snapshot settings
|
||||||
|
|
||||||
test_commit \
|
test_expect_success 'setup' "
|
||||||
'SnapshotTests' \
|
test_commit 'SnapshotTests' 'i can has snapshot?'
|
||||||
'i can has snapshot?'
|
"
|
||||||
|
|
||||||
|
|
||||||
cat >>gitweb_config.perl <<\EOF
|
cat >>gitweb_config.perl <<\EOF
|
||||||
$feature{'snapshot'}{'override'} = 0;
|
$feature{'snapshot'}{'override'} = 0;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче