[PATCH v2] tests: add initial bash completion tests

Subsystems: the rest

STALE3717d

13 messages, 3 authors, 2016-06-15 · open the first message on its own page

[PATCH v2] tests: add initial bash completion tests

From: Felipe Contreras <hidden>
Date: 2016-06-15 22:53:33

Signed-off-by: Felipe Contreras <redacted>
---

Since v1:

 * Check if we are running bash in posix mode
 * Don't check for all git porcelain commands

 t/t9902-completion.sh |  115 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 115 insertions(+)
 create mode 100755 t/t9902-completion.sh
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
new file mode 100755
index 0000000..cbda6b5
--- /dev/null
+++ b/t/t9902-completion.sh
@@ -0,0 +1,115 @@
+#!/bin/sh
+#
+# Copyright (c) 2012 Felipe Contreras
+#
+
+if test -n "$BASH" && test -z "$POSIXLY_CORRECT"; then
+	# we are in full-on bash mode
+	true
+elif type bash >/dev/null 2>&1; then
+	# execute in full-on bash mode
+	unset POSIXLY_CORRECT
+	exec bash "$0" "$@"
+else
+	echo '1..0 #SKIP skipping bash completion tests; bash not available'
+	exit 0
+fi
+
+test_description='test bash completion'
+
+. ./test-lib.sh
+
+complete ()
+{
+	# do nothing
+	return 0
+}
+
+. "$GIT_BUILD_DIR/contrib/completion/git-completion.bash"
+
+_get_comp_words_by_ref ()
+{
+	while [ $# -gt 0 ]; do
+		case "$1" in
+		cur)
+			cur=${_words[_cword]}
+			;;
+		prev)
+			prev=${_words[_cword-1]}
+			;;
+		words)
+			words=("${_words[@]}")
+			;;
+		cword)
+			cword=$_cword
+			;;
+		esac
+		shift
+	done
+}
+
+print_comp ()
+{
+	local IFS=$'\n'
+	echo "${COMPREPLY[*]}" > out
+}
+
+run_completion ()
+{
+	local -a COMPREPLY _words
+	local _cword
+	_words=( $1 )
+	(( _cword = ${#_words[@]} - 1 ))
+	_git && print_comp
+}
+
+test_completion ()
+{
+	test $# -gt 1 && echo "$2" > expected
+	run_completion "$@" &&
+	test_cmp expected out
+}
+
+test_expect_success 'basic' '
+	run_completion "git \"\"" &&
+	# built-in
+	grep -q "^add \$" out &&
+	# script
+	grep -q "^filter-branch \$" out &&
+	# plumbing
+	! grep -q "^ls-files \$" out
+
+	run_completion "git f" &&
+	! grep -q -v "^f" out
+'
+
+test_expect_success 'double dash' '
+	cat >expected <<-\EOF &&
+	--paginate 
+	--no-pager 
+	--git-dir=
+	--bare 
+	--version 
+	--exec-path 
+	--html-path 
+	--work-tree=
+	--namespace=
+	--help 
+	EOF
+	test_completion "git --"
+
+	cat >expected <<-\EOF &&
+	--quiet 
+	--ours 
+	--theirs 
+	--track 
+	--no-track 
+	--merge 
+	--conflict=
+	--orphan 
+	--patch 
+	EOF
+	test_completion "git checkout --"
+'
+
+test_done
-- 
1.7.10.1.g1f19b8.dirty

Re: [PATCH v2] tests: add initial bash completion tests

From: Felipe Contreras <hidden>
Date: 2016-06-15 22:53:34

On Thu, Apr 12, 2012 at 12:57 AM, Felipe Contreras
[off-list ref] wrote:
+test_expect_success 'double dash' '
+       cat >expected <<-\EOF &&
+       --paginate
+       --no-pager
+       --git-dir=
+       --bare
+       --version
+       --exec-path
+       --html-path
+       --work-tree=
+       --namespace=
+       --help
+       EOF
+       test_completion "git --"
There's a mistake here ^.
--- b/t/t9902-completion.sh
+++ a/t/t9902-completion.sh
@@ -96,7 +96,7 @@ test_expect_success 'double dash' '
        --namespace=
        --help Z
        EOF
-       test_completion "git --"
+       test_completion "git --" &&

        sed -e "s/Z$//" >expected <<-\EOF &&
        --quiet Z
-- 
Felipe Contreras

Re: [PATCH v2] tests: add initial bash completion tests

From: SZEDER Gábor <hidden>
Date: 2016-06-15 22:53:34

Hi,


On Thu, Apr 12, 2012 at 12:57:03AM +0300, Felipe Contreras wrote:
quoted hunk
Signed-off-by: Felipe Contreras <redacted>
---

Since v1:

 * Check if we are running bash in posix mode
 * Don't check for all git porcelain commands

 t/t9902-completion.sh |  115 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 115 insertions(+)
 create mode 100755 t/t9902-completion.sh
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
new file mode 100755
index 0000000..cbda6b5
--- /dev/null
+++ b/t/t9902-completion.sh
@@ -0,0 +1,115 @@
+#!/bin/sh
+#
+# Copyright (c) 2012 Felipe Contreras
+#
+
+if test -n "$BASH" && test -z "$POSIXLY_CORRECT"; then
+	# we are in full-on bash mode
+	true
+elif type bash >/dev/null 2>&1; then
+	# execute in full-on bash mode
+	unset POSIXLY_CORRECT
+	exec bash "$0" "$@"
+else
+	echo '1..0 #SKIP skipping bash completion tests; bash not available'
+	exit 0
+fi
+
+test_description='test bash completion'
+
+. ./test-lib.sh
+
+complete ()
+{
+	# do nothing
+	return 0
+}
+
+. "$GIT_BUILD_DIR/contrib/completion/git-completion.bash"
+
+_get_comp_words_by_ref ()
+{
+	while [ $# -gt 0 ]; do
+		case "$1" in
+		cur)
+			cur=${_words[_cword]}
+			;;
+		prev)
+			prev=${_words[_cword-1]}
+			;;
+		words)
+			words=("${_words[@]}")
+			;;
+		cword)
+			cword=$_cword
+			;;
+		esac
+		shift
+	done
+}
Git's completion script already implements this function.  Why
override it here?
+print_comp ()
+{
+	local IFS=$'\n'
+	echo "${COMPREPLY[*]}" > out
+}
+
+run_completion ()
+{
+	local -a COMPREPLY _words
+	local _cword
+	_words=( $1 )
+	(( _cword = ${#_words[@]} - 1 ))
+	_git && print_comp
+}
+
+test_completion ()
+{
+	test $# -gt 1 && echo "$2" > expected
+	run_completion "$@" &&
+	test_cmp expected out
+}
+
+test_expect_success 'basic' '
+	run_completion "git \"\"" &&
+	# built-in
+	grep -q "^add \$" out &&
+	# script
+	grep -q "^filter-branch \$" out &&
+	# plumbing
+	! grep -q "^ls-files \$" out
The && is missing here at the end of the line.
+	run_completion "git f" &&
+	! grep -q -v "^f" out
grep is not a git command, so I'm not sure, but shouldn't these use
'test_must_fail grep' instead of '! grep'?


Anyway, thanks for pushing this forward.  I have a bunch of tests for
my __git_ps1() optimizations, but, being a bash function, I could
never figure out how to integrate it with the test framework.


Best,
Gábor

Re: [PATCH v2] tests: add initial bash completion tests

From: SZEDER Gábor <hidden>
Date: 2016-06-15 22:53:34

On Fri, Apr 13, 2012 at 11:12:36AM +0200, SZEDER Gábor wrote:
On Thu, Apr 12, 2012 at 12:57:03AM +0300, Felipe Contreras wrote:
quoted
+. "$GIT_BUILD_DIR/contrib/completion/git-completion.bash"
+
+_get_comp_words_by_ref ()
+{
+	while [ $# -gt 0 ]; do
+		case "$1" in
+		cur)
+			cur=${_words[_cword]}
+			;;
+		prev)
+			prev=${_words[_cword-1]}
+			;;
+		words)
+			words=("${_words[@]}")
+			;;
+		cword)
+			cword=$_cword
+			;;
+		esac
+		shift
+	done
+}
Git's completion script already implements this function.  Why
override it here?
Ah, ok, I think I got it.

