diff options
author | Jeff King <peff@peff.net> | 2012-09-26 17:47:51 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-09-27 17:25:48 -0700 |
commit | 49ba92b4eaca44ee4d7444b2256d60c2f32268ee (patch) | |
tree | 46eeaf596219e291be6521503e9319fbd0c5f281 /t | |
parent | Revert "completion: fix shell expansion of items" (diff) | |
download | tgif-49ba92b4eaca44ee4d7444b2256d60c2f32268ee.tar.xz |
t9902: add a few basic completion tests
We were not testing ref or tree completion at all. Let's
give them even basic sanity checks to avoid regressions.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t9902-completion.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 92d7eb47c2..2fc833ad8b 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -61,6 +61,15 @@ test_completion () test_cmp expected out } +# Like test_completion, but reads expectation from stdin, +# which is convenient when it is multiline. We also process "_" into +# spaces to make test vectors more readable. +test_completion_long () +{ + tr _ " " >expected && + test_completion "$1" +} + newline=$'\n' test_expect_success '__gitcomp - trailing space - options' ' @@ -228,4 +237,36 @@ test_expect_success 'general options plus command' ' test_completion "git --no-replace-objects check" "checkout " ' +test_expect_success 'setup for ref completion' ' + echo content >file1 && + echo more >file2 && + git add . && + git commit -m one && + git branch mybranch && + git tag mytag +' + +test_expect_success 'checkout completes ref names' ' + test_completion_long "git checkout m" <<-\EOF + master_ + mybranch_ + mytag_ + EOF +' + +test_expect_success 'show completes all refs' ' + test_completion_long "git show m" <<-\EOF + master_ + mybranch_ + mytag_ + EOF +' + +test_expect_success '<ref>: completes paths' ' + test_completion_long "git show mytag:f" <<-\EOF + file1_ + file2_ + EOF +' + test_done |