Re: [PATCH 01/12] tests: add initial bash completion tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(dropping Shawn from cc list since he hasn't been working on the
 completion script for a couple of years now)
Jeff King wrote:
> On Sun, Apr 08, 2012 at 06:07:48AM +0300, Felipe Contreras wrote:

>> +	cat >expected <<-\EOF &&
>> +	fetch 
>> +	filter-branch 
>> +	filter-branch.sh 
>> +	format-patch 
>> +	fsck 
>> +	EOF
>> +	test_completion "git f"
>
> This test fails for me. The problem is that I have other git-f* programs
> in my PATH
[...]
>                                     We can't just sanitize the PATH in
> test-lib.sh, since those git programs might be in /usr/bin or some other
> directory containing other commands necessary to run the test suite. We
> could sanitize it temporarily just for the _git completion invocation,
> which consists only of builtins (and we know we're running under bash,
> so we can trust that things like "test" are builtins). But it still
> feels horribly hacky.

Not to mention that it would break the TEST_INSTALLED_GIT facility.

Is there some reason we care about the exact list of completions for
"git f"?  The above also looks a little bogus because if someone were
to remove the +x bit on the git-filter-branch.sh source file or ensure
it is not on the PATH when tests are run (I have no particular opinion
about whether that's a good idea; it's just an example) then this
would change the actual output.  That doesn't seem particularly
important to check for when talking about how the tab completion
behaves on the installed system.

Maybe it would make sense to check a few representative items.

	# builtin
	grep "^fetch\$" out &&

	# builtin whose implementation is not in builtin/cmd.c
	grep "^format-patch\$" out &&

	# script
	grep "^filter-branch\$" out &&

	# plumbing
	! grep "^fsck-objects\$" out &&

	sort out >out.sorted &&
	test_cmp out.sorted out
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]