git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t7406: fix i18n expectation of error message

From
Johannes Sixt <j6t@kdbg.org>
Date
May 5, 2017, 22:43 UTC
Message-ID
<4a2318e6-b0c5-5061-15e4-af11b576c079@kdbg.org>
In-Reply-To
<CACBZZX6ZzrJk77ReJ592rJrNR1xhVCQid6_5KTonwTot5eq-hQ@mail.gmail.com>
Am 05.05.2017 um 19:50 schrieb Ævar Arnfjörð Bjarmason:
Show 53 quoted lines
> On Fri, May 5, 2017 at 7:38 PM, Stefan Beller <sbeller@google.com> wrote:
>> The error message from "submodule update" is internationalized, which
>> makes sense. The test however did not check for the translated version,
>> but used a hardcoded string, which breaks the test when run with
>> GETTEXT_POISON.
>>
>> Signed-off-by: Stefan Beller <sbeller@google.com>
>> ---
>>  t/t7406-submodule-update.sh | 6 ++----
>>  1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
>> index 4ac386d98b..12f6435ab0 100755
>> --- a/t/t7406-submodule-update.sh
>> +++ b/t/t7406-submodule-update.sh
>> @@ -441,13 +441,11 @@ test_expect_success 'submodule update - command in .git/config catches failure -
>>         test_i18ncmp actual expect
>>  '
>>
>> +sq="'"
>>  test_expect_success 'submodule update - command run for initial population of submodule' '
>> -       cat >expect <<-EOF &&
>> -       Execution of '\''false $submodulesha1'\'' failed in submodule path '\''submodule'\''
>> -       EOF
>>         rm -rf super/submodule &&
>>         test_must_fail git -C super submodule update 2>actual &&
>> -       test_cmp expect actual &&
>> +       test_i18ngrep "Execution of ${sq}false $submodulesha1${sq} failed in submodule path ${sq}submodule${sq}" actual &&
>>         git -C super submodule update --checkout
>>  '
>
> I have a fix for this in my gettext fixup series (so far lingering on
> the list, not in pu):
> https://public-inbox.org/git/20170421185757.28978-1-avarab@gmail.com/
>
> The diff is quite a bit smaller than yours:
>
> diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
> index 4ac386d98b..034914a14f 100755
> --- a/t/t7406-submodule-update.sh
> +++ b/t/t7406-submodule-update.sh
> @@ -447,7 +447,7 @@ test_expect_success 'submodule update - command
> run for initial population of su
>         EOF
>         rm -rf super/submodule &&
>         test_must_fail git -C super submodule update 2>actual &&
> -       test_cmp expect actual &&
> +       test_i18ncmp expect actual &&
>         git -C super submodule update --checkout
>  '
>
> Do you prefer to use i18ngrep for whatever reason? Seems better to use
> i18ncmp there.

With grep, you can focus on the important parts. Programs on different platforms or in different environments sometimes poison stderr with unexpected stuff (we've observed this recently with the nd/fopen-errors series, also sh -x output can end up in the >2 destination).

Also, grep allows to write

test_i18ngrep "Execution of .false.* failed in submodule path .submodule." actual

Note the lack of ugly single-quote hacks and volatile object names.
-- Hannes
Previous: Stefan BellerNext: Ævar Arnfjörð Bjarmason
Message 9 of 11 in “run GETTEXT_POISON on TravisCI”
  1. 0/2 run GETTEXT_POISON on TravisCILars Schneider, May 5, 2017
  2. 1/2 travis-ci: setup "prove cache" in "script" stepLars Schneider, May 5, 2017
  3. Ævar Arnfjörð BjarmasonMay 5, 2017
  4. 2/2 travis-ci: add job to run tests with GETTEXT_POISONLars Schneider, May 5, 2017
  5. Jonathan NiederMay 5, 2017
  6. t7406: fix i18n expectation of error messageStefan Beller, May 5, 2017
  7. Ævar Arnfjörð BjarmasonMay 5, 2017
  8. Stefan BellerMay 5, 2017
  9. Johannes SixtMay 5, 2017
  10. tests: fix tests broken under GETTEXT_POISON=YesPleaseÆvar Arnfjörð Bjarmason, May 5, 2017
  11. Junio C HamanoMay 8, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.