Of course, the words on the command line must be specified somehow to
test completion functions.  But the two implementations of
_get_comp_words_by_ref() for bash and zsh in the completion script
take the words on the command line from different variables, so we
need a common implementation to test completion functions both on bash
and zsh.  Hence the _get_comp_words_by_ref() above, which takes the
words on the command line and their count from $_words and $_cword,
respectively, and run_completion() below, which fills those variables
with its arguments.

quoted
+print_comp ()
+{
+	local IFS=$'\n'
+	echo "${COMPREPLY[*]}" > out
+}
+
+run_completion ()
+{
+	local -a COMPREPLY _words
+	local _cword
+	_words=( $1 )
+	(( _cword = ${#_words[@]} - 1 ))
+	_git && print_comp
+}

Re: [PATCH v2] tests: add initial bash completion tests

From: Felipe Contreras <hidden>
Date: 2016-06-15 22:53:34

2012/4/13 SZEDER Gábor [off-list ref]:
quoted
+test_expect_success 'basic' '
+     run_completion "git \"\"" &&
+     # built-in
+     grep -q "^add \$" out &&
+     # script
+     grep -q "^filter-branch \$" out &&
+     # plumbing
+     ! grep -q "^ls-files \$" out
The && is missing here at the end of the line.
Right.
quoted
+     run_completion "git f" &&
+     ! grep -q -v "^f" out
grep is not a git command, so I'm not sure, but shouldn't these use
'test_must_fail grep' instead of '! grep'?
I'm not sure. Junio has already queued this, maybe you should send a
patch on top of that.

Cheers.

-- 
Felipe Contreras

Re: [PATCH v2] tests: add initial bash completion tests

From: Felipe Contreras <hidden>
Date: 2016-06-15 22:53:34

2012/4/13 SZEDER Gábor [off-list ref]:
On Fri, Apr 13, 2012 at 11:12:36AM +0200, SZEDER Gábor wrote:
quoted
On Thu, Apr 12, 2012 at 12:57:03AM +0300, Felipe Contreras wrote:
quoted
+. "$GIT_BUILD_DIR/contrib/completion/git-completion.bash"
+
+_get_comp_words_by_ref ()
+{
+   while [ $# -gt 0 ]; do
+           case "$1" in
+           cur)
+                   cur=${_words[_cword]}
+                   ;;
+           prev)
+                   prev=${_words[_cword-1]}
+                   ;;
+           words)
+                   words=("${_words[@]}")
+                   ;;
+           cword)
+                   cword=$_cword
+                   ;;
+           esac
+           shift
+   done
+}
Git's completion script already implements this function.  Why
override it here?
Ah, ok, I think I got it.

