]> git.ipfire.org Git - thirdparty/git.git/commitdiff
tests: fix tests broken under GETTEXT_POISON=YesPlease
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Fri, 5 May 2017 18:19:32 +0000 (18:19 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 11 May 2017 09:44:38 +0000 (18:44 +0900)
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>
15 files changed:
t/t0027-auto-crlf.sh
t/t1309-early-config.sh
t/t1430-bad-ref-name.sh
t/t3203-branch-output.sh
t/t3404-rebase-interactive.sh
t/t3415-rebase-autosquash.sh
t/t3903-stash.sh
t/t4205-log-pretty-formats.sh
t/t5316-pack-delta-depth.sh
t/t6134-pathspec-in-submodule.sh
t/t7004-tag.sh
t/t7406-submodule-update.sh
t/t7508-status.sh
t/t7509-commit.sh
t/t7800-difftool.sh

index 90db54c9f976c3c7b1d1d1a55bc3be6e557f2aa2..81609af7bbdf2f0ec0e16b4b7374dfc20a96001f 100755 (executable)
@@ -75,7 +75,7 @@ check_warning () {
        *) echo >&2 "Illegal 1": "$1" ; return false ;;
        esac
        grep "will be replaced by" "$2" | sed -e "s/\(.*\) in [^ ]*$/\1/" | uniq  >"$2".actual
-       test_cmp "$2".expect "$2".actual
+       test_i18ncmp "$2".expect "$2".actual
 }
 
 commit_check_warn () {
index 1af8c454cfa715d5694c16b4848428ae0b75eda6..3dda215e8e2f37c049a3169cecdb3e43ddea5dfb 100755 (executable)
@@ -77,7 +77,7 @@ test_with_config () {
 
 test_expect_success 'ignore .git/ with incompatible repository version' '
        test_with_config "[core]repositoryformatversion = 999999" 2>err &&
-       grep "warning:.* Expected git repo version <= [1-9]" err
+       test_i18ngrep "warning:.* Expected git repo version <= [1-9]" err
 '
 
 test_expect_failure 'ignore .git/ with invalid repository version' '
index 8937e25e4955b79d72952289e7485652309def3a..e88349c8a0483b97ea38013de61d799003fd85b5 100755 (executable)
@@ -122,7 +122,7 @@ test_expect_success 'push cannot create a badly named ref' '
        ! grep -e "broken\.\.\.ref" output
 '
 
-test_expect_failure 'push --mirror can delete badly named ref' '
+test_expect_failure C_LOCALE_OUTPUT 'push --mirror can delete badly named ref' '
        top=$(pwd) &&
        git init src &&
        git init dest &&
index 5778c0afe12be2495b58a5251fb9bc8dc395a143..a428ae670369505476ab19338bf0f1da70018301 100755 (executable)
@@ -236,7 +236,7 @@ test_expect_success 'git branch --format option' '
        Refname is refs/heads/ref-to-remote
        EOF
        git branch --format="Refname is %(refname)" >actual &&
-       test_cmp expect actual
+       test_i18ncmp expect actual
 '
 
 test_done
index 33d392ba112e2c130a02d2229967842ca257e837..5bd0275930b715c25507fc9744c8946e7f73900b 100755 (executable)
@@ -366,7 +366,7 @@ test_expect_success 'verbose flag is heeded, even after --continue' '
        grep "^ file1 | 2 +-$" output
 '
 
-test_expect_success 'multi-squash only fires up editor once' '
+test_expect_success C_LOCALE_OUTPUT 'multi-squash only fires up editor once' '
        base=$(git rev-parse HEAD~4) &&
        set_fake_editor &&
        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' '
        test 1 = $(git show | grep ONCE | wc -l)
 '
 
-test_expect_success 'multi-fixup does not fire up editor' '
+test_expect_success C_LOCALE_OUTPUT 'multi-fixup does not fire up editor' '
        git checkout -b multi-fixup E &&
        base=$(git rev-parse HEAD~4) &&
        set_fake_editor &&
@@ -426,7 +426,7 @@ D
 ONCE
 EOF
 
-test_expect_success 'squash and fixup generate correct log messages' '
+test_expect_success C_LOCALE_OUTPUT 'squash and fixup generate correct log messages' '
        git checkout -b squash-fixup E &&
        base=$(git rev-parse HEAD~4) &&
        set_fake_editor &&
@@ -439,7 +439,7 @@ test_expect_success 'squash and fixup generate correct log messages' '
        git branch -D squash-fixup
 '
 
-test_expect_success 'squash ignores comments' '
+test_expect_success C_LOCALE_OUTPUT 'squash ignores comments' '
        git checkout -b skip-comments E &&
        base=$(git rev-parse HEAD~4) &&
        set_fake_editor &&
@@ -452,7 +452,7 @@ test_expect_success 'squash ignores comments' '
        git branch -D skip-comments
 '
 
-test_expect_success 'squash ignores blank lines' '
+test_expect_success C_LOCALE_OUTPUT 'squash ignores blank lines' '
        git checkout -b skip-blank-lines E &&
        base=$(git rev-parse HEAD~4) &&
        set_fake_editor &&
@@ -860,7 +860,7 @@ test_expect_success 'rebase -ix with several instances of --exec' '
        test_cmp expected actual
 '
 
-test_expect_success 'rebase -ix with --autosquash' '
+test_expect_success C_LOCALE_OUTPUT 'rebase -ix with --autosquash' '
        git reset --hard execute &&
        git checkout -b autosquash &&
        echo second >second.txt &&
@@ -943,7 +943,7 @@ test_expect_success 'rebase -i --root fixup root commit' '
        test 0 = $(git cat-file commit HEAD | grep -c ^parent\ )
 '
 
-test_expect_success 'rebase --edit-todo does not works on non-interactive rebase' '
+test_expect_success C_LOCALE_OUTPUT 'rebase --edit-todo does not work on non-interactive rebase' '
        git reset --hard &&
        git checkout conflict-branch &&
        set_fake_editor &&
index 48346f1cc0c12883029349e4999d7e6697b35adb..5848949ec3700c2188d581500c19eaffa1392c3d 100755 (executable)
@@ -234,23 +234,23 @@ test_auto_fixup_fixup () {
        fi
 }
 
-test_expect_success 'fixup! fixup!' '
+test_expect_success C_LOCALE_OUTPUT 'fixup! fixup!' '
        test_auto_fixup_fixup fixup fixup
 '
 
-test_expect_success 'fixup! squash!' '
+test_expect_success C_LOCALE_OUTPUT 'fixup! squash!' '
        test_auto_fixup_fixup fixup squash
 '
 
-test_expect_success 'squash! squash!' '
+test_expect_success C_LOCALE_OUTPUT 'squash! squash!' '
        test_auto_fixup_fixup squash squash
 '
 
-test_expect_success 'squash! fixup!' '
+test_expect_success C_LOCALE_OUTPUT 'squash! fixup!' '
        test_auto_fixup_fixup squash fixup
 '
 
-test_expect_success 'autosquash with custom inst format' '
+test_expect_success C_LOCALE_OUTPUT 'autosquash with custom inst format' '
        git reset --hard base &&
        git config --add rebase.instructionFormat "[%an @ %ar] %s"  &&
        echo 2 >file1 &&
index b71d1e659e97c0f34bc5bcfeda65b854c2d714e9..3b4bed5c9ace3b9122380287c55b4130135018c7 100755 (executable)
@@ -865,7 +865,7 @@ test_expect_success 'stash push -p with pathspec shows no changes only once' '
        git stash push -p foo >actual &&
        echo "No local changes to save" >expect &&
        git reset --hard HEAD~ &&
-       test_cmp expect actual
+       test_i18ncmp expect actual
 '
 
 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
        git stash push foo >actual &&
        echo "No local changes to save" >expect &&
        git reset --hard HEAD~ &&
-       test_cmp expect actual
+       test_i18ncmp expect actual
 '
 
 test_expect_success 'stash push with pathspec not in the repository errors out' '
index 21eb8c8587f2b4de01595d91d27c8ec6706d2a00..18aa1b5889749e706cba70c2a4f2633bcc9c9eb4 100755 (executable)
@@ -126,12 +126,12 @@ test_expect_success 'NUL separation with --stat' '
        test_i18ncmp expected actual
 '
 
-test_expect_failure 'NUL termination with --stat' '
+test_expect_failure C_LOCALE_OUTPUT 'NUL termination with --stat' '
        stat0_part=$(git diff --stat HEAD^ HEAD) &&
        stat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&
        printf "add bar\n$stat0_part\n\0$(commit_msg)\n$stat1_part\n0" >expected &&
        git log -z --stat --pretty="tformat:%s" >actual &&
-       test_i18ncmp expected actual
+       test_cmp expected actual
 '
 
 test_expect_success 'setup more commits' '
index 37143ea0ac72814ac539648ee4b47eb895a567c4..2ed479b712aed7a8f11c8495c0eba72788eb4f26 100755 (executable)
@@ -82,12 +82,16 @@ test_expect_success 'packing produces a long delta' '
        # Use --window=0 to make sure we are seeing reused deltas,
        # not computing a new long chain.
        pack=$(git pack-objects --all --window=0 </dev/null pack) &&
-       test 9 = "$(max_chain pack-$pack.pack)"
+       echo 9 >expect &&
+       max_chain pack-$pack.pack >actual &&
+       test_i18ncmp expect actual
 '
 
 test_expect_success '--depth limits depth' '
        pack=$(git pack-objects --all --depth=5 </dev/null pack) &&
-       test 5 = "$(max_chain pack-$pack.pack)"
+       echo 5 >expect &&
+       max_chain pack-$pack.pack >actual &&
+       test_i18ncmp expect actual
 '
 
 test_done
index fd401ca605681a1586aa29bd83fe51004bd5c1ab..99a8982ab1554c6c2324402f78f46954445596fd 100755 (executable)
@@ -21,7 +21,7 @@ EOF
 test_expect_success 'error message for path inside submodule' '
        echo a >sub/a &&
        test_must_fail git add sub/a 2>actual &&
-       test_cmp expect actual
+       test_i18ncmp expect actual
 '
 
 cat <<EOF >expect
@@ -30,7 +30,7 @@ EOF
 
 test_expect_success 'error message for path inside submodule from within submodule' '
        test_must_fail git -C sub add . 2>actual &&
-       test_cmp expect actual
+       test_i18ncmp expect actual
 '
 
 test_done
index bb2e4d704de006025ae0db9369b81bbebc15750a..0ef7b94394151da9a9a6d602952e7f2fa64cf6a4 100755 (executable)
@@ -87,7 +87,7 @@ test_expect_success 'creating a tag with --create-reflog should create reflog' '
        git tag --create-reflog tag_with_reflog &&
        git reflog exists refs/tags/tag_with_reflog &&
        sed -e "s/^.*   //" .git/logs/refs/tags/tag_with_reflog >actual &&
-       test_cmp expected actual
+       test_i18ncmp expected actual
 '
 
 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' '
        git tag -m "annotated tag" --create-reflog tag_with_reflog &&
        git reflog exists refs/tags/tag_with_reflog &&
        sed -e "s/^.*   //" .git/logs/refs/tags/tag_with_reflog >actual &&
-       test_cmp expected actual
+       test_i18ncmp expected actual
 '
 
 test_expect_success '--create-reflog does not create reflog on failure' '
index 4ac386d98b8ebdfb4808b9a8119900ee23b5dfa9..034914a14fd49fea07e8bff4802994fcd38807a9 100755 (executable)
@@ -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
 '
 
index fb00e6d9b07f4cc6f478bb532749403017599400..5edcc6edfe651f638921b9148be9579312a47adc 100755 (executable)
@@ -360,7 +360,7 @@ EOF
 test_expect_success 'status -s -b' '
 
        git status -s -b >output &&
-       test_cmp expect output
+       test_i18ncmp expect output
 
 '
 
@@ -370,7 +370,7 @@ test_expect_success 'status -s -z -b' '
        git status -s -z -b >output &&
        nul_to_q <output >output.q &&
        mv output.q output &&
-       test_cmp expect output
+       test_i18ncmp expect output
 '
 
 test_expect_success 'setup dir3' '
@@ -687,7 +687,7 @@ EOF
 test_expect_success 'status -s -b with color.status' '
 
        git status -s -b | test_decode_color >output &&
-       test_cmp expect output
+       test_i18ncmp expect output
 
 '
 
index db9774e345586428ae1ac23f11d92ae00e05c1e9..ddef7ea6b0d87ef5922bf267ee3fdc9ade4383af 100755 (executable)
@@ -101,7 +101,7 @@ test_expect_success '--amend option with empty author' '
        echo "Empty author test" >>foo &&
        test_tick &&
        test_must_fail git commit -a -m "empty author" --amend 2>err &&
-       grep "empty ident" err
+       test_i18ngrep "empty ident" err
 '
 
 test_expect_success '--amend option with missing author' '
@@ -114,7 +114,7 @@ test_expect_success '--amend option with missing author' '
        echo "Missing author test" >>foo &&
        test_tick &&
        test_must_fail git commit -a -m "malformed author" --amend 2>err &&
-       grep "empty ident" err
+       test_i18ngrep "empty ident" err
 '
 
 test_expect_success '--reset-author makes the commit ours even with --amend option' '
index 7f09867478c408cddee6b60639bfdf7c845421d8..668bbee73c8dc58c6ba61c4a8002ed68206d1445 100755 (executable)
@@ -25,14 +25,14 @@ prompt_given ()
 
 test_expect_success 'basic usage requires no repo' '
        test_expect_code 129 git difftool -h >output &&
-       grep ^usage: output &&
+       test_i18ngrep ^usage: output &&
        # create a ceiling directory to prevent Git from finding a repo
        mkdir -p not/repo &&
        test_when_finished rm -r not &&
        test_expect_code 129 \
        env GIT_CEILING_DIRECTORIES="$(pwd)/not" \
        git -C not/repo difftool -h >output &&
-       grep ^usage: output
+       test_i18ngrep ^usage: output
 '
 
 # Create a file on master and change it on branch