git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH/RFC 1/7] i18n: mark init-db messages for translation
Date: Tue, 12 Apr 2011 11:20:27 -0700	[thread overview]
Message-ID: <7vsjtnpc0k.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <BANLkTincUmH7SjypXfDMXDfg8BxW4MW+Jg@mail.gmail.com> ("Ævar	Arnfjörð Bjarmason"'s message of "Tue, 12 Apr 2011 09:44:58 +0200")

Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:

> Ah, thanks. Missed that. I'd have spotted it if I dug down instead of sending.
>
> I'll re-send one without the translation for this plumbing message.

No need to resend, if the reroll is just the removal of the part that
marks the fprintf() argument, and sprinkles t0001 with C_LOCALE_OUTPUT
to skip checking of the contents of .git file.

By the way, don't you think the attached is far easier to read than
artificially breaking a single test into "do" and "check" phase?  The
majority of the l10n dependent tests can and should lose C_LOCALE_OUTPUT
prerequisite and use this instead for far superiour readability, I think.

At least this makes it far more pleasant to read both the actual script
and the output in non-poison cases.

 t/test-lib.sh               |    8 ++++
 t/t5526-fetch-submodules.sh |   93 ++++++++++++++++--------------------------
 2 files changed, 44 insertions(+), 57 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index abc47f3..3e7c2bb 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1077,6 +1077,14 @@ else
 	test_set_prereq C_LOCALE_OUTPUT
 fi
 
+# Use this instead of test_cmp to compare files that contain expected and
+# actual output from git commands that can be translated.  When running
+# under GETTEXT_POISON this pretends that the command produced expected
+# results.
+test_i18ncmp () {
+	test -n "$GETTEXT_POISON" || test_cmp "$@"
+}
+
 # test whether the filesystem supports symbolic links
 ln -s x y 2>/dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS
 rm -f y
diff --git a/t/t5526-fetch-submodules.sh b/t/t5526-fetch-submodules.sh
index af78e21..a1fddd4 100755
--- a/t/t5526-fetch-submodules.sh
+++ b/t/t5526-fetch-submodules.sh
@@ -66,12 +66,9 @@ test_expect_success "fetch --recurse-submodules recurses into submodules" '
 	(
 		cd downstream &&
 		git fetch --recurse-submodules >../actual.out 2>../actual.err
-	)
-'
-
-test_expect_success C_LOCALE_OUTPUT "fetch --recurse-submodules recurses into submodules: output" '
-	test_cmp expect.out actual.out &&
-	test_cmp expect.err actual.err
+	) &&
+	test_i18ncmp expect.out actual.out &&
+	test_i18ncmp expect.err actual.err
 '
 
 test_expect_success "fetch alone only fetches superproject" '
@@ -98,12 +95,9 @@ test_expect_success "using fetchRecurseSubmodules=true in .gitmodules recurses i
 		cd downstream &&
 		git config -f .gitmodules submodule.submodule.fetchRecurseSubmodules true &&
 		git fetch >../actual.out 2>../actual.err
-	)
-'
-
-test_expect_success C_LOCALE_OUTPUT "using fetchRecurseSubmodules=true in .gitmodules recurses into submodules" '
-	test_cmp expect.out actual.out &&
-	test_cmp expect.err actual.err
+	) &&
+	test_i18ncmp expect.out actual.out &&
+	test_i18ncmp expect.err actual.err
 '
 
 test_expect_success "--no-recurse-submodules overrides .gitmodules config" '
@@ -132,12 +126,9 @@ test_expect_success "--recurse-submodules overrides fetchRecurseSubmodules setti
 		git fetch --recurse-submodules >../actual.out 2>../actual.err &&
 		git config --unset -f .gitmodules submodule.submodule.fetchRecurseSubmodules &&
 		git config --unset submodule.submodule.fetchRecurseSubmodules
-	)
-'
-
-test_expect_success C_LOCALE_OUTPUT "--recurse-submodules overrides fetchRecurseSubmodules setting from .git/config: output" '
-	test_cmp expect.out actual.out &&
-	test_cmp expect.err actual.err
+	) &&
+	test_i18ncmp expect.out actual.out &&
+	test_i18ncmp expect.err actual.err
 '
 
 test_expect_success "--quiet propagates to submodules" '
