From ede906771400f5ae93612130c32ef3034ba676a5 Mon Sep 17 00:00:00 2001 From: Stephen Haberman Date: Thu, 19 Jun 2008 23:42:40 -0500 Subject: [PATCH] Test cleanup. --- tests/t2000-server-pre-receive-ticket.sh | 13 +++++++------ .../t2001-server-pre-receive-ticket-via-shim.sh | 4 ++-- .../t2002-server-pre-receive-ticket-branches.sh | 16 ++++++++-------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/tests/t2000-server-pre-receive-ticket.sh b/tests/t2000-server-pre-receive-ticket.sh index a158729..f0a7016 100644 --- a/tests/t2000-server-pre-receive-ticket.sh +++ b/tests/t2000-server-pre-receive-ticket.sh @@ -22,8 +22,8 @@ install_server_hook 'pre-receive-ticket' 'pre-receive' test_expect_success 'reject with bad message' ' echo $test_name >a && git commit -a -m "$test_name" && - head=$(git rev-parse HEAD) - git push >push.out 2>push.err + head=$(git rev-parse HEAD) && + ! git push >push.out 2>push.err && cat push.err | grep "Commit $head does not reference a ticket" ' @@ -49,24 +49,25 @@ test_expect_success 'reject with bad message in second of three' ' # the bad one echo "$test_name second" >a && git commit -a -m "$test_name second" && - head=$(git rev-parse HEAD) + head=$(git rev-parse HEAD) && + echo "head=$head" && echo "$test_name third" >a && git commit -a -m "$test_name third re #3222" && - git push + ! git push >push.out 2>push.err && cat push.err | grep "Commit $head does not reference a ticket" ' test_expect_success 'accept with re in all of three' ' - git reset --hard HEAD^^^ + git reset --hard HEAD^^^ && echo "$test_name first" >a && git commit -a -m "$test_name first re #3222" && # the bad one echo "$test_name second" >a && git commit -a -m "$test_name second re #3222" && - head=$(git rev-parse HEAD) + head=$(git rev-parse HEAD) && echo "$test_name third" >a && git commit -a -m "$test_name third re #3222" && diff --git a/tests/t2001-server-pre-receive-ticket-via-shim.sh b/tests/t2001-server-pre-receive-ticket-via-shim.sh index 6a99ba6..fe82a71 100644 --- a/tests/t2001-server-pre-receive-ticket-via-shim.sh +++ b/tests/t2001-server-pre-receive-ticket-via-shim.sh @@ -23,8 +23,8 @@ install_server_hook 'pre-receive-ticket' 'pre-receive-ticket' test_expect_success 'reject with bad message via shim' ' echo $test_name >a && git commit -a -m "$test_name" && - head=$(git rev-parse HEAD) - git push >push.out 2>push.err + head=$(git rev-parse HEAD) && + ! git push >push.out 2>push.err && cat push.err | grep "Commit $head does not reference a ticket" ' diff --git a/tests/t2002-server-pre-receive-ticket-branches.sh b/tests/t2002-server-pre-receive-ticket-branches.sh index b572625..3f35809 100644 --- a/tests/t2002-server-pre-receive-ticket-branches.sh +++ b/tests/t2002-server-pre-receive-ticket-branches.sh @@ -20,48 +20,48 @@ test_expect_success 'setup' ' install_server_hook 'pre-receive-ticket' 'pre-receive' test_expect_success 'reject new branch with bad message' ' - git checkout -b topic1 master + git checkout -b topic1 master && echo $test_name >a && git commit -a -m "$test_name" && head=$(git rev-parse HEAD) - git push origin topic1 >push.out 2>push.err + ! git push origin topic1 >push.out 2>push.err && cat push.err | grep "Commit $head does not reference a ticket" ' # the last test has a dirty commit message, so ammend it with a good message test_expect_success 'accept new branch with re' ' - git checkout -b topic2 master + git checkout -b topic2 master && echo $test_name >a && git commit --amend -m "$test_name re #3222" && git push origin topic2 ' test_expect_success 'reject new branch with bad message in second of three' ' - git checkout -b topic3 master + git checkout -b topic3 master && echo "$test_name first" >a && git commit -a -m "$test_name first re #3222" && # the bad one echo "$test_name second" >a && git commit -a -m "$test_name second" && - head=$(git rev-parse HEAD) + head=$(git rev-parse HEAD) && echo "$test_name third" >a && git commit -a -m "$test_name third re #3222" && - git push origin topic3 >push.out 2>push.err + ! git push origin topic3 >push.out 2>push.err && cat push.err | grep "Commit $head does not reference a ticket" ' test_expect_success 'accept new branch with re in all of three' ' - git checkout -b topic4 master + git checkout -b topic4 master && echo "$test_name first" >a && git commit -a -m "$test_name first re #3222" && # the bad one echo "$test_name second" >a && git commit -a -m "$test_name second re #3222" && - head=$(git rev-parse HEAD) + head=$(git rev-parse HEAD) && echo "$test_name third" >a && git commit -a -m "$test_name third re #3222" && -- 2.20.1