Of course, the words on the command line must be specified somehow to
test completion functions.  But the two implementations of
_get_comp_words_by_ref() for bash and zsh in the completion script
take the words on the command line from different variables, so we
need a common implementation to test completion functions both on bash
and zsh.  Hence the _get_comp_words_by_ref() above, which takes the
words on the command line and their count from $_words and $_cword,
respectively, and run_completion() below, which fills those variables
with its arguments.
Well, yeah, that's one reason, but also I don't see the point in
trying to fill the internal bash completion variables, maybe there
would be some conflicts? Plus, the bash version of
_get_comp_words_by_ref is rather complicated, so I decided to start
with something simple that I could understand and see exactly what's
going on. And for zsh I would definitely prefer to override
_get_comp_words_by_ref than to mess with the internal variables,
although I haven't found a way to test completion for zsh.

Cheers.

-- 
Felipe Contreras

Re: [PATCH v2] tests: add initial bash completion tests

From: SZEDER Gábor <hidden>
Date: 2016-06-15 22:53:34

On Fri, Apr 13, 2012 at 01:34:46PM +0300, Felipe Contreras wrote:
quoted
quoted
+     run_completion "git f" &&
+     ! grep -q -v "^f" out
grep is not a git command, so I'm not sure, but shouldn't these use
'test_must_fail grep' instead of '! grep'?
I'm not sure. Junio has already queued this, maybe you should send a
patch on top of that.
It seems that both are used in the test suite, but '! grep' is more
common, so perhaps it's good as it is.

$ git grep '! grep' -- t |wc -l
136
$ git grep 'test_must_fail grep' -- t |wc -l
17

Re: [PATCH v2] tests: add initial bash completion tests

From: SZEDER Gábor <hidden>
Date: 2016-06-15 22:53:34

On Fri, Apr 13, 2012 at 01:48:51PM +0300, Felipe Contreras wrote:
2012/4/13 SZEDER Gábor [off-list ref]:
quoted
On Fri, Apr 13, 2012 at 11:12:36AM +0200, SZEDER Gábor wrote:
quoted
On Thu, Apr 12, 2012 at 12:57:03AM +0300, Felipe Contreras wrote:
quoted
+. "$GIT_BUILD_DIR/contrib/completion/git-completion.bash"
+
+_get_comp_words_by_ref ()
+{
+   while [ $# -gt 0 ]; do
+           case "$1" in
+           cur)
+                   cur=${_words[_cword]}
+                   ;;
+           prev)
+                   prev=${_words[_cword-1]}
+                   ;;
+           words)
+                   words=("${_words[@]}")
+                   ;;
+           cword)
+                   cword=$_cword
+                   ;;
+           esac
+           shift
+   done
+}
Git's completion script already implements this function.  Why
override it here?
Ah, ok, I think I got it.

