Am 05.05.2017 um 19:50 schrieb Ævar Arnfjörð Bjarmason:
On Fri, May 5, 2017 at 7:38 PM, Stefan Beller <sbeller@xxxxxxxxxx> 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@xxxxxxxxxx>
---
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@xxxxxxxxx/
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