From: "SZEDER Gábor" <szeder@ira.uka.de>
To: git@vger.kernel.org
Cc: "Felipe Contreras" <felipe.contreras@gmail.com>,
"Jonathan Nieder" <jrnieder@gmail.com>,
"Junio C Hamano" <gitster@pobox.com>,
"Thomas Rast" <trast@student.ethz.ch>,
"Jeff King" <peff@peff.net>, "SZEDER Gábor" <szeder@ira.uka.de>
Subject: [PATCH] tests: add tests for the __gitcomp() completion helper function
Date: Tue, 17 Apr 2012 12:27:15 +0200 [thread overview]
Message-ID: <1334658435-30769-1-git-send-email-szeder@ira.uka.de> (raw)
In-Reply-To: <20120417102215.GA22778@goldbirke>
These tests check that trailing space, prefix, and suffix are added
correctly.
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
t/t9902-completion.sh | 85 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 85 insertions(+)
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index cc127320..5bda6b6e 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -73,6 +73,91 @@ test_completion ()
test_cmp expected out
}
+newline=$'\n'
+
+test_expect_success '__gitcomp - trailing space - options' '
+ sed -e "s/Z$//" >expected <<-\EOF &&
+ --reuse-message=Z
+ --reedit-message=Z
+ --reset-author Z
+ EOF
+ (
+ local -a COMPREPLY &&
+ cur="--re" &&
+ __gitcomp "--dry-run --reuse-message= --reedit-message=
+ --reset-author" &&
+ IFS="$newline" &&
+ echo "${COMPREPLY[*]}" > out
+ ) &&
+ test_cmp expected out
+'
+
+test_expect_success '__gitcomp - trailing space - config keys' '
+ sed -e "s/Z$//" >expected <<-\EOF &&
+ branch.Z
+ branch.autosetupmerge Z
+ branch.autosetuprebase Z
+ browser.Z
+ EOF
+ (
+ local -a COMPREPLY &&
+ cur="br" &&
+ __gitcomp "branch. branch.autosetupmerge
+ branch.autosetuprebase browser." &&
+ IFS="$newline" &&
+ echo "${COMPREPLY[*]}" > out
+ ) &&
+ test_cmp expected out
+'
+
+test_expect_success '__gitcomp - option parameter' '
+ sed -e "s/Z$//" >expected <<-\EOF &&
+ recursive Z
+ resolve Z
+ EOF
+ (
+ local -a COMPREPLY &&
+ cur="--strategy=re" &&
+ __gitcomp "octopus ours recursive resolve subtree
+ " "" "re" &&
+ IFS="$newline" &&
+ echo "${COMPREPLY[*]}" > out
+ ) &&
+ test_cmp expected out
+'
+
+test_expect_success '__gitcomp - prefix' '
+ sed -e "s/Z$//" >expected <<-\EOF &&
+ branch.maint.merge Z
+ branch.maint.mergeoptions Z
+ EOF
+ (
+ local -a COMPREPLY &&
+ cur="branch.me" &&
+ __gitcomp "remote merge mergeoptions rebase
+ " "branch.maint." "me" &&
+ IFS="$newline" &&
+ echo "${COMPREPLY[*]}" > out
+ ) &&
+ test_cmp expected out
+'
+
+test_expect_success '__gitcomp - suffix' '
+ sed -e "s/Z$//" >expected <<-\EOF &&
+ branch.master.Z
+ branch.maint.Z
+ EOF
+ (
+ local -a COMPREPLY &&
+ cur="branch.me" &&
+ __gitcomp "master maint next pu
+ " "branch." "ma" "." &&
+ IFS="$newline" &&
+ echo "${COMPREPLY[*]}" > out
+ ) &&
+ test_cmp expected out
+'
+
test_expect_success 'basic' '
run_completion "git \"\"" &&
# built-in
--
1.7.10.216.gb52c0
prev parent reply other threads:[~2012-04-17 10:27 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-11 21:57 [PATCH v2] tests: add initial bash completion tests Felipe Contreras
2012-04-11 23:48 ` Junio C Hamano
2012-04-12 16:15 ` Felipe Contreras
2012-04-12 17:43 ` Junio C Hamano
2012-04-12 23:18 ` Felipe Contreras
2012-04-12 23:26 ` Junio C Hamano
2012-04-13 19:45 ` Junio C Hamano
2012-04-13 9:12 ` SZEDER Gábor
2012-04-13 9:45 ` SZEDER Gábor
2012-04-13 10:48 ` Felipe Contreras
2012-04-13 11:14 ` SZEDER Gábor
2012-04-13 11:56 ` Felipe Contreras
2012-04-13 10:34 ` Felipe Contreras
2012-04-13 10:52 ` SZEDER Gábor
2012-04-13 11:33 ` Thomas Rast
2012-04-13 19:48 ` Junio C Hamano
2012-04-14 2:06 ` Felipe Contreras
2012-04-17 0:31 ` SZEDER Gábor
2012-04-17 6:32 ` Felipe Contreras
2012-04-17 10:22 ` SZEDER Gábor
2012-04-17 10:27 ` SZEDER Gábor [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1334658435-30769-1-git-send-email-szeder@ira.uka.de \
--to=szeder@ira.uka.de \
--cc=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=peff@peff.net \
--cc=trast@student.ethz.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).