All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/7] Gettext poison fixes
@ 2012-08-27 22:59 Jiang Xin
  2012-08-27 22:59 ` [PATCH v3 1/7] Fix tests under GETTEXT_POISON on relative dates Jiang Xin
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Jiang Xin @ 2012-08-27 22:59 UTC (permalink / raw)
  To: Junio C Hamano, Nguyễn Thái Ngọc Duy; +Cc: Git List, Jiang Xin

With this series, the test suite should pass again with gettext
poison on.

Updates in v3:
 * patch 1/7: fix typo in commit log message.
 * patch 6/7: remove tailing '&&'.

Jiang Xin (7):
  Fix tests under GETTEXT_POISON on relative dates
  Fix tests under GETTEXT_POISON on git-stash
  Fix tests under GETTEXT_POISON on diffstat
  Fix tests under GETTEXT_POISON on git-apply
  Fix tests under GETTEXT_POISON on pack-object
  Fix tests under GETTEXT_POISON on git-remote
  Fix tests under GETTEXT_POISON on parseopt

 t/t0006-date.sh                 |  2 +-
 t/t0040-parse-options.sh        | 34 +++++++++++++++++++++++++++++-----
 t/t1300-repo-config.sh          |  2 +-
 t/t1502-rev-parse-parseopt.sh   |  2 +-
 t/t2006-checkout-index-basic.sh |  4 ++--
 t/t2107-update-index-basic.sh   |  4 ++--
 t/t3004-ls-files-basic.sh       |  4 ++--
 t/t3200-branch.sh               |  4 ++--
 t/t3501-revert-cherry-pick.sh   |  4 ++--
 t/t3903-stash.sh                |  2 +-
 t/t4006-diff-mode.sh            |  8 ++++----
 t/t4012-diff-binary.sh          |  4 ++--
 t/t4120-apply-popt.sh           |  4 ++--
 t/t4133-apply-filenames.sh      |  4 ++--
 t/t4200-rerere.sh               |  4 ++--
 t/t4202-log.sh                  |  2 +-
 t/t4205-log-pretty-formats.sh   |  4 ++--
 t/t5300-pack-object.sh          |  4 ++--
 t/t5505-remote.sh               | 28 +++++++++++++++++-----------
 t/t5530-upload-pack-error.sh    |  4 ++--
 t/t6500-gc.sh                   |  4 ++--
 t/t7508-status.sh               |  2 +-
 t/t7600-merge.sh                |  2 +-
 23 files changed, 83 insertions(+), 53 deletions(-)

-- 
1.7.12.92.g949df84

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3 1/7] Fix tests under GETTEXT_POISON on relative dates
  2012-08-27 22:59 [PATCH v3 0/7] Gettext poison fixes Jiang Xin
@ 2012-08-27 22:59 ` Jiang Xin
  2012-08-27 22:59 ` [PATCH v3 2/7] Fix tests under GETTEXT_POISON on git-stash Jiang Xin
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Jiang Xin @ 2012-08-27 22:59 UTC (permalink / raw)
  To: Junio C Hamano, Nguyễn Thái Ngọc Duy; +Cc: Git List, Jiang Xin

Use a i18n-specific test_i18ncmp in t/t0006-date.sh for relative dates
tests. This issue was was introduced in v1.7.10-230-g7d29a:

    7d29a i18n: mark relative dates for translation

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 t/t0006-date.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t0006-date.sh b/t/t0006-date.sh
index 1d29..e53cf 100755
--- a/t/t0006-date.sh
+++ b/t/t0006-date.sh
@@ -11,7 +11,7 @@ check_show() {
 	echo "$t -> $2" >expect
 	test_expect_${3:-success} "relative date ($2)" "
 	test-date show $t >actual &&
-	test_cmp expect actual
+	test_i18ncmp expect actual
 	"
 }
 
-- 
1.7.12.92.g949df84

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3 2/7] Fix tests under GETTEXT_POISON on git-stash
  2012-08-27 22:59 [PATCH v3 0/7] Gettext poison fixes Jiang Xin
  2012-08-27 22:59 ` [PATCH v3 1/7] Fix tests under GETTEXT_POISON on relative dates Jiang Xin
