Skip to content

Commit 0d75bfe

Browse files
avargitster
authored andcommitted
tests: fix tests broken under GETTEXT_POISON=YesPlease
The GETTEXT_POISON=YesPlease compile-time testing option added in my bb946bb ("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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4fa66c8 commit 0d75bfe

15 files changed

+38
-34
lines changed

t/t0027-auto-crlf.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ check_warning () {
7575
*) echo >&2 "Illegal 1": "$1" ; return false ;;
7676
esac
7777
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
7979
}
8080

8181
commit_check_warn () {

t/t1309-early-config.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ test_with_config () {
7777

7878
test_expect_success 'ignore .git/ with incompatible repository version' '
7979
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
8181
'
8282

8383
test_expect_failure 'ignore .git/ with invalid repository version' '

t/t1430-bad-ref-name.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ test_expect_success 'push cannot create a badly named ref' '
122122
! grep -e "broken\.\.\.ref" output
123123
'
124124

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' '
126126
top=$(pwd) &&
127127
git init src &&
128128
git init dest &&

t/t3203-branch-output.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ test_expect_success 'git branch --format option' '
236236
Refname is refs/heads/ref-to-remote
237237
EOF
238238
git branch --format="Refname is %(refname)" >actual &&
239-
test_cmp expect actual
239+
test_i18ncmp expect actual
240240
'
241241

242242
test_done

t/t3404-rebase-interactive.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ test_expect_success 'verbose flag is heeded, even after --continue' '
366366
grep "^ file1 | 2 +-$" output
367367
'
368368

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' '
370370
base=$(git rev-parse HEAD~4) &&
371371
set_fake_editor &&
372372
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' '
376376
test 1 = $(git show | grep ONCE | wc -l)
377377
'
378378

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' '
380380
git checkout -b multi-fixup E &&
381381
base=$(git rev-parse HEAD~4) &&
382382
set_fake_editor &&
@@ -426,7 +426,7 @@ D
426426
ONCE
427427
EOF
428428

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' '
430430
git checkout -b squash-fixup E &&
431431
base=$(git rev-parse HEAD~4) &&
432432
set_fake_editor &&
@@ -439,7 +439,7 @@ test_expect_success 'squash and fixup generate correct log messages' '
439439
git branch -D squash-fixup
440440
'
441441

442-
test_expect_success 'squash ignores comments' '
442+
test_expect_success C_LOCALE_OUTPUT 'squash ignores comments' '
443443
git checkout -b skip-comments E &&
444444
base=$(git rev-parse HEAD~4) &&
445445
set_fake_editor &&
@@ -452,7 +452,7 @@ test_expect_success 'squash ignores comments' '
452452
git branch -D skip-comments
453453
'
454454

455-
test_expect_success 'squash ignores blank lines' '
455+
test_expect_success C_LOCALE_OUTPUT 'squash ignores blank lines' '
456456
git checkout -b skip-blank-lines E &&
457457
base=$(git rev-parse HEAD~4) &&
458458
set_fake_editor &&
@@ -860,7 +860,7 @@ test_expect_success 'rebase -ix with several instances of --exec' '
860860
test_cmp expected actual
861861
'
862862

863-
test_expect_success 'rebase -ix with --autosquash' '
863+
test_expect_success C_LOCALE_OUTPUT 'rebase -ix with --autosquash' '
864864
git reset --hard execute &&
865865
git checkout -b autosquash &&
866866
echo second >second.txt &&
@@ -943,7 +943,7 @@ test_expect_success 'rebase -i --root fixup root commit' '
943943
test 0 = $(git cat-file commit HEAD | grep -c ^parent\ )
944944
'
945945

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' '
947947
git reset --hard &&
948948
git checkout conflict-branch &&
949949
set_fake_editor &&

t/t3415-rebase-autosquash.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,23 +234,23 @@ test_auto_fixup_fixup () {
234234
fi
235235
}
236236

237-
test_expect_success 'fixup! fixup!' '
237+
test_expect_success C_LOCALE_OUTPUT 'fixup! fixup!' '
238238
test_auto_fixup_fixup fixup fixup
239239
'
240240

241-
test_expect_success 'fixup! squash!' '
241+
test_expect_success C_LOCALE_OUTPUT 'fixup! squash!' '
242242
test_auto_fixup_fixup fixup squash
243243
'
244244

245-
test_expect_success 'squash! squash!' '
245+
test_expect_success C_LOCALE_OUTPUT 'squash! squash!' '
246246
test_auto_fixup_fixup squash squash
247247
'
248248

249-
test_expect_success 'squash! fixup!' '
249+
test_expect_success C_LOCALE_OUTPUT 'squash! fixup!' '
250250
test_auto_fixup_fixup squash fixup
251251
'
252252

253-
test_expect_success 'autosquash with custom inst format' '
253+
test_expect_success C_LOCALE_OUTPUT 'autosquash with custom inst format' '
254254
git reset --hard base &&
255255
git config --add rebase.instructionFormat "[%an @ %ar] %s" &&
256256
echo 2 >file1 &&

t/t3903-stash.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ test_expect_success 'stash push -p with pathspec shows no changes only once' '
865865
git stash push -p foo >actual &&
866866
echo "No local changes to save" >expect &&
867867
git reset --hard HEAD~ &&
868-
test_cmp expect actual
868+
test_i18ncmp expect actual
869869
'
870870

871871
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
875875
git stash push foo >actual &&
876876
echo "No local changes to save" >expect &&
877877
git reset --hard HEAD~ &&
878-
test_cmp expect actual
878+
test_i18ncmp expect actual
879879
'
880880

881881
test_expect_success 'stash push with pathspec not in the repository errors out' '

t/t4205-log-pretty-formats.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@ test_expect_success 'NUL separation with --stat' '
126126
test_i18ncmp expected actual
127127
'
128128

129-
test_expect_failure 'NUL termination with --stat' '
129+
test_expect_failure C_LOCALE_OUTPUT 'NUL termination with --stat' '
130130
stat0_part=$(git diff --stat HEAD^ HEAD) &&
131131
stat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&
132132
printf "add bar\n$stat0_part\n\0$(commit_msg)\n$stat1_part\n0" >expected &&
133133
git log -z --stat --pretty="tformat:%s" >actual &&
134-
test_i18ncmp expected actual
134+
test_cmp expected actual
135135
'
136136

137137
test_expect_success 'setup more commits' '

t/t5316-pack-delta-depth.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,16 @@ test_expect_success 'packing produces a long delta' '
8282
# Use --window=0 to make sure we are seeing reused deltas,
8383
# not computing a new long chain.
8484
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
8688
'
8789

8890
test_expect_success '--depth limits depth' '
8991
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
9195
'
9296

9397
test_done

t/t6134-pathspec-in-submodule.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ EOF
2121
test_expect_success 'error message for path inside submodule' '
2222
echo a >sub/a &&
2323
test_must_fail git add sub/a 2>actual &&
24-
test_cmp expect actual
24+
test_i18ncmp expect actual
2525
'
2626

2727
cat <<EOF >expect
@@ -30,7 +30,7 @@ EOF
3030

3131
test_expect_success 'error message for path inside submodule from within submodule' '
3232
test_must_fail git -C sub add . 2>actual &&
33-
test_cmp expect actual
33+
test_i18ncmp expect actual
3434
'
3535

3636
test_done

t/t7004-tag.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ test_expect_success 'creating a tag with --create-reflog should create reflog' '
8787
git tag --create-reflog tag_with_reflog &&
8888
git reflog exists refs/tags/tag_with_reflog &&
8989
sed -e "s/^.* //" .git/logs/refs/tags/tag_with_reflog >actual &&
90-
test_cmp expected actual
90+
test_i18ncmp expected actual
9191
'
9292

9393
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' '
9898
git tag -m "annotated tag" --create-reflog tag_with_reflog &&
9999
git reflog exists refs/tags/tag_with_reflog &&
100100
sed -e "s/^.* //" .git/logs/refs/tags/tag_with_reflog >actual &&
101-
test_cmp expected actual
101+
test_i18ncmp expected actual
102102
'
103103

104104
test_expect_success '--create-reflog does not create reflog on failure' '

t/t7406-submodule-update.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ test_expect_success 'submodule update - command run for initial population of su
447447
EOF
448448
rm -rf super/submodule &&
449449
test_must_fail git -C super submodule update 2>actual &&
450-
test_cmp expect actual &&
450+
test_i18ncmp expect actual &&
451451
git -C super submodule update --checkout
452452
'
453453

t/t7508-status.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ EOF
360360
test_expect_success 'status -s -b' '
361361
362362
git status -s -b >output &&
363-
test_cmp expect output
363+
test_i18ncmp expect output
364364
365365
'
366366

@@ -370,7 +370,7 @@ test_expect_success 'status -s -z -b' '
370370
git status -s -z -b >output &&
371371
nul_to_q <output >output.q &&
372372
mv output.q output &&
373-
test_cmp expect output
373+
test_i18ncmp expect output
374374
'
375375

376376
test_expect_success 'setup dir3' '
@@ -687,7 +687,7 @@ EOF
687687
test_expect_success 'status -s -b with color.status' '
688688
689689
git status -s -b | test_decode_color >output &&
690-
test_cmp expect output
690+
test_i18ncmp expect output
691691
692692
'
693693

t/t7509-commit.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ test_expect_success '--amend option with empty author' '
101101
echo "Empty author test" >>foo &&
102102
test_tick &&
103103
test_must_fail git commit -a -m "empty author" --amend 2>err &&
104-
grep "empty ident" err
104+
test_i18ngrep "empty ident" err
105105
'
106106

107107
test_expect_success '--amend option with missing author' '
@@ -114,7 +114,7 @@ test_expect_success '--amend option with missing author' '
114114
echo "Missing author test" >>foo &&
115115
test_tick &&
116116
test_must_fail git commit -a -m "malformed author" --amend 2>err &&
117-
grep "empty ident" err
117+
test_i18ngrep "empty ident" err
118118
'
119119

120120
test_expect_success '--reset-author makes the commit ours even with --amend option' '

t/t7800-difftool.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ prompt_given ()
2525

2626
test_expect_success 'basic usage requires no repo' '
2727
test_expect_code 129 git difftool -h >output &&
28-
grep ^usage: output &&
28+
test_i18ngrep ^usage: output &&
2929
# create a ceiling directory to prevent Git from finding a repo
3030
mkdir -p not/repo &&
3131
test_when_finished rm -r not &&
3232
test_expect_code 129 \
3333
env GIT_CEILING_DIRECTORIES="$(pwd)/not" \
3434
git -C not/repo difftool -h >output &&
35-
grep ^usage: output
35+
test_i18ngrep ^usage: output
3636
'
3737

3838
# Create a file on master and change it on branch

0 commit comments

Comments
 (0)