Refactor the unit tests to remove a lot of duplicate code.
Remove old unused git-cl test files. TEST=unit tests BUG=none Review URL: http://codereview.chromium.org/122040 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@18177 0039d316-1c4b-4281-b951-d872f2087c98experimental/szager/collated-output
parent
07bbc21467
commit
2c3024ac53
@ -1,41 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check that abandoning a branch also abandons its issue.
|
||||
|
||||
set -e
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
setup_initsvn
|
||||
setup_gitsvn
|
||||
|
||||
(
|
||||
set -e
|
||||
cd git-svn
|
||||
git config rietveld.server localhost:8080
|
||||
|
||||
# Create a branch and give it an issue.
|
||||
git checkout -q -b abandoned
|
||||
echo "some work done on a branch" >> test
|
||||
git add test; git commit -q -m "branch work"
|
||||
export EDITOR=/bin/true
|
||||
test_expect_success "upload succeeds" \
|
||||
"$GIT_CL upload -m test master... | grep -q 'Issue created'"
|
||||
|
||||
# Switch back to master, delete the branch.
|
||||
git checkout master
|
||||
git branch -D abandoned
|
||||
|
||||
# Verify that "status" doesn't know about it anymore.
|
||||
# The "exit" trickiness is inverting the exit status of grep.
|
||||
test_expect_success "git-cl status dropped abandoned branch" \
|
||||
"$GIT_CL status | grep -q abandoned && exit 1 || exit 0"
|
||||
)
|
||||
|
||||
SUCCESS=$?
|
||||
|
||||
cleanup
|
||||
|
||||
if [ $SUCCESS == 0 ]; then
|
||||
echo PASS
|
||||
fi
|
@ -1,62 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
setup_initsvn
|
||||
setup_gitsvn
|
||||
|
||||
(
|
||||
set -e
|
||||
cd git-svn
|
||||
git checkout -q -b work
|
||||
echo "some work done on a branch" >> test
|
||||
git add test; git commit -q -m "branch work"
|
||||
echo "some other work done on a branch" >> test
|
||||
git add test; git commit -q -m "branch work"
|
||||
|
||||
test_expect_success "git-cl upload wants a server" \
|
||||
"$GIT_CL upload 2>&1 | grep -q 'You must configure'"
|
||||
|
||||
git config rietveld.server localhost:8080
|
||||
|
||||
test_expect_success "git-cl status has no issue" \
|
||||
"$GIT_CL status | grep -q 'no issue'"
|
||||
|
||||
# Prevent the editor from coming up when you upload.
|
||||
export EDITOR=/bin/true
|
||||
test_expect_success "upload succeeds (needs a server running on localhost)" \
|
||||
"$GIT_CL upload -m test master... | grep -q 'Issue created'"
|
||||
|
||||
test_expect_success "git-cl status now knows the issue" \
|
||||
"$GIT_CL status | grep -q 'Issue number'"
|
||||
|
||||
# Push a description to this URL.
|
||||
URL=$($GIT_CL status | sed -ne '/Issue number/s/[^(]*(\(.*\))/\1/p')
|
||||
curl --cookie dev_appserver_login="test@example.com:False" \
|
||||
--data-urlencode subject="test" \
|
||||
--data-urlencode description="foo-quux" \
|
||||
$URL/edit
|
||||
|
||||
test_expect_success "git-cl dcommits ok" \
|
||||
"$GIT_CL dcommit -f"
|
||||
|
||||
git checkout -q master
|
||||
git svn -q rebase >/dev/null 2>&1
|
||||
test_expect_success "dcommitted code has proper description" \
|
||||
"git show | grep -q 'foo-quux'"
|
||||
|
||||
test_expect_success "issue no longer has a branch" \
|
||||
"git cl status | grep -q 'work: None'"
|
||||
|
||||
test_expect_success "upstream svn has our commit" \
|
||||
"svn log $REPO_URL 2>/dev/null | grep -q 'foo-quux'"
|
||||
)
|
||||
SUCCESS=$?
|
||||
|
||||
cleanup
|
||||
|
||||
if [ $SUCCESS == 0 ]; then
|
||||
echo PASS
|
||||
fi
|
@ -1,50 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Abort on error.
|
||||
set -e
|
||||
|
||||
PWD=`pwd`
|
||||
REPO_URL=file://$PWD/svnrepo
|
||||
GIT_CL=$PWD/../git-cl
|
||||
|
||||
# Set up an SVN repo that has a few commits to trunk.
|
||||
setup_initsvn() {
|
||||
echo "Setting up test SVN repo..."
|
||||
rm -rf svnrepo
|
||||
svnadmin create svnrepo
|
||||
|
||||
rm -rf svn
|
||||
svn co -q $REPO_URL svn
|
||||
(
|
||||
cd svn
|
||||
echo "test" > test
|
||||
svn add -q test
|
||||
svn commit -q -m "initial commit"
|
||||
echo "test2" >> test
|
||||
svn commit -q -m "second commit"
|
||||
)
|
||||
}
|
||||
|
||||
# Set up a git-svn checkout of the repo.
|
||||
setup_gitsvn() {
|
||||
echo "Setting up test git-svn repo..."
|
||||
rm -rf git-svn
|
||||
# There appears to be no way to make git-svn completely shut up, so we
|
||||
# redirect its output.
|
||||
git svn -q clone $REPO_URL git-svn >/dev/null 2>&1
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
rm -rf svnrepo svn git-svn
|
||||
}
|
||||
|
||||
# Usage: test_expect_success "description of test" "test code".
|
||||
test_expect_success() {
|
||||
echo "TESTING: $1"
|
||||
exit_code=0
|
||||
sh -c "$2" || exit_code=$?
|
||||
if [ $exit_code != 0 ]; then
|
||||
echo "FAILURE: $1"
|
||||
return $exit_code
|
||||
fi
|
||||
}
|
Loading…
Reference in New Issue