@ 2012-08-27 22:59 ` Jiang Xin
  2012-08-27 22:59 ` [PATCH v3 3/7] Fix tests under GETTEXT_POISON on diffstat Jiang Xin
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Jiang Xin @ 2012-08-27 22:59 UTC (permalink / raw)
  To: Junio C Hamano, Nguyễn Thái Ngọc Duy; +Cc: Git List, Jiang Xin

Use i18n-specific test functions in test scripts for git-stash.
This issue was was introduced in v1.7.4.1-119-g355ec:

    355ec i18n: git-status basic messages

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 t/t3903-stash.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index cd0426..5dfbd 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -610,7 +610,7 @@ test_expect_success 'stash apply shows status same as git status (relative to cu
 		git stash apply
 	) |
 	sed -e 1,2d >actual && # drop "Saved..." and "HEAD is now..."
-	test_cmp expect actual
+	test_i18ncmp expect actual
 '
 
 cat > expect << EOF
-- 
1.7.12.92.g949df84

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3 3/7] Fix tests under GETTEXT_POISON on diffstat
  2012-08-27 22:59 [PATCH v3 0/7] Gettext poison fixes Jiang Xin
  2012-08-27 22:59 ` [PATCH v3 1/7] Fix tests under GETTEXT_POISON on relative dates Jiang Xin
  2012-08-27 22:59 ` [PATCH v3 2/7] Fix tests under GETTEXT_POISON on git-stash Jiang Xin
@ 2012-08-27 22:59 ` Jiang Xin
  2012-08-27 22:59 ` [PATCH v3 4/7] Fix tests under GETTEXT_POISON on git-apply Jiang Xin
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Jiang Xin @ 2012-08-27 22:59 UTC (permalink / raw)
  To: Junio C Hamano, Nguyễn Thái Ngọc Duy; +Cc: Git List, Jiang Xin

Use i18n-specific test functions in test scripts for diffstat.
This issue was was introduced in v1.7.9-1-g7f814:

    7f814 Use correct grammar in diffstat summary line

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 t/t4006-diff-mode.sh          | 8 ++++----
 t/t4202-log.sh                | 2 +-
 t/t4205-log-pretty-formats.sh | 4 ++--
 t/t7508-status.sh             | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/t/t4006-diff-mode.sh b/t/t4006-diff-mode.sh
index 7a3e1..3d4b1 100755
--- a/t/t4006-diff-mode.sh
+++ b/t/t4006-diff-mode.sh
@@ -36,24 +36,24 @@ test_expect_success '--stat output after text chmod' '
 	test_chmod -x rezrov &&
 	echo " 0 files changed" >expect &&
 	git diff HEAD --stat >actual &&
-	test_cmp expect actual
+	test_i18ncmp expect actual
 '
 
 test_expect_success '--shortstat output after text chmod' '
 	git diff HEAD --shortstat >actual &&
-	test_cmp expect actual
+	test_i18ncmp expect actual
 '
 
 test_expect_success '--stat output after binary chmod' '
 	test_chmod +x binbin &&
 	echo " 0 files changed" >expect &&
 	git diff HEAD --stat >actual &&
-	test_cmp expect actual
+	test_i18ncmp expect actual
 '
 
 test_expect_success '--shortstat output after binary chmod' '
 	git diff HEAD --shortstat >actual &&
-	test_cmp expect actual
+	test_i18ncmp expect actual
 '
 
 test_done
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index 71be5..31869 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -803,7 +803,7 @@ sanitize_output () {
 test_expect_success 'log --graph with diff and stats' '
 	git log --graph --pretty=short --stat -p >actual &&
 	sanitize_output >actual.sanitized <actual &&
-	test_cmp expect actual.sanitized
+	test_i18ncmp expect actual.sanitized
 '
 
 test_done
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index 4afd77..2c45d 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -88,7 +88,7 @@ test_expect_success 'NUL separation with --stat' '
 	stat1_part=$(git diff --stat --root HEAD^) &&
 	printf "add bar\n$stat0_part\n\0initial\n$stat1_part\n" >expected &&
 	git log -z --stat --pretty="format:%s" >actual &&
-	test_cmp expected actual
+	test_i18ncmp expected actual
 '
 
 test_expect_failure 'NUL termination with --stat' '
@@ -96,7 +96,7 @@ test_expect_failure 'NUL termination with --stat' '
 	stat1_part=$(git diff --stat --root HEAD^) &&
 	printf "add bar\n$stat0_part\n\0initial\n$stat1_part\n\0" >expected &&
 	git log -z --stat --pretty="tformat:%s" >actual &&
-	test_cmp expected actual
+	test_i18ncmp expected actual
 '
 
 test_done
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index c206f..e313e 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -80,7 +80,7 @@ test_expect_success 'status --column' '
 #	dir1/untracked dir2/untracked untracked
 #	dir2/modified  output
 EOF
-	test_cmp expect output
+	test_i18ncmp expect output
 '
 
 cat >expect <<\EOF
-- 
1.7.12.92.g949df84

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3 4/7] Fix tests under GETTEXT_POISON on git-apply
  2012-08-27 22:59 [PATCH v3 0/7] Gettext poison fixes Jiang Xin
                   ` (2 preceding siblings ...)
  2012-08-27 22:59 ` [PATCH v3 3/7] Fix tests under GETTEXT_POISON on diffstat Jiang Xin
