Re: [PATCH v2 18/22] tests: use test_i18n* functions to suppress false positives
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 27, 2016, 19:51 UTC
- Message-ID
- <xmqq37p3qnyt.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <5748A13A.6070608@sapo.pt>
Vasco Almeida <vascomalmeida@sapo.pt> writes:
Show 31 quoted lines
> Às 17:08 de 27-05-2016, Junio C Hamano escreveu:
>> Vasco Almeida <vascomalmeida@sapo.pt> writes:
>>
>>> diff --git a/t/t1307-config-blob.sh b/t/t1307-config-blob.sh
>>> index 3c6791e..4079fef 100755
>>> --- a/t/t1307-config-blob.sh
>>> +++ b/t/t1307-config-blob.sh
>>> @@ -64,7 +64,7 @@ test_expect_success 'parse errors in blobs are properly attributed' '
>>>
>>> # just grep for our token as the exact error message is likely to
>>> # change or be internationalized
>>> - grep "HEAD:config" err
>>> + test_i18ngrep "HEAD:config" err
>>> '
>>
>> It is unfortunate that the gettext-poison mechanism is too dumb to
>> notice that it is clobbering a format string with placeholders and
>> leave them intact, which is what the comment above this change is
>> wishing for. I do not think we will be granting that wish any time
>> soon, so perhaps remove the two lines while we are at it?
>>
> Yes, that was more or less what I thought when read that comment, but
> forgot about it after.
> I'll remove that comment in the next re-roll. Also, because it can be
> deceiving for someone not entirely sure how does gettext poison,
> translations and tests work together when test are run.
>
> For the record, test are run under C locale, so translations don't
> matter in tests. Under GETTEXT_POISON build, all strings interpolated by
> gettext (for instance _("a message from git") in C language) are
> replaced by garbage string "# GETTEXT POISON #".Yes, for the record (as I know you know I know you know this), if we ever granted the wish the comment expressed, we do not have to use test_i18ngrep but instead can use grep, following the reasoning in the comment "Even when running under poison locale, we must have HEAD:config in the output".
It is unfortunate that poison locale is not that smart. If it were, we can lose a lot of test_i18ngrep, not only from here.