diff options
author | Felipe Contreras <felipe.contreras@gmail.com> | 2013-05-24 21:29:21 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-05-28 07:59:19 -0700 |
commit | 531594e5aad738fa46cfad417bcef0fbd1520fbd (patch) | |
tree | 8f9d0482a995978f4b5904a7576baf81ffeae711 /contrib | |
parent | remote-helpers: test: cleanup style (diff) | |
download | tgif-531594e5aad738fa46cfad417bcef0fbd1520fbd.tar.xz |
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>
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/remote-helpers/test-bzr.sh | 21 | ||||
-rwxr-xr-x | contrib/remote-helpers/test-hg-bidi.sh | 15 | ||||
-rwxr-xr-x | contrib/remote-helpers/test-hg-hg-git.sh | 33 | ||||
-rwxr-xr-x | contrib/remote-helpers/test-hg.sh | 7 |
4 files changed, 31 insertions, 45 deletions
diff --git a/contrib/remote-helpers/test-bzr.sh b/contrib/remote-helpers/test-bzr.sh index 4ab73ec4e5..b54313e69e 100755 --- a/contrib/remote-helpers/test-bzr.sh +++ b/contrib/remote-helpers/test-bzr.sh @@ -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 && diff --git a/contrib/remote-helpers/test-hg-bidi.sh b/contrib/remote-helpers/test-hg-bidi.sh index 2c693d07d9..676b1ab478 100755 --- a/contrib/remote-helpers/test-hg-bidi.sh +++ b/contrib/remote-helpers/test-hg-bidi.sh @@ -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 && diff --git a/contrib/remote-helpers/test-hg-hg-git.sh b/contrib/remote-helpers/test-hg-hg-git.sh index e0dbebf050..041041ddb1 100755 --- a/contrib/remote-helpers/test-hg-hg-git.sh +++ b/contrib/remote-helpers/test-hg-hg-git.sh @@ -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 ( diff --git a/contrib/remote-helpers/test-hg.sh b/contrib/remote-helpers/test-hg.sh index e278dfde0f..f986db0ff0 100755 --- a/contrib/remote-helpers/test-hg.sh +++ b/contrib/remote-helpers/test-hg.sh @@ -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>" && |