@ 2012-08-27 22:59 ` Jiang Xin
  2012-08-27 22:59 ` [PATCH v3 5/7] Fix tests under GETTEXT_POISON on pack-object Jiang Xin
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Jiang Xin @ 2012-08-27 22:59 UTC (permalink / raw)
  To: Junio C Hamano, Nguyễn Thái Ngọc Duy; +Cc: Git List, Jiang Xin

Use i18n-specific test functions in test scripts for git-apply.
This issue was was introduced in the following commits:

    de373 i18n: apply: mark parseopt strings for translation
    3638e i18n: apply: mark strings for translation

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 t/t4012-diff-binary.sh     | 4 ++--
 t/t4120-apply-popt.sh      | 4 ++--
 t/t4133-apply-filenames.sh | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh
index ec4de..1215a 100755
--- a/t/t4012-diff-binary.sh
+++ b/t/t4012-diff-binary.sh
@@ -63,7 +63,7 @@ test_expect_success 'apply --numstat understands diff --binary format' '
 
 # apply needs to be able to skip the binary material correctly
 # in order to report the line number of a corrupt patch.
-test_expect_success 'apply detecting corrupt patch correctly' '
+test_expect_success C_LOCALE_OUTPUT 'apply detecting corrupt patch correctly' '
 	git diff >output &&
 	sed -e "s/-CIT/xCIT/" <output >broken &&
 	test_must_fail git apply --stat --summary broken 2>detected &&
@@ -73,7 +73,7 @@ test_expect_success 'apply detecting corrupt patch correctly' '
 	test "$detected" = xCIT
 '
 
-test_expect_success 'apply detecting corrupt patch correctly' '
+test_expect_success C_LOCALE_OUTPUT 'apply detecting corrupt patch correctly' '
 	git diff --binary | sed -e "s/-CIT/xCIT/" >broken &&
 	test_must_fail git apply --stat --summary broken 2>detected &&
 	detected=`cat detected` &&
diff --git a/t/t4120-apply-popt.sh b/t/t4120-apply-popt.sh
index a33d5..c5fec 100755
--- a/t/t4120-apply-popt.sh
+++ b/t/t4120-apply-popt.sh
@@ -32,7 +32,7 @@ test_expect_success 'apply git diff with -p2' '
 test_expect_success 'apply with too large -p' '
 	cp file1.saved file1 &&
 	test_must_fail git apply --stat -p3 patch.file 2>err &&
-	grep "removing 3 leading" err
+	test_i18ngrep "removing 3 leading" err
 '
 
 test_expect_success 'apply (-p2) traditional diff with funny filenames' '
@@ -54,7 +54,7 @@ test_expect_success 'apply (-p2) traditional diff with funny filenames' '
 test_expect_success 'apply with too large -p and fancy filename' '
 	cp file1.saved file1 &&
 	test_must_fail git apply --stat -p3 patch.escaped 2>err &&
-	grep "removing 3 leading" err
+	test_i18ngrep "removing 3 leading" err
 '
 
 test_expect_success 'apply (-p2) diff, mode change only' '
diff --git a/t/t4133-apply-filenames.sh b/t/t4133-apply-filenames.sh
index 94da9..2ecb4 100755
--- a/t/t4133-apply-filenames.sh
+++ b/t/t4133-apply-filenames.sh
@@ -30,9 +30,9 @@ EOF
 
 test_expect_success 'apply diff with inconsistent filenames in headers' '
 	test_must_fail git apply bad1.patch 2>err &&
