Re: [PATCH 6/7] Fix tests under GETTEXT_POISON on git-remote

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 6/7] Fix tests under GETTEXT_POISON on git-remote

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:54:32

Nguyễn Thái Ngọc Duy [off-list ref] writes:
quoted hunk
From: Jiang Xin <redacted>

Use i18n-specific test functions in test scripts for git-remote.
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 <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 t/t5505-remote.sh | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index e8af615..07045e3 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -27,10 +27,16 @@ tokens_match () {
 	test_cmp expect actual
 }
 
+tokens_i18nmatch () {
+	echo "$1" | tr ' ' '\012' | sort | sed -e '/^$/d' >expect &&
+	echo "$2" | tr ' ' '\012' | sort | sed -e '/^$/d' >actual &&
+	test_i18ncmp expect actual
+}
+
 check_remote_track () {
 	actual=$(git remote show "$1" | sed -ne 's|^    \(.*\) tracked$|\1|p')
 	shift &&
-	tokens_match "$*" "$actual"
+	tokens_i18nmatch "$*" "$actual"
 }
Which part of the output from "git remote show" does this test
expect to be translated?  Specifically, does "tracked" ever get
translated?

It appears that _(" tracked") is indeed marked for translation in
the source, so how can we expect value in $actual be any useful for
any comparison?

Confused...

Re: [PATCH 6/7] Fix tests under GETTEXT_POISON on git-remote

From: Jiang Xin <hidden>
Date: 2016-06-15 22:54:32

2012/8/22 Junio C Hamano [off-list ref]:
Which part of the output from "git remote show" does this test
expect to be translated?  Specifically, does "tracked" ever get
translated?

It appears that _(" tracked") is indeed marked for translation in
the source, so how can we expect value in $actual be any useful for
any comparison?

Confused...
Yes, because _("tracked") is marked for translation,  check_remote_track()
is hard to do right.
 check_remote_track () {
        actual=$(git remote show "$1" | sed -ne 's|^    \(.*\) tracked$|\1|p')
        shift &&
-       tokens_match "$*" "$actual"
+       tokens_i18nmatch "$*" "$actual"
 }
Output of command "git remote show origin" is:

    # GETTEXT POISON #
    # GETTEXT POISON #
    # GETTEXT POISON #
    # GETTEXT POISON #
    # GETTEXT POISON #
        master# GETTEXT POISON #
        side  # GETTEXT POISON #

Maybe we should bypass all testcases which calling check_remote_track().
Changing 'tokens_match' to 'tokens_i18nmatch' won't fix but hide the problem.

- test_expect_success 'remote information for the origin' '
+ test_expect_success C_LOCALE_OUTPUT 'remote information for the origin' '

- test_expect_succes 'remove remote' '
+ test_expect_success C_LOCALE_OUTPUT 'remove remote' '

- test_expect_success 'add another remote' '
+ test_expect_success C_LOCALE_OUTPUT 'add another remote' '

-- 
Jiang Xin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help