Of course, the words on the command line must be specified somehow to
test completion functions.  But the two implementations of
_get_comp_words_by_ref() for bash and zsh in the completion script
take the words on the command line from different variables, so we
need a common implementation to test completion functions both on bash
and zsh.  Hence the _get_comp_words_by_ref() above, which takes the
words on the command line and their count from $_words and $_cword,
respectively, and run_completion() below, which fills those variables
with its arguments.
Well, yeah, that's one reason, but also I don't see the point in
trying to fill the internal bash completion variables, maybe there
would be some conflicts? Plus, the bash version of
_get_comp_words_by_ref is rather complicated, so I decided to start
with something simple that I could understand and see exactly what's
going on. And for zsh I would definitely prefer to override
_get_comp_words_by_ref than to mess with the internal variables,
although I haven't found a way to test completion for zsh.
The tests are run in a non-interactive shell, which by default doesn't
load bash completion with its complicated _get_comp_words_by_ref().
So these tests use _get_comp_words_by_ref() from git's completion
script.


Anyway, out of curiosity I quickly tried this on top of b8574ba7 (i.e.
your patch from today's pu):
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index 3bbec79b..6c1ea956 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -27,27 +27,6 @@ complete ()
 
 . "$GIT_BUILD_DIR/contrib/completion/git-completion.bash"
 
-_get_comp_words_by_ref ()
-{
-	while [ $# -gt 0 ]; do
-		case "$1" in
-		cur)
-			cur=${_words[_cword]}
-			;;
-		prev)
-			prev=${_words[_cword-1]}
-			;;
-		words)
-			words=("${_words[@]}")
-			;;
-		cword)
-			cword=$_cword
-			;;
-		esac
-		shift
-	done
-}
-
 print_comp ()
 {
 	local IFS=$'\n'
@@ -56,10 +35,10 @@ print_comp ()
 
 run_completion ()
 {
-	local -a COMPREPLY _words
-	local _cword
-	_words=( $1 )
-	(( _cword = ${#_words[@]} - 1 ))
+	local -a COMPREPLY COMP_WORDS
+	local COMP_CWORD
+	COMP_WORDS=( $1 )
+	(( COMP_CWORD = ${#COMP_WORDS[@]} - 1 ))
 	_git && print_comp
 }
i.e. to set COMP_WORDS and COMP_CWORD in run_completion() and it
worked.  However, I agree that it feels iffy to mess with a
shell-specific variable, and I'm afraid that this just happened to
work on my system, but it might be broken in previous or future bash
versions.


Best,
Gábor

Re: [PATCH v2] tests: add initial bash completion tests

From: Felipe Contreras <hidden>
Date: 2016-06-15 22:53:34

2012/4/13 SZEDER Gábor [off-list ref]:
i.e. to set COMP_WORDS and COMP_CWORD in run_completion() and it
worked.  However, I agree that it feels iffy to mess with a
shell-specific variable, and I'm afraid that this just happened to
work on my system, but it might be broken in previous or future bash
versions.
Yeah, we could explore that possibility later, as
_get_comp_words_by_ref is part of the completion, and should be tested
as well, otherwise we might be missing some bugs.

However, I wonder if _get_comp_words_by_ref is needed at all. From
what I can see it has to do with '--foo=bar' and 'foo:bar'
completions, which in fact don't work correctly in zsh (I have patches
for zsh to fix this though), but by modifying the code that checks for
'--*=*' stuff we might be able to get rid of it, or at least the call
to __git_reassemble_comp_words_by_ref. Right?

Cheers.

-- 
Felipe Contreras

Re: [PATCH v2] tests: add initial bash completion tests

From: SZEDER Gábor <hidden>
Date: 2016-06-15 22:53:36

Hi,


I picked up Stephen Boyd's two-patch series[1] to use parse-options to
generate options for git commands, and the following test promply
failed (taken from 5c293a6b (tests: add initial bash completion tests,
2012-04-12)):

test_expect_success 'double dash "git checkout"' '
        sed -e "s/Z$//" >expected <<-\EOF &&
        --quiet Z
        --ours Z
        --theirs Z
        --track Z
        --no-track Z
        --merge Z
        --conflict=
        --orphan Z
        --patch Z
        EOF
        test_completion "git checkout --"
'

Not surprising, the completion script doesn't know about many 'git
checkout' long options.  So whenever 'git checkout' learns a new long
option, this list must be updated.  This won't be more work than the
update of the completion script, so this is probably OK.

But it got me thinking about what do we actually want to test here?
Whether the completion script returns the right long options in a
specific order upon 'git checkout --<TAB>'?  Or whether _git() works
properly and invokes the right command-specific completion function?
Or whether regular options get a trailing space while options
expecting an argument don't?  Or is this sort of an integration test
and basically all of the above?


[1] - http://thread.gmane.org/gmane.comp.version-control.git/195158/focus=195158

Best,
Gábor

Re: [PATCH v2] tests: add initial bash completion tests

From: Felipe Contreras <hidden>
Date: 2016-06-15 22:53:36

On Tue, Apr 17, 2012 at 3:31 AM, SZEDER Gábor [off-list ref] wrote:
Hi,


I picked up Stephen Boyd's two-patch series[1] to use parse-options to
generate options for git commands, and the following test promply
failed (taken from 5c293a6b (tests: add initial bash completion tests,
2012-04-12)):

test_expect_success 'double dash "git checkout"' '
       sed -e "s/Z$//" >expected <<-\EOF &&
       --quiet Z
       --ours Z
       --theirs Z
       --track Z
       --no-track Z
       --merge Z
       --conflict=
       --orphan Z
       --patch Z
       EOF
       test_completion "git checkout --"
'

Not surprising, the completion script doesn't know about many 'git
checkout' long options.  So whenever 'git checkout' learns a new long
option, this list must be updated.  This won't be more work than the
update of the completion script, so this is probably OK.

But it got me thinking about what do we actually want to test here?
Whether the completion script returns the right long options in a
specific order upon 'git checkout --<TAB>'?  Or whether _git() works
properly and invokes the right command-specific completion function?
Or whether regular options get a trailing space while options
expecting an argument don't?  Or is this sort of an integration test
and basically all of the above?
I don't think the order is relevant, just that all the options are
there, and the ones with arguments have a = in there, and the ones
that don't, a space.

-- 
Felipe Contreras

Re: [PATCH v2] tests: add initial bash completion tests

From: SZEDER Gábor <hidden>
Date: 2016-06-15 22:53:37

On Tue, Apr 17, 2012 at 09:32:29AM +0300, Felipe Contreras wrote:
On Tue, Apr 17, 2012 at 3:31 AM, SZEDER Gábor [off-list ref] wrote:
quoted
Hi,


I picked up Stephen Boyd's two-patch series[1] to use parse-options to
generate options for git commands, and the following test promply
failed (taken from 5c293a6b (tests: add initial bash completion tests,
2012-04-12)):

test_expect_success 'double dash "git checkout"' '
       sed -e "s/Z$//" >expected <<-\EOF &&
       --quiet Z
       --ours Z
       --theirs Z
       --track Z
       --no-track Z
       --merge Z
       --conflict=
       --orphan Z
       --patch Z
       EOF
       test_completion "git checkout --"
'

Not surprising, the completion script doesn't know about many 'git
checkout' long options.  So whenever 'git checkout' learns a new long
option, this list must be updated.  This won't be more work than the
update of the completion script, so this is probably OK.

But it got me thinking about what do we actually want to test here?
Whether the completion script returns the right long options in a
specific order upon 'git checkout --<TAB>'?  Or whether _git() works
properly and invokes the right command-specific completion function?
Or whether regular options get a trailing space while options
expecting an argument don't?  Or is this sort of an integration test
and basically all of the above?
I don't think the order is relevant, just that all the options are
there, 
The order of options is not relevant in the completion script, because
Bash will sort them alphabetically anyway.  But it is relevant in the
test: it fails if the order is changed either in the completion script
or in the test.
and the ones with arguments have a = in there, and the ones
that don't, a space.
Couldn't we check that better with a test or two for __gitcomp()?

If a test for __gitcomp() fails, we would immediately have a fairly
good idea where to look for the cause of the breakage.  However, if
this 'double dash "git checkout"' test fails, there are a bunch of
other things that can possibly cause the failure.

Patch comes in a minute.

Best,
Gábor

[PATCH] tests: add tests for the __gitcomp() completion helper function

From: SZEDER Gábor <hidden>
Date: 2016-06-15 22:53:37

These tests check that trailing space, prefix, and suffix are added
correctly.

Signed-off-by: SZEDER Gábor <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help