-	grep "inconsistent new filename" err &&
+	test_i18ngrep "inconsistent new filename" err &&
 	test_must_fail git apply bad2.patch 2>err &&
-	grep "inconsistent old filename" err
+	test_i18ngrep "inconsistent old filename" err
 '
 
 test_done
-- 
1.7.12.92.g949df84

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3 5/7] Fix tests under GETTEXT_POISON on pack-object
  2012-08-27 22:59 [PATCH v3 0/7] Gettext poison fixes Jiang Xin
                   ` (3 preceding siblings ...)
  2012-08-27 22:59 ` [PATCH v3 4/7] Fix tests under GETTEXT_POISON on git-apply Jiang Xin
@ 2012-08-27 22:59 ` Jiang Xin
  2012-08-27 22:59 ` [PATCH v3 6/7] Fix tests under GETTEXT_POISON on git-remote Jiang Xin
  2012-08-27 22:59 ` [PATCH v3 7/7] Fix tests under GETTEXT_POISON on parseopt Jiang Xin
  6 siblings, 0 replies; 8+ messages in thread
From: Jiang Xin @ 2012-08-27 22:59 UTC (permalink / raw)
  To: Junio C Hamano, Nguyễn Thái Ngọc Duy; +Cc: Git List, Jiang Xin

Use i18n-specific test functions in test scripts for pack-object.
This issue was was introduced in v1.7.10.2-556-g46140:

    46140 index-pack: use streaming interface for collision test on large blobs
    cf2ba pack-objects: use streaming interface for reading large loose blobs

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 t/t5300-pack-object.sh       | 4 ++--
 t/t5530-upload-pack-error.sh | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
index 2e52..a07c8 100755
--- a/t/t5300-pack-object.sh
+++ b/t/t5300-pack-object.sh
@@ -416,11 +416,11 @@ test_expect_success \
 test_expect_success \
     'make sure index-pack detects the SHA1 collision' \
     'test_must_fail git index-pack -o bad.idx test-3.pack 2>msg &&
-     grep "SHA1 COLLISION FOUND" msg'
+     test_i18ngrep "SHA1 COLLISION FOUND" msg'
 
 test_expect_success \
     'make sure index-pack detects the SHA1 collision (large blobs)' \
     'test_must_fail git -c core.bigfilethreshold=1 index-pack -o bad.idx test-3.pack 2>msg &&
-     grep "SHA1 COLLISION FOUND" msg'
+     test_i18ngrep "SHA1 COLLISION FOUND" msg'
 
 test_done
diff --git a/t/t5530-upload-pack-error.sh b/t/t5530-upload-pack-error.sh
index 6b2a5f..c983d 100755
--- a/t/t5530-upload-pack-error.sh
+++ b/t/t5530-upload-pack-error.sh
@@ -35,8 +35,8 @@ test_expect_success 'upload-pack fails due to error in pack-objects packing' '
 	printf "0032want %s\n00000009done\n0000" \
 		$(git rev-parse HEAD) >input &&
 	test_must_fail git upload-pack . <input >/dev/null 2>output.err &&
-	grep "unable to read" output.err &&
-	grep "pack-objects died" output.err
+	test_i18ngrep "unable to read" output.err &&
+	test_i18ngrep "pack-objects died" output.err
 '
 
 test_expect_success 'corrupt repo differently' '
-- 
1.7.12.92.g949df84

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3 6/7] Fix tests under GETTEXT_POISON on git-remote
  2012-08-27 22:59 [PATCH v3 0/7] Gettext poison fixes Jiang Xin
                   ` (4 preceding siblings ...)
  2012-08-27 22:59 ` [PATCH v3 5/7] Fix tests under GETTEXT_POISON on pack-object Jiang Xin
@ 2012-08-27 22:59 ` Jiang Xin
  2012-08-27 22:59 ` [PATCH v3 7/7] Fix tests under GETTEXT_POISON on parseopt Jiang Xin
  6 siblings, 0 replies; 8+ messages in thread
From: Jiang Xin @ 2012-08-27 22:59 UTC (permalink / raw)
  To: Junio C Hamano, Nguyễn Thái Ngọc Duy; +Cc: Git List, Jiang Xin

Use i18n-specific test functions in test scripts for git-remote, and
bypass some testcases using C_LOCALE_OUTPUT prereq flag. This issue
was was introduced in v1.7.10-233-gbb16d5:

    bb16d5 i18n: remote: mark strings for translation

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 t/t5505-remote.sh | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index e8af6..4b720 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -52,7 +52,7 @@ test_expect_success setup '
 
 '
 
-test_expect_success 'remote information for the origin' '
+test_expect_success C_LOCALE_OUTPUT 'remote information for the origin' '
 (
 	cd test &&
 	tokens_match origin "$(git remote)" &&
@@ -66,8 +66,6 @@ test_expect_success 'add another remote' '
 	cd test &&
 	git remote add -f second ../two &&
 	tokens_match "origin second" "$(git remote)" &&
-	check_remote_track origin master side &&
-	check_remote_track second master side another &&
 	check_tracking_branch second master side another &&
 	git for-each-ref "--format=%(refname)" refs/remotes |
 	sed -e "/^refs\/remotes\/origin\//d" \
@@ -77,6 +75,14 @@ test_expect_success 'add another remote' '
 )
 '
 
+test_expect_success C_LOCALE_OUTPUT 'check tracking for add another remote' '
+(
+	cd test &&
+	check_remote_track origin master side &&
+	check_remote_track second master side another
+)
+'
+
 test_expect_success 'remote forces tracking branches' '
 (
 	cd test &&
@@ -95,7 +101,7 @@ test_expect_success 'remove remote' '
 )
 '
 
-test_expect_success 'remove remote' '
+test_expect_success C_LOCALE_OUTPUT 'remove remote' '
 (
 	cd test &&
 	tokens_match origin "$(git remote)" &&
@@ -131,8 +137,8 @@ EOF
 	git remote rm oops 2>actual2 &&
 	git branch -d foobranch &&
 	git tag -d footag &&
-	test_cmp expect1 actual1 &&
-	test_cmp expect2 actual2
+	test_i18ncmp expect1 actual1 &&
+	test_i18ncmp expect2 actual2
 )
 '
 
@@ -192,7 +198,7 @@ test_expect_success 'show' '
 	 git config --add remote.two.push refs/heads/master:refs/heads/another &&
 	 git remote show origin two > output &&
 	 git branch -d rebase octopus &&
-	 test_cmp expect output)
+	 test_i18ncmp expect output)
 '
 
 cat > test/expect << EOF
@@ -217,7 +223,7 @@ test_expect_success 'show -n' '
 	 cd test &&
 	 git remote show -n origin > output &&
 	 mv ../one.unreachable ../one &&
-	 test_cmp expect output)
+	 test_i18ncmp expect output)
 '
 
 test_expect_success 'prune' '
@@ -255,7 +261,7 @@ EOF
 test_expect_success 'set-head --auto fails w/multiple HEADs' '
 	(cd test &&
 	 test_must_fail git remote set-head --auto two >output 2>&1 &&
-	test_cmp expect output)
+	test_i18ncmp expect output)
 '
 
 cat >test/expect <<EOF
@@ -285,7 +291,7 @@ test_expect_success 'prune --dry-run' '
 	 test_must_fail git rev-parse refs/remotes/origin/side &&
 	(cd ../one &&
 	 git branch -m side side2) &&
-	 test_cmp expect output)
+	 test_i18ncmp expect output)
 '
 
 test_expect_success 'add --mirror && prune' '
@@ -705,7 +711,7 @@ test_expect_success 'remote prune to cause a dangling symref' '
 		cd seven &&
 		git remote prune origin
 	) >err 2>&1 &&
-	grep "has become dangling" err &&
+	test_i18ngrep "has become dangling" err &&
 
 	: And the dangling symref will not cause other annoying errors &&
 	(
-- 
1.7.12.92.g949df84

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3 7/7] Fix tests under GETTEXT_POISON on parseopt
  2012-08-27 22:59 [PATCH v3 0/7] Gettext poison fixes Jiang Xin
                   ` (5 preceding siblings ...)
  2012-08-27 22:59 ` [PATCH v3 6/7] Fix tests under GETTEXT_POISON on git-remote Jiang Xin
@ 2012-08-27 22:59 ` Jiang Xin
  6 siblings, 0 replies; 8+ messages in thread
