Re: [PATCH v4] help.c: expand options for help.autocorrect

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

 



On Wed, Nov 18, 2020 at 10:15:31AM -0800, Junio C Hamano wrote:
> Also, I think we would want _some_ test, as the base form of
> help.autocorrect is already tested.  Perhaps something like this.
> 
>  t/t9003-help-autocorrect.sh | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git c/t/t9003-help-autocorrect.sh w/t/t9003-help-autocorrect.sh
> index b1c7919c4a..8f1035c3c2 100755
> --- c/t/t9003-help-autocorrect.sh
> +++ w/t/t9003-help-autocorrect.sh
> @@ -49,4 +49,17 @@ test_expect_success 'autocorrect running commands' '
>  	test_cmp expect actual
>  '
>  
> +test_expect_success 'autocorrect can be declined altogether' '
> +	git config help.autocorrect never &&
> +
> +	test_must_fail git lfg 2>actual &&
> +	if test_have_prereq C_LOCALE_OUTPUT
> +	then
> +		: cannot test with poisoned i18n
> +	else
> +		grep "is not a git command" actual &&
> +		test_line_count = 1 actual

The two branches of this condition are in the wrong order, as it
doesn't check the expected error message in normal mode, but it does
grep for the specific translated error message when run with
GIT_TEST_GETTEXT_POISON=1 which then fails the test.

I think we should simply use 'test_i18ngrep' instead of that whole
if-else block.  

I wonder what that 'test_line_count = 1' is supposed to check, and am
not sure that it's really necessary.  Anyway, the gettext poisoned
output should be a single line as well, so we can use that same check
both with and without C_LOCALE_OUTPUT.

> +	fi
> +'
> +
>  test_done



[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]

  Powered by Linux