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 <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 4fa66c8 commit 0d75bfe

15 files changed

Lines changed: 38 additions & 34 deletions

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

0 commit comments

Comments
 (0)