From: Jiang Xin @ 2012-08-27 22:59 UTC (permalink / raw)
  To: Junio C Hamano, Nguyễn Thái Ngọc Duy; +Cc: Git List, Jiang Xin

Use i18n-specific test functions in test scripts for parseopt tests.
This issue was was introduced in v1.7.10.1-488-g54e6d:

    54e6d i18n: parseopt: lookup help and argument translations when showing usage

and been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 t/t0040-parse-options.sh        | 34 +++++++++++++++++++++++++++++-----
 t/t1300-repo-config.sh          |  2 +-
 t/t1502-rev-parse-parseopt.sh   |  2 +-
 t/t2006-checkout-index-basic.sh |  4 ++--
 t/t2107-update-index-basic.sh   |  4 ++--
 t/t3004-ls-files-basic.sh       |  4 ++--
 t/t3200-branch.sh               |  4 ++--
 t/t3501-revert-cherry-pick.sh   |  4 ++--
 t/t4200-rerere.sh               |  4 ++--
 t/t6500-gc.sh                   |  4 ++--
 t/t7600-merge.sh                |  2 +-
 11 files changed, 46 insertions(+), 22 deletions(-)

diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh
index e3f35..244a4 100755
--- a/t/t0040-parse-options.sh
+++ b/t/t0040-parse-options.sh
@@ -51,7 +51,7 @@ EOF
 test_expect_success 'test help' '
 	test_must_fail test-parse-options -h > output 2> output.err &&
 	test ! -s output.err &&
