From: Felipe Contreras Date: Mon, 07 May 2012 01:23:16 GMT Subject: [RFC/PATCH v4 2/6] tests: add more bash completion tests Message-ID: <1336353800-17323-3-git-send-email-felipe.contreras@gmail.com> In-Reply-To: <1336353800-17323-1-git-send-email-felipe.contreras@gmail.com> These tests try to excercise code that deals with 'words' and 'cword'. Signed-off-by: Felipe Contreras --- t/t9902-completion.sh | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 331a5b9..bb66848 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -158,6 +158,22 @@ test_expect_success '__gitcomp - suffix' ' test_cmp expected out ' +setup_repository () +{ + mkdir "$1" && ( + cd "$1" && + git init && + test_tick && + git commit --allow-empty -m "Initial" + ) +} + +test_expect_success 'prepare' ' + setup_repository one && + git clone one test && + cd test +' + test_expect_success 'basic' ' run_completion "git \"\"" && # built-in @@ -240,4 +256,43 @@ test_expect_success 'general options plus command' ' test_completion "git --no-replace-objects check" "checkout " ' +test_expect_success 'remote or refspec' ' + test_completion "git fetch o" "origin " && + test_completion "git fetch origin m" "master:master " && + test_completion "git pull o" "origin " && + test_completion "git pull origin m" "master " && + test_completion "git push o" "origin " && + test_completion "git push origin m" "master " +' + +test_expect_success 'subcomands' ' + test_completion "git bisect st" "start " +' + +test_expect_success 'has double dash' ' + test_completion "git add -- foo" "" +' + +test_expect_success 'config' ' + git config --file=foo color.ui auto && + test_completion "git config --file=foo --get c" "color.ui " +' + +test_expect_success 'other' ' + cat >expected <<-\EOF && + origin/HEAD + origin/master + EOF + test_completion "git branch -r o" && + test_completion "git bundle cr" "create " && + + echo foobar > tags && + test_completion "git grep f" "foobar " && + + test_completion "git notes --ref m" "master " && + + git tag v0.1 && + test_completion "git tag -d v" "v0.1 " +' + test_done -- 1.7.10