git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH/RFC 1/7] i18n: mark init-db messages for translation

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 12, 2011, 22:55 UTC
Message-ID
<7v62qjnkpe.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7vsjtnpc0k.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 7 quoted lines
> 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.

And this is for the other common pattern: use grep to find expected string.

 t/test-lib.sh   |    8 ++++++++
 t/t0001-init.sh |   10 +++++-----
 2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 3e7c2bb..b764acb 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1085,6 +1085,14 @@ test_i18ncmp () {
 	test -n "$GETTEXT_POISON" || test_cmp "$@"
 }
 
+# Use this instead of "grep expected-string actual" to see if the
+# output from a git command that acn be translated contains an
+# expected string.  When running under GETTEXT_POISON this pretends
+# that the command produced expected results.
+test_i18ngrep () {
+	test -n "$GETTEXT_POISON" || grep "$@"
+}
+
 # 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/t0001-init.sh b/t/t0001-init.sh
index a5816d0..651e098 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -180,7 +180,7 @@ test_expect_success 'GIT_DIR & GIT_WORK_TREE (2)' '
 	fi
 '
 
-test_expect_success C_LOCALE_OUTPUT 'reinit' '
+test_expect_success 'reinit' '
 
 	(
 		sane_unset GIT_CONFIG GIT_WORK_TREE GIT_CONFIG &&
@@ -190,11 +190,11 @@ test_expect_success C_LOCALE_OUTPUT 'reinit' '
 		git init >out1 2>err1 &&
 		git init >out2 2>err2
 	) &&
-	grep "Initialized empty" again/out1 &&
-	grep "Reinitialized existing" again/out2 &&
+	test_i18ngrep "Initialized empty" again/out1 &&
+	test_i18ngrep "Reinitialized existing" again/out2 &&
 	>again/empty &&
-	test_cmp again/empty again/err1 &&
-	test_cmp again/empty again/err2
+	test_i18ncmp again/empty again/err1 &&
+	test_i18ncmp again/empty again/err2
 '
 
 test_expect_success 'init with --template' '
Previous: Junio C HamanoNext: Junio C Hamano
Message 7 of 21 in “i18n: mark missing C messages”
  1. 0/7 i18n: mark missing C messagesÆvar Arnfjörð Bjarmason, Apr 10, 2011
  2. 1/7 i18n: mark init-db messages for translationÆvar Arnfjörð Bjarmason, Apr 10, 2011
  3. Junio C HamanoApr 12, 2011
  4. Junio C HamanoApr 12, 2011
  5. Ævar Arnfjörð BjarmasonApr 12, 2011
  6. Junio C HamanoApr 12, 2011
  7. Junio C HamanoApr 12, 2011
  8. Junio C HamanoApr 12, 2011
  9. i18n: use test_i18n{grep,cmp} in t7508Junio C Hamano, Apr 14, 2011
  10. 2/7 i18n: mark merge "Could not read from" message for translationÆvar Arnfjörð Bjarmason, Apr 10, 2011
  11. 3/7 i18n: mark merge "upstream" messages for translationÆvar Arnfjörð Bjarmason, Apr 10, 2011
  12. 4/7 i18n: mark merge CHERRY_PICK_HEAD messages for translationÆvar Arnfjörð Bjarmason, Apr 10, 2011
  13. 5/7 i18n: mark clone nonexistent repository message for translationÆvar Arnfjörð Bjarmason, Apr 10, 2011
  14. 6/7 i18n: mark checkout --detach messages for translationÆvar Arnfjörð Bjarmason, Apr 10, 2011
  15. 7/7 i18n: mark checkout plural warning for translationÆvar Arnfjörð Bjarmason, Apr 10, 2011
  16. Junio C HamanoApr 12, 2011
  17. Ævar Arnfjörð BjarmasonApr 12, 2011
  18. Junio C HamanoApr 12, 2011
  19. Ævar Arnfjörð BjarmasonApr 13, 2011
  20. Junio C HamanoApr 13, 2011
  21. Junio C HamanoApr 12, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.