-	test_cmp expect output
+	test_i18ncmp expect output
 '
 
 mv expect expect.err
@@ -79,6 +79,17 @@ check() {
 	test_cmp expect output
 }
 
+check_i18n() {
+	what="$1" &&
+	shift &&
+	expect="$1" &&
+	shift &&
+	sed "s/^$what .*/$what $expect/" <expect.template >expect &&
+	test-parse-options $* >output 2>output.err &&
+	test ! -s output.err &&
+	test_i18ncmp expect output
+}
+
 check_unknown() {
 	case "$1" in
 	--*)
@@ -92,6 +103,19 @@ check_unknown() {
 	test_cmp expect output.err
 }
 
+check_unknown_i18n() {
+	case "$1" in
+	--*)
+		echo error: unknown option \`${1#--}\' >expect ;;
+	-*)
+		echo error: unknown switch \`${1#-}\' >expect ;;
+	esac &&
+	cat expect.err >>expect &&
+	test_must_fail test-parse-options $* >output 2>output.err &&
+	test ! -s output &&
+	test_i18ncmp expect output.err
+}
+
 test_expect_success 'OPT_BOOL() #1' 'check boolean: 1 --yes'
 test_expect_success 'OPT_BOOL() #2' 'check boolean: 1 --no-doubt'
 test_expect_success 'OPT_BOOL() #3' 'check boolean: 1 -D'
@@ -104,8 +128,8 @@ test_expect_success 'OPT_BOOL() is idempotent #2' 'check boolean: 1 -DB'
 test_expect_success 'OPT_BOOL() negation #1' 'check boolean: 0 -D --no-yes'
 test_expect_success 'OPT_BOOL() negation #2' 'check boolean: 0 -D --no-no-doubt'
 
-test_expect_success 'OPT_BOOL() no negation #1' 'check_unknown --fear'
-test_expect_success 'OPT_BOOL() no negation #2' 'check_unknown --no-no-fear'
+test_expect_success 'OPT_BOOL() no negation #1' 'check_unknown_i18n --fear'
+test_expect_success 'OPT_BOOL() no negation #2' 'check_unknown_i18n --no-no-fear'
 
 test_expect_success 'OPT_BOOL() positivation' 'check boolean: 0 -D --doubt'
 
@@ -310,8 +334,8 @@ EOF
 
 test_expect_success 'OPT_CALLBACK() and callback errors work' '
 	test_must_fail test-parse-options --no-length > output 2> output.err &&
-	test_cmp expect output &&
-	test_cmp expect.err output.err
+	test_i18ncmp expect output &&
+	test_i18ncmp expect.err output.err
 '
 
 cat > expect <<EOF
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index a477..e127f 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -391,7 +391,7 @@ test_expect_success 'get bool variable with empty value' \
 
 test_expect_success 'no arguments, but no crash' '
 	test_must_fail git config >output 2>&1 &&
-	grep usage output
+	test_i18ngrep usage output
 '
 
 cat > .git/config << EOF
diff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh
index 1efd7..13c88 100755
--- a/t/t1502-rev-parse-parseopt.sh
+++ b/t/t1502-rev-parse-parseopt.sh
@@ -41,7 +41,7 @@ EOF
 
 test_expect_success 'test --parseopt help output' '
 	test_expect_code 129 git rev-parse --parseopt -- -h > output < optionspec &&
-	test_cmp expect output
+	test_i18ncmp expect output
 '
 
 cat > expect <<EOF
diff --git a/t/t2006-checkout-index-basic.sh b/t/t2006-checkout-index-basic.sh
index b855..57cbd 100755
--- a/t/t2006-checkout-index-basic.sh
+++ b/t/t2006-checkout-index-basic.sh
@@ -7,7 +7,7 @@ test_description='basic checkout-index tests
 
 test_expect_success 'checkout-index --gobbledegook' '
 	test_expect_code 129 git checkout-index --gobbledegook 2>err &&
-	grep "[Uu]sage" err
+	test_i18ngrep "[Uu]sage" err
 '
 
 test_expect_success 'checkout-index -h in broken repository' '
@@ -18,7 +18,7 @@ test_expect_success 'checkout-index -h in broken repository' '
 		>.git/index &&
 		test_expect_code 129 git checkout-index -h >usage 2>&1
 	) &&
-	grep "[Uu]sage" broken/usage
+	test_i18ngrep "[Uu]sage" broken/usage
 '
 
 test_done
diff --git a/t/t2107-update-index-basic.sh b/t/t2107-update-index-basic.sh
index 809fa..17d69 100755
--- a/t/t2107-update-index-basic.sh
+++ b/t/t2107-update-index-basic.sh
@@ -15,7 +15,7 @@ test_expect_success 'update-index --nonsense fails' '
 
 test_expect_success 'update-index --nonsense dumps usage' '
 	test_expect_code 129 git update-index --nonsense 2>err &&
-	grep "[Uu]sage: git update-index" err
+	test_i18ngrep "[Uu]sage: git update-index" err
 '
 
 test_expect_success 'update-index -h with corrupt index' '
@@ -26,7 +26,7 @@ test_expect_success 'update-index -h with corrupt index' '
 		>.git/index &&
 		test_expect_code 129 git update-index -h >usage 2>&1
 	) &&
-	grep "[Uu]sage: git update-index" broken/usage
+	test_i18ngrep "[Uu]sage: git update-index" broken/usage
 '
 
 test_done
diff --git a/t/t3004-ls-files-basic.sh b/t/t3004-ls-files-basic.sh
index 490e05..8d9bc 100755
--- a/t/t3004-ls-files-basic.sh
+++ b/t/t3004-ls-files-basic.sh
@@ -22,7 +22,7 @@ test_expect_success 'ls-files with nonexistent path' '
 
 test_expect_success 'ls-files with nonsense option' '
 	test_expect_code 129 git ls-files --nonsense 2>actual &&
-	grep "[Uu]sage: git ls-files" actual
+	test_i18ngrep "[Uu]sage: git ls-files" actual
 '
 
 test_expect_success 'ls-files -h in corrupt repository' '
@@ -33,7 +33,7 @@ test_expect_success 'ls-files -h in corrupt repository' '
 		>.git/index &&
 		test_expect_code 129 git ls-files -h >usage 2>&1
 	) &&
-	grep "[Uu]sage: git ls-files " broken/usage
+	test_i18ngrep "[Uu]sage: git ls-files " broken/usage
 '
 
 test_done
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index a17f8..1ffce 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -31,7 +31,7 @@ test_expect_success 'branch -h in broken repository' '
 		>.git/refs/heads/master &&
 		test_expect_code 129 git branch -h >usage 2>&1
 	) &&
-	grep "[Uu]sage" broken/usage
+	test_i18ngrep "[Uu]sage" broken/usage
 '
 
 test_expect_success \
@@ -74,7 +74,7 @@ test_expect_success \
 test_expect_success \
     'git branch -m dumps usage' \
        'test_expect_code 129 git branch -m 2>err &&
-	grep "[Uu]sage: git branch" err'
+	test_i18ngrep "[Uu]sage: git branch" err'
 
 test_expect_success \
     'git branch -m m m/m should work' \
diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh
index 595d2..34c86e 100755
--- a/t/t3501-revert-cherry-pick.sh
+++ b/t/t3501-revert-cherry-pick.sh
@@ -47,7 +47,7 @@ test_expect_success 'cherry-pick --nonsense' '
 	git diff --exit-code HEAD &&
 	test_must_fail git cherry-pick --nonsense 2>msg &&
 	git diff --exit-code HEAD "$pos" &&
-	grep '[Uu]sage:' msg
+	test_i18ngrep '[Uu]sage:' msg
 '
 
 test_expect_success 'revert --nonsense' '
@@ -56,7 +56,7 @@ test_expect_success 'revert --nonsense' '
 	git diff --exit-code HEAD &&
 	test_must_fail git revert --nonsense 2>msg &&
 	git diff --exit-code HEAD "$pos" &&
-	grep '[Uu]sage:' msg
+	test_i18ngrep '[Uu]sage:' msg
 '
 
 test_expect_success 'cherry-pick after renaming branch' '
diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh
index 3ab67..7f666 100755
--- a/t/t4200-rerere.sh
+++ b/t/t4200-rerere.sh
@@ -382,13 +382,13 @@ test_expect_success 'rerere --no-no-rerere-autoupdate' '
 	git update-index --index-info <failedmerge &&
 	cp file3.conflict file3 &&
 	test_must_fail git rerere --no-no-rerere-autoupdate 2>err &&
-	grep [Uu]sage err &&
+	test_i18ngrep [Uu]sage err &&
 	test_must_fail git update-index --refresh
 '
 
 test_expect_success 'rerere -h' '
 	test_must_fail git rerere -h >help &&
-	grep [Uu]sage help
+	test_i18ngrep [Uu]sage help
 '
 
 test_done
diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh
index 82f36..b1a63 100755
--- a/t/t6500-gc.sh
+++ b/t/t6500-gc.sh
@@ -11,7 +11,7 @@ test_expect_success 'gc empty repository' '
 
 test_expect_success 'gc --gobbledegook' '
 	test_expect_code 129 git gc --nonsense 2>err &&
-	grep "[Uu]sage: git gc" err
+	test_i18ngrep "[Uu]sage: git gc" err
 '
 
 test_expect_success 'gc -h with invalid configuration' '
@@ -22,7 +22,7 @@ test_expect_success 'gc -h with invalid configuration' '
 		echo "[gc] pruneexpire = CORRUPT" >>.git/config &&
 		test_expect_code 129 git gc -h >usage 2>&1
 	) &&
-	grep "[Uu]sage" broken/usage
+	test_i18ngrep "[Uu]sage" broken/usage
 '
 
 test_done
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index 9e27b..5e195 100755
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
@@ -157,7 +157,7 @@ test_expect_success 'merge -h with invalid index' '
 		>.git/index &&
 		test_expect_code 129 git merge -h 2>usage
 	) &&
-	grep "[Uu]sage: git merge" broken/usage
+	test_i18ngrep "[Uu]sage: git merge" broken/usage
 '
 
 test_expect_success 'reject non-strategy with a git-merge-foo name' '
-- 
1.7.12.92.g949df84

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-08-27 22:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-27 22:59 [PATCH v3 0/7] Gettext poison fixes Jiang Xin
2012-08-27 22:59 ` [PATCH v3 1/7] Fix tests under GETTEXT_POISON on relative dates Jiang Xin
2012-08-27 22:59 ` [PATCH v3 2/7] Fix tests under GETTEXT_POISON on git-stash Jiang Xin
2012-08-27 22:59 ` [PATCH v3 3/7] Fix tests under GETTEXT_POISON on diffstat Jiang Xin
2012-08-27 22:59 ` [PATCH v3 4/7] Fix tests under GETTEXT_POISON on git-apply Jiang Xin
2012-08-27 22:59 ` [PATCH v3 5/7] Fix tests under GETTEXT_POISON on pack-object Jiang Xin
2012-08-27 22:59 ` [PATCH v3 6/7] Fix tests under GETTEXT_POISON on git-remote Jiang Xin
2012-08-27 22:59 ` [PATCH v3 7/7] Fix tests under GETTEXT_POISON on parseopt Jiang Xin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.