@@ -154,24 +145,18 @@ test_expect_success "--dry-run propagates to submodules" '
 	(
 		cd downstream &&
 		git fetch --recurse-submodules --dry-run >../actual.out 2>../actual.err
-	)
-'
-
-test_expect_success C_LOCALE_OUTPUT "--dry-run propagates to submodules: output" '
-	test_cmp expect.out actual.out &&
-	test_cmp expect.err actual.err
+	) &&
+	test_i18ncmp expect.out actual.out &&
+	test_i18ncmp expect.err actual.err
 '
 
 test_expect_success "Without --dry-run propagates to submodules" '
 	(
 		cd downstream &&
 		git fetch --recurse-submodules >../actual.out 2>../actual.err
-	)
-'
-
-test_expect_success C_LOCALE_OUTPUT "Without --dry-run propagates to submodules: output" '
-	test_cmp expect.out actual.out &&
-	test_cmp expect.err actual.err
+	) &&
+	test_i18ncmp expect.out actual.out &&
+	test_i18ncmp expect.err actual.err
 '
 
 test_expect_success "recurseSubmodules=true propagates into submodules" '
@@ -180,12 +165,9 @@ test_expect_success "recurseSubmodules=true propagates into submodules" '
 		cd downstream &&
 		git config fetch.recurseSubmodules true
 		git fetch >../actual.out 2>../actual.err
-	)
-'
-
-test_expect_success C_LOCALE_OUTPUT "recurseSubmodules=true propagates into submodules: output" '
-	test_cmp expect.out actual.out &&
-	test_cmp expect.err actual.err
+	) &&
+	test_i18ncmp expect.out actual.out &&
+	test_i18ncmp expect.err actual.err
 '
 
 test_expect_success "--recurse-submodules overrides config in submodule" '
@@ -197,12 +179,9 @@ test_expect_success "--recurse-submodules overrides config in submodule" '
 			git config fetch.recurseSubmodules false
 		) &&
 		git fetch --recurse-submodules >../actual.out 2>../actual.err
-	)
-'
-
-test_expect_success C_LOCALE_OUTPUT "--recurse-submodules overrides config in submodule: output" '
-	test_cmp expect.out actual.out &&
-	test_cmp expect.err actual.err
+	) &&
+	test_i18ncmp expect.out actual.out &&
+	test_i18ncmp expect.err actual.err
 '
 
 test_expect_success "--no-recurse-submodules overrides config setting" '
@@ -243,8 +222,8 @@ test_expect_success "Recursion stops when no new submodule commits are fetched"
 		cd downstream &&
 		git fetch >../actual.out 2>../actual.err
 	) &&
-	test_cmp expect.err.sub actual.err &&
-	test_cmp expect.out.sub actual.out
+	test_i18ncmp expect.err.sub actual.err &&
+	test_i18ncmp expect.out.sub actual.out
 '
 
 test_expect_success "Recursion doesn't happen when new superproject commits don't change any submodules" '
@@ -261,7 +240,7 @@ test_expect_success "Recursion doesn't happen when new superproject commits don'
 		git fetch >../actual.out 2>../actual.err
 	) &&
 	! test -s actual.out &&
-	test_cmp expect.err.file actual.err
+	test_i18ncmp expect.err.file actual.err
 '
 
 test_expect_success "Recursion picks up config in submodule" '
@@ -289,8 +268,8 @@ test_expect_success "Recursion picks up config in submodule" '
 			git config --unset fetch.recurseSubmodules
 		)
 	) &&
-	test_cmp expect.err.sub actual.err &&
-	test_cmp expect.out actual.out
+	test_i18ncmp expect.err.sub actual.err &&
+	test_i18ncmp expect.out actual.out
 '
 
 test_expect_success "Recursion picks up all submodules when necessary" '
@@ -321,8 +300,8 @@ test_expect_success "Recursion picks up all submodules when necessary" '
 		cd downstream &&
 		git fetch >../actual.out 2>../actual.err
 	) &&
-	test_cmp expect.err.2 actual.err &&
-	test_cmp expect.out actual.out
+	test_i18ncmp expect.err.2 actual.err &&
+	test_i18ncmp expect.out actual.out
 '
 
 test_expect_success "'--recurse-submodules=on-demand' doesn't recurse when no new commits are fetched in the superproject (and ignores config)" '
@@ -375,8 +354,8 @@ test_expect_success "'--recurse-submodules=on-demand' recurses as deep as necess
 			git config --unset -f .gitmodules submodule.deepsubmodule.fetchRecursive
 		)
 	) &&
