tests: fix tests broken under GETTEXT_POISON=YesPlease

The GETTEXT_POISON=YesPlease compile-time testing option added in my bb946bba76 ("i18n: add GETTEXT_POISON to simulate unfriendly translator", 2011-02-22) has been slowly bitrotting as strings have been marked for translation, and new tests have been added without running it. I brought this up on the list ("[BUG] test suite broken with GETTEXT_POISON=YesPlease", [1]) asking whether this mode was useful at all anymore. At least one person occasionally uses it, and Lars Schneider offered to change one of the the Travis builds to run in this mode, so fix up the failing ones. My test setup runs most of the tests, with the notable exception of skipping all the p4 tests, so it's possible that there's still some lurking regressions I haven't fixed. 1. <CACBZZX62+acvi1dpkknadTL827mtCm_QesGSZ=6+UnyeMpg8+Q@mail.gmail.com> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed May 5, 2017 at 18:19 UTC 0d75bfe67bfd7538c0188f862fb4770f09620b8d
15 files changed +38 -34
t/t0027-auto-crlf.sh
+1 -1
@@ -75,7 +75,7 @@ check_warning () {
75 *) echo >&2 "Illegal 1": "$1" ; return false ;;
76 esac
77 grep "will be replaced by" "$2" | sed -e "s/\(.*\) in [^ ]*$/\1/" | uniq >"$2".actual
78 - test_cmp "$2".expect "$2".actual
78 + test_i18ncmp "$2".expect "$2".actual
79 }
80
81 commit_check_warn () {
t/t1309-early-config.sh
+1 -1
@@ -77,7 +77,7 @@ test_with_config () {
77
78 test_expect_success 'ignore .git/ with incompatible repository version' '
79 test_with_config "[core]repositoryformatversion = 999999" 2>err &&
80 - grep "warning:.* Expected git repo version <= [1-9]" err
80 + test_i18ngrep "warning:.* Expected git repo version <= [1-9]" err
81 '
82
83 test_expect_failure 'ignore .git/ with invalid repository version' '
t/t1430-bad-ref-name.sh
+1 -1
@@ -122,7 +122,7 @@ test_expect_success 'push cannot create a badly named ref' '
122 ! grep -e "broken\.\.\.ref" output
123 '
124
125 -test_expect_failure 'push --mirror can delete badly named ref' '
125 +test_expect_failure C_LOCALE_OUTPUT 'push --mirror can delete badly named ref' '
126 top=$(pwd) &&
127 git init src &&
128 git init dest &&
t/t3203-branch-output.sh
+1 -1
@@ -236,7 +236,7 @@ test_expect_success 'git branch --format option' '
236 Refname is refs/heads/ref-to-remote
237 EOF
238 git branch --format="Refname is %(refname)" >actual &&
239 - test_cmp expect actual
239 + test_i18ncmp expect actual
240 '
241
242 test_done
t/t3404-rebase-interactive.sh
+7 -7
@@ -366,7 +366,7 @@ test_expect_success 'verbose flag is heeded, even after --continue' '
366 grep "^ file1 | 2 +-$" output
367 '
368
369 -test_expect_success 'multi-squash only fires up editor once' '
369 +test_expect_success C_LOCALE_OUTPUT 'multi-squash only fires up editor once' '
370 base=$(git rev-parse HEAD~4) &&
371 set_fake_editor &&
372 FAKE_COMMIT_AMEND="ONCE" FAKE_LINES="1 squash 2 squash 3 squash 4" \
@@ -376,7 +376,7 @@ test_expect_success 'multi-squash only fires up editor once' '
376 test 1 = $(git show | grep ONCE | wc -l)
377 '
378
379 -test_expect_success 'multi-fixup does not fire up editor' '
379 +test_expect_success C_LOCALE_OUTPUT 'multi-fixup does not fire up editor' '
380 git checkout -b multi-fixup E &&
381 base=$(git rev-parse HEAD~4) &&
382 set_fake_editor &&
@@ -426,7 +426,7 @@ D
426 ONCE
427 EOF
428
429 -test_expect_success 'squash and fixup generate correct log messages' '
429 +test_expect_success C_LOCALE_OUTPUT 'squash and fixup generate correct log messages' '
430 git checkout -b squash-fixup E &&
431 base=$(git rev-parse HEAD~4) &&
432 set_fake_editor &&
@@ -439,7 +439,7 @@ test_expect_success 'squash and fixup generate correct log messages' '
439 git branch -D squash-fixup
440 '
441
442 -test_expect_success 'squash ignores comments' '
442 +test_expect_success C_LOCALE_OUTPUT 'squash ignores comments' '
443 git checkout -b skip-comments E &&
444 base=$(git rev-parse HEAD~4) &&
445 set_fake_editor &&
@@ -452,7 +452,7 @@ test_expect_success 'squash ignores comments' '
452 git branch -D skip-comments
453 '
454
455 -test_expect_success 'squash ignores blank lines' '
455 +test_expect_success C_LOCALE_OUTPUT 'squash ignores blank lines' '
456 git checkout -b skip-blank-lines E &&
457 base=$(git rev-parse HEAD~4) &&
458 set_fake_editor &&
@@ -860,7 +860,7 @@ test_expect_success 'rebase -ix with several instances of --exec' '
860 test_cmp expected actual
861 '
862
863 -test_expect_success 'rebase -ix with --autosquash' '
863 +test_expect_success C_LOCALE_OUTPUT 'rebase -ix with --autosquash' '
864 git reset --hard execute &&
865 git checkout -b autosquash &&
866 echo second >second.txt &&
@@ -943,7 +943,7 @@ test_expect_success 'rebase -i --root fixup root commit' '
943 test 0 = $(git cat-file commit HEAD | grep -c ^parent\ )
944 '
945
946 -test_expect_success 'rebase --edit-todo does not works on non-interactive rebase' '
946 +test_expect_success C_LOCALE_OUTPUT 'rebase --edit-todo does not work on non-interactive rebase' '
947 git reset --hard &&
948 git checkout conflict-branch &&
949 set_fake_editor &&
t/t3415-rebase-autosquash.sh
+5 -5
@@ -234,23 +234,23 @@ test_auto_fixup_fixup () {
234 fi
235 }
236
237 -test_expect_success 'fixup! fixup!' '
237 +test_expect_success C_LOCALE_OUTPUT 'fixup! fixup!' '
238 test_auto_fixup_fixup fixup fixup
239 '
240
241 -test_expect_success 'fixup! squash!' '
241 +test_expect_success C_LOCALE_OUTPUT 'fixup! squash!' '
242 test_auto_fixup_fixup fixup squash
243 '
244
245 -test_expect_success 'squash! squash!' '
245 +test_expect_success C_LOCALE_OUTPUT 'squash! squash!' '
246 test_auto_fixup_fixup squash squash
247 '
248
249 -test_expect_success 'squash! fixup!' '
249 +test_expect_success C_LOCALE_OUTPUT 'squash! fixup!' '
250 test_auto_fixup_fixup squash fixup
251 '
252
253 -test_expect_success 'autosquash with custom inst format' '
253 +test_expect_success C_LOCALE_OUTPUT 'autosquash with custom inst format' '
254 git reset --hard base &&
255 git config --add rebase.instructionFormat "[%an @ %ar] %s" &&
256 echo 2 >file1 &&
t/t3903-stash.sh
+2 -2
@@ -865,7 +865,7 @@ test_expect_success 'stash push -p with pathspec shows no changes only once' '
865 git stash push -p foo >actual &&
866 echo "No local changes to save" >expect &&
867 git reset --hard HEAD~ &&
868 - test_cmp expect actual
868 + test_i18ncmp expect actual
869 '
870
871 test_expect_success 'stash push with pathspec shows no changes when there are none' '
@@ -875,7 +875,7 @@ test_expect_success 'stash push with pathspec shows no changes when there are no
875 git stash push foo >actual &&
876 echo "No local changes to save" >expect &&
877 git reset --hard HEAD~ &&
878 - test_cmp expect actual
878 + test_i18ncmp expect actual
879 '
880
881 test_expect_success 'stash push with pathspec not in the repository errors out' '
t/t4205-log-pretty-formats.sh
+2 -2
@@ -126,12 +126,12 @@ test_expect_success 'NUL separation with --stat' '
126 test_i18ncmp expected actual
127 '
128
129 -test_expect_failure 'NUL termination with --stat' '
129 +test_expect_failure C_LOCALE_OUTPUT 'NUL termination with --stat' '
130 stat0_part=$(git diff --stat HEAD^ HEAD) &&
131 stat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&
132 printf "add bar\n$stat0_part\n\0$(commit_msg)\n$stat1_part\n0" >expected &&
133 git log -z --stat --pretty="tformat:%s" >actual &&
134 - test_i18ncmp expected actual
134 + test_cmp expected actual
135 '
136
137 test_expect_success 'setup more commits' '
t/t5316-pack-delta-depth.sh
+6 -2
@@ -82,12 +82,16 @@ test_expect_success 'packing produces a long delta' '
82 # Use --window=0 to make sure we are seeing reused deltas,
83 # not computing a new long chain.
84 pack=$(git pack-objects --all --window=0 </dev/null pack) &&
85 - test 9 = "$(max_chain pack-$pack.pack)"
85 + echo 9 >expect &&
86 + max_chain pack-$pack.pack >actual &&
87 + test_i18ncmp expect actual
88 '
89
90 test_expect_success '--depth limits depth' '
91 pack=$(git pack-objects --all --depth=5 </dev/null pack) &&
90 - test 5 = "$(max_chain pack-$pack.pack)"
92 + echo 5 >expect &&
93 + max_chain pack-$pack.pack >actual &&
94 + test_i18ncmp expect actual
95 '
96
97 test_done
t/t6134-pathspec-in-submodule.sh
+2 -2
@@ -21,7 +21,7 @@ EOF
21 test_expect_success 'error message for path inside submodule' '
22 echo a >sub/a &&
23 test_must_fail git add sub/a 2>actual &&
24 - test_cmp expect actual
24 + test_i18ncmp expect actual
25 '
26
27 cat <<EOF >expect
@@ -30,7 +30,7 @@ EOF
30
31 test_expect_success 'error message for path inside submodule from within submodule' '
32 test_must_fail git -C sub add . 2>actual &&
33 - test_cmp expect actual
33 + test_i18ncmp expect actual
34 '
35
36 test_done
t/t7004-tag.sh
+2 -2
@@ -87,7 +87,7 @@ test_expect_success 'creating a tag with --create-reflog should create reflog' '
87 git tag --create-reflog tag_with_reflog &&
88 git reflog exists refs/tags/tag_with_reflog &&
89 sed -e "s/^.* //" .git/logs/refs/tags/tag_with_reflog >actual &&
90 - test_cmp expected actual
90 + test_i18ncmp expected actual
91 '
92
93 test_expect_success 'annotated tag with --create-reflog has correct message' '
@@ -98,7 +98,7 @@ test_expect_success 'annotated tag with --create-reflog has correct message' '
98 git tag -m "annotated tag" --create-reflog tag_with_reflog &&
99 git reflog exists refs/tags/tag_with_reflog &&
100 sed -e "s/^.* //" .git/logs/refs/tags/tag_with_reflog >actual &&
101 - test_cmp expected actual
101 + test_i18ncmp expected actual
102 '
103
104 test_expect_success '--create-reflog does not create reflog on failure' '
t/t7406-submodule-update.sh
+1 -1
@@ -447,7 +447,7 @@ test_expect_success 'submodule update - command run for initial population of su
447 EOF
448 rm -rf super/submodule &&
449 test_must_fail git -C super submodule update 2>actual &&
450 - test_cmp expect actual &&
450 + test_i18ncmp expect actual &&
451 git -C super submodule update --checkout
452 '
453
t/t7508-status.sh
+3 -3
@@ -360,7 +360,7 @@ EOF
360 test_expect_success 'status -s -b' '
361
362 git status -s -b >output &&
363 - test_cmp expect output
363 + test_i18ncmp expect output
364
365 '
366
@@ -370,7 +370,7 @@ test_expect_success 'status -s -z -b' '
370 git status -s -z -b >output &&
371 nul_to_q <output >output.q &&
372 mv output.q output &&
373 - test_cmp expect output
373 + test_i18ncmp expect output
374 '
375
376 test_expect_success 'setup dir3' '
@@ -687,7 +687,7 @@ EOF
687 test_expect_success 'status -s -b with color.status' '
688
689 git status -s -b | test_decode_color >output &&
690 - test_cmp expect output
690 + test_i18ncmp expect output
691
692 '
693
t/t7509-commit.sh
+2 -2
@@ -101,7 +101,7 @@ test_expect_success '--amend option with empty author' '
101 echo "Empty author test" >>foo &&
102 test_tick &&
103 test_must_fail git commit -a -m "empty author" --amend 2>err &&
104 - grep "empty ident" err
104 + test_i18ngrep "empty ident" err
105 '
106
107 test_expect_success '--amend option with missing author' '
@@ -114,7 +114,7 @@ test_expect_success '--amend option with missing author' '
114 echo "Missing author test" >>foo &&
115 test_tick &&
116 test_must_fail git commit -a -m "malformed author" --amend 2>err &&
117 - grep "empty ident" err
117 + test_i18ngrep "empty ident" err
118 '
119
120 test_expect_success '--reset-author makes the commit ours even with --amend option' '
t/t7800-difftool.sh
+2 -2
@@ -25,14 +25,14 @@ prompt_given ()
25
26 test_expect_success 'basic usage requires no repo' '
27 test_expect_code 129 git difftool -h >output &&
28 - grep ^usage: output &&
28 + test_i18ngrep ^usage: output &&
29 # create a ceiling directory to prevent Git from finding a repo
30 mkdir -p not/repo &&
31 test_when_finished rm -r not &&
32 test_expect_code 129 \
33 env GIT_CEILING_DIRECTORIES="$(pwd)/not" \
34 git -C not/repo difftool -h >output &&
35 - grep ^usage: output
35 + test_i18ngrep ^usage: output
36 '
37
38 # Create a file on master and change it on branch