i18n: use test_i18n{grep,cmp} in t7508
Two tests looked for "[Uu]sage" in the output, but we cannot expect the l10n to use that phrase. Mark them with test_i18ngrep so that in later versions we can test truly localized versions with the same tests, not just GETTEXT_POISON that happens to keep the original string in the output. Merge a few tests that were artificially split into "do" and "test output under C_LOCALE_OUTPUT" in the original i18n patches back. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
7a23d2d28a
commit
cc6658e7b4
@ -16,7 +16,7 @@ test_expect_success 'status -h in broken repository' '
|
||||
echo "[status] showuntrackedfiles = CORRUPT" >>.git/config &&
|
||||
test_expect_code 129 git status -h >usage 2>&1
|
||||
) &&
|
||||
grep "[Uu]sage" broken/usage
|
||||
test_i18ngrep "[Uu]sage" broken/usage
|
||||
'
|
||||
|
||||
test_expect_success 'commit -h in broken repository' '
|
||||
@ -28,7 +28,7 @@ test_expect_success 'commit -h in broken repository' '
|
||||
echo "[status] showuntrackedfiles = CORRUPT" >>.git/config &&
|
||||
test_expect_code 129 git commit -h >usage 2>&1
|
||||
) &&
|
||||
grep "[Uu]sage" broken/usage
|
||||
test_i18ngrep "[Uu]sage" broken/usage
|
||||
'
|
||||
|
||||
test_expect_success 'setup' '
|
||||
@ -55,10 +55,8 @@ test_expect_success 'setup' '
|
||||
git add dir2/added
|
||||
'
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT 'status (1)' '
|
||||
|
||||
grep "use \"git rm --cached <file>\.\.\.\" to unstage" output
|
||||
|
||||
test_expect_success 'status (1)' '
|
||||
test_i18ngrep "use \"git rm --cached <file>\.\.\.\" to unstage" output
|
||||
'
|
||||
|
||||
cat >expect <<\EOF
|
||||
@ -85,11 +83,9 @@ cat >expect <<\EOF
|
||||
# untracked
|
||||
EOF
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT 'status (2)' '
|
||||
|
||||
test_expect_success 'status (2)' '
|
||||
git status >output &&
|
||||
test_cmp expect output
|
||||
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
|
||||
cat >expect <<\EOF
|
||||
@ -109,17 +105,14 @@ cat >expect <<\EOF
|
||||
# untracked
|
||||
EOF
|
||||
|
||||
git config advice.statusHints false
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT 'status (advice.statusHints false)' '
|
||||
|
||||
test_expect_success 'status (advice.statusHints false)' '
|
||||
test_when_finished "git config --unset advice.statusHints" &&
|
||||
git config advice.statusHints false &&
|
||||
git status >output &&
|
||||
test_cmp expect output
|
||||
test_i18ncmp expect output
|
||||
|
||||
'
|
||||
|
||||
git config --unset advice.statusHints
|
||||
|
||||
cat >expect <<\EOF
|
||||
M dir1/modified
|
||||
A dir2/added
|
||||
@ -178,16 +171,16 @@ cat >expect <<EOF
|
||||
#
|
||||
# Untracked files not listed (use -u option to show untracked files)
|
||||
EOF
|
||||
test_expect_success C_LOCALE_OUTPUT 'status -uno' '
|
||||
test_expect_success 'status -uno' '
|
||||
git status -uno >output &&
|
||||
test_cmp expect output
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT 'status (status.showUntrackedFiles no)' '
|
||||
test_expect_success 'status (status.showUntrackedFiles no)' '
|
||||
git config status.showuntrackedfiles no
|
||||
test_when_finished "git config --unset status.showuntrackedfiles" &&
|
||||
git status >output &&
|
||||
test_cmp expect output
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
|
||||
cat >expect <<EOF
|
||||
@ -201,9 +194,9 @@ cat >expect <<EOF
|
||||
# Untracked files not listed
|
||||
EOF
|
||||
git config advice.statusHints false
|
||||
test_expect_success C_LOCALE_OUTPUT 'status -uno (advice.statusHints false)' '
|
||||
test_expect_success 'status -uno (advice.statusHints false)' '
|
||||
git status -uno >output &&
|
||||
test_cmp expect output
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
git config --unset advice.statusHints
|
||||
|
||||
@ -246,16 +239,16 @@ cat >expect <<EOF
|
||||
# output
|
||||
# untracked
|
||||
EOF
|
||||
test_expect_success C_LOCALE_OUTPUT 'status -unormal' '
|
||||
test_expect_success 'status -unormal' '
|
||||
git status -unormal >output &&
|
||||
test_cmp expect output
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT 'status (status.showUntrackedFiles normal)' '
|
||||
test_expect_success 'status (status.showUntrackedFiles normal)' '
|
||||
git config status.showuntrackedfiles normal
|
||||
test_when_finished "git config --unset status.showuntrackedfiles" &&
|
||||
git status >output &&
|
||||
test_cmp expect output
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
|
||||
cat >expect <<EOF
|
||||
@ -305,15 +298,16 @@ cat >expect <<EOF
|
||||
# output
|
||||
# untracked
|
||||
EOF
|
||||
test_expect_success C_LOCALE_OUTPUT 'status -uall' '
|
||||
test_expect_success 'status -uall' '
|
||||
git status -uall >output &&
|
||||
test_cmp expect output
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
test_expect_success C_LOCALE_OUTPUT 'status (status.showUntrackedFiles all)' '
|
||||
|
||||
test_expect_success 'status (status.showUntrackedFiles all)' '
|
||||
git config status.showuntrackedfiles all
|
||||
test_when_finished "git config --unset status.showuntrackedfiles" &&
|
||||
git status >output &&
|
||||
test_cmp expect output
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
|
||||
test_expect_success 'teardown dir3' '
|
||||
@ -367,11 +361,9 @@ cat >expect <<\EOF
|
||||
# ../untracked
|
||||
EOF
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT 'status with relative paths' '
|
||||
|
||||
test_expect_success 'status with relative paths' '
|
||||
(cd dir1 && git status) >output &&
|
||||
test_cmp expect output
|
||||
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
|
||||
cat >expect <<\EOF
|
||||
@ -440,22 +432,18 @@ cat >expect <<\EOF
|
||||
# <BLUE>untracked<RESET>
|
||||
EOF
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT 'status with color.ui' '
|
||||
|
||||
test_expect_success 'status with color.ui' '
|
||||
git config color.ui always &&
|
||||
test_when_finished "git config --unset color.ui" &&
|
||||
git status | test_decode_color >output &&
|
||||
test_cmp expect output
|
||||
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT 'status with color.status' '
|
||||
|
||||
test_expect_success 'status with color.status' '
|
||||
git config color.status always &&
|
||||
test_when_finished "git config --unset color.status" &&
|
||||
git status | test_decode_color >output &&
|
||||
test_cmp expect output
|
||||
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
|
||||
cat >expect <<\EOF
|
||||
@ -570,12 +558,12 @@ cat >expect <<\EOF
|
||||
EOF
|
||||
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT 'status without relative paths' '
|
||||
test_expect_success 'status without relative paths' '
|
||||
|
||||
git config status.relativePaths false &&
|
||||
test_when_finished "git config --unset status.relativePaths" &&
|
||||
(cd dir1 && git status) >output &&
|
||||
test_cmp expect output
|
||||
test_i18ncmp expect output
|
||||
|
||||
'
|
||||
|
||||
@ -616,11 +604,8 @@ cat <<EOF >expect
|
||||
# untracked
|
||||
EOF
|
||||
test_expect_success 'dry-run of partial commit excluding new file in index' '
|
||||
git commit --dry-run dir1/modified >output
|
||||
'
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT 'dry-run of partial commit excluding new file in index: output' '
|
||||
test_cmp expect output
|
||||
git commit --dry-run dir1/modified >output &&
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
|
||||
cat >expect <<EOF
|
||||
@ -667,15 +652,15 @@ cat >expect <<EOF
|
||||
# output
|
||||
# untracked
|
||||
EOF
|
||||
test_expect_success C_LOCALE_OUTPUT 'status submodule summary is disabled by default' '
|
||||
test_expect_success 'status submodule summary is disabled by default' '
|
||||
git status >output &&
|
||||
test_cmp expect output
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
|
||||
# we expect the same as the previous test
|
||||
test_expect_success C_LOCALE_OUTPUT 'status --untracked-files=all does not show submodule' '
|
||||
test_expect_success 'status --untracked-files=all does not show submodule' '
|
||||
git status --untracked-files=all >output &&
|
||||
test_cmp expect output
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
|
||||
cat >expect <<EOF
|
||||
@ -731,10 +716,10 @@ cat >expect <<EOF
|
||||
# output
|
||||
# untracked
|
||||
EOF
|
||||
test_expect_success C_LOCALE_OUTPUT 'status submodule summary' '
|
||||
test_expect_success 'status submodule summary' '
|
||||
git config status.submodulesummary 10 &&
|
||||
git status >output &&
|
||||
test_cmp expect output
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
|
||||
cat >expect <<EOF
|
||||
@ -773,15 +758,12 @@ cat >expect <<EOF
|
||||
no changes added to commit (use "git add" and/or "git commit -a")
|
||||
EOF
|
||||
test_expect_success 'status submodule summary (clean submodule): commit' '
|
||||
git commit -m "commit submodule"
|
||||
'
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT 'status submodule summary (clean submodule): output' '
|
||||
git commit -m "commit submodule" &&
|
||||
git config status.submodulesummary 10 &&
|
||||
test_must_fail git commit --dry-run >output &&
|
||||
test_cmp expect output &&
|
||||
test_i18ncmp expect output &&
|
||||
git status >output &&
|
||||
test_cmp expect output
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
|
||||
cat >expect <<EOF
|
||||
@ -827,10 +809,10 @@ cat >expect <<EOF
|
||||
# output
|
||||
# untracked
|
||||
EOF
|
||||
test_expect_success C_LOCALE_OUTPUT 'commit --dry-run submodule summary (--amend)' '
|
||||
test_expect_success 'commit --dry-run submodule summary (--amend)' '
|
||||
git config status.submodulesummary 10 &&
|
||||
git commit --dry-run --amend >output &&
|
||||
test_cmp expect output
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
|
||||
test_expect_success POSIXPERM,SANITY 'status succeeds in a read-only repository' '
|
||||
@ -882,84 +864,84 @@ cat > expect << EOF
|
||||
# untracked
|
||||
EOF
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT '--ignore-submodules=untracked suppresses submodules with untracked content' '
|
||||
echo modified > sm/untracked &&
|
||||
git status --ignore-submodules=untracked > output &&
|
||||
test_cmp expect output
|
||||
test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' '
|
||||
echo modified sm/untracked &&
|
||||
git status --ignore-submodules=untracked >output &&
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT '.gitmodules ignore=untracked suppresses submodules with untracked content' '
|
||||
test_expect_success '.gitmodules ignore=untracked suppresses submodules with untracked content' '
|
||||
git config diff.ignoreSubmodules dirty &&
|
||||
git status >output &&
|
||||
test_cmp expect output &&
|
||||
test_i18ncmp expect output &&
|
||||
git config --add -f .gitmodules submodule.subname.ignore untracked &&
|
||||
git config --add -f .gitmodules submodule.subname.path sm &&
|
||||
git status > output &&
|
||||
test_cmp expect output &&
|
||||
git status >output &&
|
||||
test_i18ncmp expect output &&
|
||||
git config -f .gitmodules --remove-section submodule.subname &&
|
||||
git config --unset diff.ignoreSubmodules
|
||||
'
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT '.git/config ignore=untracked suppresses submodules with untracked content' '
|
||||
test_expect_success '.git/config ignore=untracked suppresses submodules with untracked content' '
|
||||
git config --add -f .gitmodules submodule.subname.ignore none &&
|
||||
git config --add -f .gitmodules submodule.subname.path sm &&
|
||||
git config --add submodule.subname.ignore untracked &&
|
||||
git config --add submodule.subname.path sm &&
|
||||
git status > output &&
|
||||
test_cmp expect output &&
|
||||
git status >output &&
|
||||
test_i18ncmp expect output &&
|
||||
git config --remove-section submodule.subname &&
|
||||
git config --remove-section -f .gitmodules submodule.subname
|
||||
'
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT '--ignore-submodules=dirty suppresses submodules with untracked content' '
|
||||
git status --ignore-submodules=dirty > output &&
|
||||
test_cmp expect output
|
||||
test_expect_success '--ignore-submodules=dirty suppresses submodules with untracked content' '
|
||||
git status --ignore-submodules=dirty >output &&
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT '.gitmodules ignore=dirty suppresses submodules with untracked content' '
|
||||
test_expect_success '.gitmodules ignore=dirty suppresses submodules with untracked content' '
|
||||
git config diff.ignoreSubmodules dirty &&
|
||||
git status >output &&
|
||||
! test -s actual &&
|
||||
git config --add -f .gitmodules submodule.subname.ignore dirty &&
|
||||
git config --add -f .gitmodules submodule.subname.path sm &&
|
||||
git status > output &&
|
||||
test_cmp expect output &&
|
||||
git status >output &&
|
||||
test_i18ncmp expect output &&
|
||||
git config -f .gitmodules --remove-section submodule.subname &&
|
||||
git config --unset diff.ignoreSubmodules
|
||||
'
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT '.git/config ignore=dirty suppresses submodules with untracked content' '
|
||||
test_expect_success '.git/config ignore=dirty suppresses submodules with untracked content' '
|
||||
git config --add -f .gitmodules submodule.subname.ignore none &&
|
||||
git config --add -f .gitmodules submodule.subname.path sm &&
|
||||
git config --add submodule.subname.ignore dirty &&
|
||||
git config --add submodule.subname.path sm &&
|
||||
git status > output &&
|
||||
test_cmp expect output &&
|
||||
git status >output &&
|
||||
test_i18ncmp expect output &&
|
||||
git config --remove-section submodule.subname &&
|
||||
git config -f .gitmodules --remove-section submodule.subname
|
||||
'
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT '--ignore-submodules=dirty suppresses submodules with modified content' '
|
||||
echo modified > sm/foo &&
|
||||
git status --ignore-submodules=dirty > output &&
|
||||
test_cmp expect output
|
||||
test_expect_success '--ignore-submodules=dirty suppresses submodules with modified content' '
|
||||
echo modified >sm/foo &&
|
||||
git status --ignore-submodules=dirty >output &&
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT '.gitmodules ignore=dirty suppresses submodules with modified content' '
|
||||
test_expect_success '.gitmodules ignore=dirty suppresses submodules with modified content' '
|
||||
git config --add -f .gitmodules submodule.subname.ignore dirty &&
|
||||
git config --add -f .gitmodules submodule.subname.path sm &&
|
||||
git status > output &&
|
||||
test_cmp expect output &&
|
||||
git status >output &&
|
||||
test_i18ncmp expect output &&
|
||||
git config -f .gitmodules --remove-section submodule.subname
|
||||
'
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT '.git/config ignore=dirty suppresses submodules with modified content' '
|
||||
test_expect_success '.git/config ignore=dirty suppresses submodules with modified content' '
|
||||
git config --add -f .gitmodules submodule.subname.ignore none &&
|
||||
git config --add -f .gitmodules submodule.subname.path sm &&
|
||||
git config --add submodule.subname.ignore dirty &&
|
||||
git config --add submodule.subname.path sm &&
|
||||
git status > output &&
|
||||
test_cmp expect output &&
|
||||
git status >output &&
|
||||
test_i18ncmp expect output &&
|
||||
git config --remove-section submodule.subname &&
|
||||
git config -f .gitmodules --remove-section submodule.subname
|
||||
'
|
||||
@ -996,26 +978,26 @@ cat > expect << EOF
|
||||
# untracked
|
||||
EOF
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
|
||||
test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
|
||||
git status --ignore-submodules=untracked > output &&
|
||||
test_cmp expect output
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT ".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
|
||||
test_expect_success ".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
|
||||
git config --add -f .gitmodules submodule.subname.ignore untracked &&
|
||||
git config --add -f .gitmodules submodule.subname.path sm &&
|
||||
git status > output &&
|
||||
test_cmp expect output &&
|
||||
git status >output &&
|
||||
test_i18ncmp expect output &&
|
||||
git config -f .gitmodules --remove-section submodule.subname
|
||||
'
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT ".git/config ignore=untracked doesn't suppress submodules with modified content" '
|
||||
test_expect_success ".git/config ignore=untracked doesn't suppress submodules with modified content" '
|
||||
git config --add -f .gitmodules submodule.subname.ignore none &&
|
||||
git config --add -f .gitmodules submodule.subname.path sm &&
|
||||
git config --add submodule.subname.ignore untracked &&
|
||||
git config --add submodule.subname.path sm &&
|
||||
git status > output &&
|
||||
test_cmp expect output &&
|
||||
git status >output &&
|
||||
test_i18ncmp expect output &&
|
||||
git config --remove-section submodule.subname &&
|
||||
git config -f .gitmodules --remove-section submodule.subname
|
||||
'
|
||||
@ -1058,49 +1040,49 @@ cat > expect << EOF
|
||||
# untracked
|
||||
EOF
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=untracked doesn't suppress submodule summary" '
|
||||
test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" '
|
||||
git status --ignore-submodules=untracked > output &&
|
||||
test_cmp expect output
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT ".gitmodules ignore=untracked doesn't suppress submodule summary" '
|
||||
test_expect_success ".gitmodules ignore=untracked doesn't suppress submodule summary" '
|
||||
git config --add -f .gitmodules submodule.subname.ignore untracked &&
|
||||
git config --add -f .gitmodules submodule.subname.path sm &&
|
||||
git status > output &&
|
||||
test_cmp expect output &&
|
||||
git status >output &&
|
||||
test_i18ncmp expect output &&
|
||||
git config -f .gitmodules --remove-section submodule.subname
|
||||
'
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT ".git/config ignore=untracked doesn't suppress submodule summary" '
|
||||
test_expect_success ".git/config ignore=untracked doesn't suppress submodule summary" '
|
||||
git config --add -f .gitmodules submodule.subname.ignore none &&
|
||||
git config --add -f .gitmodules submodule.subname.path sm &&
|
||||
git config --add submodule.subname.ignore untracked &&
|
||||
git config --add submodule.subname.path sm &&
|
||||
git status > output &&
|
||||
test_cmp expect output &&
|
||||
git status >output &&
|
||||
test_i18ncmp expect output &&
|
||||
git config --remove-section submodule.subname &&
|
||||
git config -f .gitmodules --remove-section submodule.subname
|
||||
'
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=dirty doesn't suppress submodule summary" '
|
||||
test_expect_success "--ignore-submodules=dirty doesn't suppress submodule summary" '
|
||||
git status --ignore-submodules=dirty > output &&
|
||||
test_cmp expect output
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
test_expect_success C_LOCALE_OUTPUT ".gitmodules ignore=dirty doesn't suppress submodule summary" '
|
||||
test_expect_success ".gitmodules ignore=dirty doesn't suppress submodule summary" '
|
||||
git config --add -f .gitmodules submodule.subname.ignore dirty &&
|
||||
git config --add -f .gitmodules submodule.subname.path sm &&
|
||||
git status > output &&
|
||||
test_cmp expect output &&
|
||||
git status >output &&
|
||||
test_i18ncmp expect output &&
|
||||
git config -f .gitmodules --remove-section submodule.subname
|
||||
'
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT ".git/config ignore=dirty doesn't suppress submodule summary" '
|
||||
test_expect_success ".git/config ignore=dirty doesn't suppress submodule summary" '
|
||||
git config --add -f .gitmodules submodule.subname.ignore none &&
|
||||
git config --add -f .gitmodules submodule.subname.path sm &&
|
||||
git config --add submodule.subname.ignore dirty &&
|
||||
git config --add submodule.subname.path sm &&
|
||||
git status > output &&
|
||||
test_cmp expect output &&
|
||||
git status >output &&
|
||||
test_i18ncmp expect output &&
|
||||
git config --remove-section submodule.subname &&
|
||||
git config -f .gitmodules --remove-section submodule.subname
|
||||
'
|
||||
@ -1126,9 +1108,9 @@ cat > expect << EOF
|
||||
no changes added to commit (use "git add" and/or "git commit -a")
|
||||
EOF
|
||||
|
||||
test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=all suppresses submodule summary" '
|
||||
test_expect_success "--ignore-submodules=all suppresses submodule summary" '
|
||||
git status --ignore-submodules=all > output &&
|
||||
test_cmp expect output
|
||||
test_i18ncmp expect output
|
||||
'
|
||||
|
||||
test_expect_failure '.gitmodules ignore=all suppresses submodule summary' '
|
||||
|
Loading…
Reference in New Issue
Block a user