-	test_cmp expect.out actual.out &&
-	test_cmp expect.err actual.err
+	test_i18ncmp expect.out actual.out &&
+	test_i18ncmp expect.err actual.err
 '
 
 test_expect_success "'--recurse-submodules=on-demand' stops when no new submodule commits are found in the superproject (and ignores config)" '
@@ -393,7 +372,7 @@ test_expect_success "'--recurse-submodules=on-demand' stops when no new submodul
 		git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err
 	) &&
 	! test -s actual.out &&
-	test_cmp expect.err.file actual.err
+	test_i18ncmp expect.err.file actual.err
 '
 
 test_expect_success "'fetch.recurseSubmodules=on-demand' overrides global config" '
@@ -420,8 +399,8 @@ test_expect_success "'fetch.recurseSubmodules=on-demand' overrides global config
 		cd downstream &&
 		git config --unset fetch.recurseSubmodules
 	) &&
-	test_cmp expect.out.sub actual.out &&
-	test_cmp expect.err.2 actual.err
+	test_i18ncmp expect.out.sub actual.out &&
+	test_i18ncmp expect.err.2 actual.err
 '
 
 test_expect_success "'submodule.<sub>.fetchRecurseSubmodules=on-demand' overrides fetch.recurseSubmodules" '
@@ -448,8 +427,8 @@ test_expect_success "'submodule.<sub>.fetchRecurseSubmodules=on-demand' override
 		cd downstream &&
 		git config --unset submodule.submodule.fetchRecurseSubmodules
 	) &&
-	test_cmp expect.out.sub actual.out &&
-	test_cmp expect.err.2 actual.err
+	test_i18ncmp expect.out.sub actual.out &&
+	test_i18ncmp expect.err.2 actual.err
 '
 
 test_expect_success "don't fetch submodule when newly recorded commits are already present" '
@@ -468,7 +447,7 @@ test_expect_success "don't fetch submodule when newly recorded commits are alrea
 		git fetch >../actual.out 2>../actual.err
 	) &&
 	! test -s actual.out &&
-	test_cmp expect.err actual.err
+	test_i18ncmp expect.err actual.err
 '
 
 test_done

  reply	other threads:[~2011-04-12 18:20 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-10 19:34 [PATCH/RFC 0/7] i18n: mark missing C messages Ævar Arnfjörð Bjarmason
2011-04-10 19:34 ` [PATCH/RFC 1/7] i18n: mark init-db messages for translation Ævar Arnfjörð Bjarmason
2011-04-12  7:12   ` Junio C Hamano
2011-04-12  7:15     ` Junio C Hamano
2011-04-12  7:44       ` Ævar Arnfjörð Bjarmason
2011-04-12 18:20         ` Junio C Hamano [this message]
2011-04-12 22:55           ` Junio C Hamano
2011-04-12 23:04             ` Junio C Hamano
2011-04-14 20:56               ` [PATCH] i18n: use test_i18n{grep,cmp} in t7508 Junio C Hamano
2011-04-10 19:34 ` [PATCH/RFC 2/7] i18n: mark merge "Could not read from" message for translation Ævar Arnfjörð Bjarmason
2011-04-10 19:34 ` [PATCH/RFC 3/7] i18n: mark merge "upstream" messages " Ævar Arnfjörð Bjarmason
2011-04-10 19:34 ` [PATCH/RFC 4/7] i18n: mark merge CHERRY_PICK_HEAD " Ævar Arnfjörð Bjarmason
2011-04-10 19:34 ` [PATCH/RFC 5/7] i18n: mark clone nonexistent repository message " Ævar Arnfjörð Bjarmason
2011-04-10 19:34 ` [PATCH/RFC 6/7] i18n: mark checkout --detach messages " Ævar Arnfjörð Bjarmason
2011-04-10 19:34 ` [PATCH/RFC 7/7] i18n: mark checkout plural warning " Ævar Arnfjörð Bjarmason
2011-04-12  7:19   ` Junio C Hamano
2011-04-12  7:54     ` Ævar Arnfjörð Bjarmason
2011-04-12 20:57       ` Junio C Hamano
2011-04-13  8:30         ` Ævar Arnfjörð Bjarmason
2011-04-13 15:55           ` Junio C Hamano
2011-04-12  7:27 ` [PATCH/RFC 0/7] i18n: mark missing C messages Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vsjtnpc0k.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).