[PATCHv2 1/4] git submodule: Add test cases for git submodule add
- From
Michael J Gruber <git@drmicha.warpmail.net>
- Date
- Feb 25, 2009, 13:26 UTC
- Message-ID
- <1235568392-19705-2-git-send-email-git@drmicha.warpmail.net>
- In-Reply-To
- <1235568392-19705-1-git-send-email-git@drmicha.warpmail.net>
Add two simple test cases for adding and initialising submodules. The init step is necessary in order to verify the added information.
The second test exposes a known breakage due to './' in the path: git ls-files simplifies the path but git add does not, which leads to git init looking for different lines in .gitmodules than git add adds.
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> --- Note: Tests for add and init are somewhat interdependent in the sense that you need either in order to test success for the other. I put the add tests first because you need to add a submodule before you can init it.
t/t7400-submodule-basic.sh | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index b8cb2df..b154050 100755 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@ -47,6 +47,25 @@ test_expect_success 'Prepare submodule testing' ' GIT_CONFIG=.gitmodules git config submodule.example.url git://example.com/init.git ' +test_expect_success 'Prepare submodule add testing' ' + submodurl=$(pwd) + mkdir addtest && + pushd addtest && + git init +' + +test_expect_success 'submodule add' ' + git submodule add "$submodurl" submod && + git submodule init +' + +test_expect_failure 'submodule add with ./ in path' ' + git submodule add "$submodurl" ././dotsubmod/./frotz/./ && + git submodule init +' +# end of submodule add testing +popd >/dev/null + test_expect_success 'status should fail for unmapped paths' ' if git submodule status then
-- 1.6.2.rc1.30.gd43c