git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Drew DeVault <sir@cmpwn.com>,
	git@vger.kernel.org, lanodan <contact+git@hacktivis.me>
Subject: Re: [PATCH v4] help.c: expand options for help.autocorrect
Date: Wed, 25 Nov 2020 19:33:09 +0100	[thread overview]
Message-ID: <20201125183309.GF8396@szeder.dev> (raw)
In-Reply-To: <xmqqwnyi1qgs.fsf@gitster.c.googlers.com>

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

  reply	other threads:[~2020-11-25 18:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18 17:28 [PATCH v4] help.c: expand options for help.autocorrect Drew DeVault
2020-11-18 18:02 ` Junio C Hamano
2020-11-18 18:15   ` Junio C Hamano
2020-11-25 18:33     ` SZEDER Gábor [this message]
2020-11-25 20:49       ` Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201125183309.GF8396@szeder.dev \
    --to=szeder.dev@gmail.com \
    --cc=contact+git@hacktivis.me \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sir@cmpwn.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).