remote-helpers: tests: general improvements

So that we don't need a temporary directory.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Felipe Contreras 2013-05-24 21:29:21 -05:00 committed by Junio C Hamano
parent dde67d794c
commit 531594e5aa
4 changed files with 31 additions and 45 deletions

View File

@ -190,9 +190,11 @@ test_expect_success 'different authors' '
test_cmp expected actual
'
# cleanup previous stuff
rm -rf bzrrepo gitrepo
test_expect_success 'fetch utf-8 filenames' '
mkdir -p tmp && cd tmp &&
test_when_finished "cd .. && rm -rf tmp && LC_ALL=C" &&
test_when_finished "rm -rf bzrrepo gitrepo && LC_ALL=C" &&
LC_ALL=en_US.UTF-8
export LC_ALL
@ -223,8 +225,9 @@ test_expect_success 'fetch utf-8 filenames' '
'
test_expect_success 'push utf-8 filenames' '
test_when_finished "rm -rf bzrrepo gitrepo && LC_ALL=C" &&
mkdir -p tmp && cd tmp &&
test_when_finished "cd .. && rm -rf tmp && LC_ALL=C" &&
LC_ALL=en_US.UTF-8
export LC_ALL
@ -255,8 +258,7 @@ test_expect_success 'push utf-8 filenames' '
'
test_expect_success 'pushing a merge' '
mkdir -p tmp && cd tmp &&
test_when_finished "cd .. && rm -rf tmp" &&
test_when_finished "rm -rf bzrrepo gitrepo" &&
(
bzr init bzrrepo &&
@ -297,8 +299,7 @@ origin/trunk
EOF
test_expect_success 'proper bzr repo' '
mkdir -p tmp && cd tmp &&
test_when_finished "cd .. && rm -rf tmp" &&
test_when_finished "rm -rf bzrrepo gitrepo" &&
bzr init-repo bzrrepo &&
@ -323,13 +324,11 @@ test_expect_success 'proper bzr repo' '
git for-each-ref --format "%(refname:short)" refs/remotes/origin > ../actual
) &&
test_cmp ../expected actual
test_cmp expected actual
'
test_expect_success 'strip' '
# Do not imitate this style; always chdir inside a subshell instead
mkdir -p tmp && cd tmp &&
test_when_finished "cd .. && rm -rf tmp" &&
test_when_finished "rm -rf bzrrepo gitrepo" &&
(
bzr init bzrrepo &&

View File

@ -77,8 +77,7 @@ setup () {
setup
test_expect_success 'encoding' '
mkdir -p tmp && cd tmp &&
test_when_finished "cd .. && rm -rf tmp" &&
test_when_finished "rm -rf gitrepo* hgrepo*" &&
(
git init -q gitrepo &&
@ -115,8 +114,7 @@ test_expect_success 'encoding' '
'
test_expect_success 'file removal' '
mkdir -p tmp && cd tmp &&
test_when_finished "cd .. && rm -rf tmp" &&
test_when_finished "rm -rf gitrepo* hgrepo*" &&
(
git init -q gitrepo &&
@ -148,8 +146,7 @@ test_expect_success 'file removal' '
'
test_expect_success 'git tags' '
mkdir -p tmp && cd tmp &&
test_when_finished "cd .. && rm -rf tmp" &&
test_when_finished "rm -rf gitrepo* hgrepo*" &&
(
git init -q gitrepo &&
@ -177,8 +174,7 @@ test_expect_success 'git tags' '
'
test_expect_success 'hg branch' '
mkdir -p tmp && cd tmp &&
test_when_finished "cd .. && rm -rf tmp" &&
test_when_finished "rm -rf gitrepo* hgrepo*" &&
(
git init -q gitrepo &&
@ -214,8 +210,7 @@ test_expect_success 'hg branch' '
'
test_expect_success 'hg tags' '
mkdir -p tmp && cd tmp &&
test_when_finished "cd .. && rm -rf tmp" &&
test_when_finished "rm -rf gitrepo* hgrepo*" &&
(
git init -q gitrepo &&

View File

@ -115,8 +115,7 @@ setup () {
setup
test_expect_success 'executable bit' '
mkdir -p tmp && cd tmp &&
test_when_finished "cd .. && rm -rf tmp" &&
test_when_finished "rm -rf gitrepo* hgrepo*" &&
(
git init -q gitrepo &&
@ -151,8 +150,7 @@ test_expect_success 'executable bit' '
'
test_expect_success 'symlink' '
mkdir -p tmp && cd tmp &&
test_when_finished "cd .. && rm -rf tmp" &&
test_when_finished "rm -rf gitrepo* hgrepo*" &&
(
git init -q gitrepo &&
@ -182,8 +180,7 @@ test_expect_success 'symlink' '
'
test_expect_success 'merge conflict 1' '
mkdir -p tmp && cd tmp &&
test_when_finished "cd .. && rm -rf tmp" &&
test_when_finished "rm -rf gitrepo* hgrepo*" &&
(
hg init hgrepo1 &&
@ -217,8 +214,7 @@ test_expect_success 'merge conflict 1' '
'
test_expect_success 'merge conflict 2' '
mkdir -p tmp && cd tmp &&
test_when_finished "cd .. && rm -rf tmp" &&
test_when_finished "rm -rf gitrepo* hgrepo*" &&
(
hg init hgrepo1 &&
@ -252,8 +248,7 @@ test_expect_success 'merge conflict 2' '
'
test_expect_success 'converged merge' '
mkdir -p tmp && cd tmp &&
test_when_finished "cd .. && rm -rf tmp" &&
test_when_finished "rm -rf gitrepo* hgrepo*" &&
(
hg init hgrepo1 &&
@ -288,8 +283,7 @@ test_expect_success 'converged merge' '
'
test_expect_success 'encoding' '
mkdir -p tmp && cd tmp &&
test_when_finished "cd .. && rm -rf tmp" &&
test_when_finished "rm -rf gitrepo* hgrepo*" &&
(
git init -q gitrepo &&
@ -328,8 +322,7 @@ test_expect_success 'encoding' '
'
test_expect_success 'file removal' '
mkdir -p tmp && cd tmp &&
test_when_finished "cd .. && rm -rf tmp" &&
test_when_finished "rm -rf gitrepo* hgrepo*" &&
(
git init -q gitrepo &&
@ -368,8 +361,7 @@ test_expect_success 'file removal' '
'
test_expect_success 'git tags' '
mkdir -p tmp && cd tmp &&
test_when_finished "cd .. && rm -rf tmp" &&
test_when_finished "rm -rf gitrepo* hgrepo*" &&
(
git init -q gitrepo &&
@ -395,8 +387,7 @@ test_expect_success 'git tags' '
'
test_expect_success 'hg author' '
mkdir -p tmp && cd tmp &&
test_when_finished "cd .. && rm -rf tmp" &&
test_when_finished "rm -rf gitrepo* hgrepo*" &&
for x in hg git; do
(
@ -462,8 +453,7 @@ test_expect_success 'hg author' '
'
test_expect_success 'hg branch' '
mkdir -p tmp && cd tmp &&
test_when_finished "cd .. && rm -rf tmp" &&
test_when_finished "rm -rf gitrepo* hgrepo*" &&
for x in hg git; do
(
@ -499,8 +489,7 @@ test_expect_success 'hg branch' '
'
test_expect_success 'hg tags' '
mkdir -p tmp && cd tmp &&
test_when_finished "cd .. && rm -rf tmp" &&
test_when_finished "rm -rf gitrepo* hgrepo*" &&
for x in hg git; do
(

View File

@ -122,6 +122,9 @@ test_expect_success 'update bookmark' '
hg -R hgrepo bookmarks | egrep "devel[ ]+3:"
'
# cleanup previous stuff
rm -rf hgrepo
author_test () {
echo $1 >> content &&
hg commit -u "$2" -m "add $1" &&
@ -129,8 +132,7 @@ author_test () {
}
test_expect_success 'authors' '
mkdir -p tmp && cd tmp &&
test_when_finished "cd .. && rm -rf tmp" &&
test_when_finished "rm -rf hgrepo gitrepo" &&
(
hg init hgrepo &&
@ -139,6 +141,7 @@ test_expect_success 'authors' '
touch content &&
hg add content &&
> ../expected &&
author_test alpha "" "H G Wells <wells@example.com>" &&
author_test beta "test" "test <unknown>" &&
author_test beta "test <test@example.com> (comment)" "test <test@example.com>" &&