Re: [PATCH/RFC] Change t0204-gettext-reencode-sanity.sh to pass under Mac OSX

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> writes:

> Having that information doesn't cost us a lot, in this case we can
> just amend the test to assert that on OSX the output should be the
> same as under the UTF-8 output.

Known modes of error behaviour are to show:

 - runs of "?", saying "I dunno";

 - the key used to query the message catalog ("TEST: Old English
   Runes"), saying "I don't do i18n"; or

 - the raw value stored in the message catalog (runes in UTF-8).

and each makes sort-of sense in its own way.

I would be OK if the patch read like the attached, but I do not
think treating the "show key" and "stuff with ?" case differently
like the original code did makes any sense.

It may be better to clarify in the "say" comment that this test is
not about finding if the user's system is *broken* but about seeing
if the "undefined" behaviour upon user error is one that we
recognize, though.

 t/t0204-gettext-reencode-sanity.sh |   21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/t/t0204-gettext-reencode-sanity.sh b/t/t0204-gettext-reencode-sanity.sh
index 189af90..8911e93 100755
--- a/t/t0204-gettext-reencode-sanity.sh
+++ b/t/t0204-gettext-reencode-sanity.sh
@@ -7,6 +7,7 @@ test_description="Gettext reencoding of our *.po/*.mo files works"
 
 . ./lib-gettext.sh
 
+RUNES="TILRAUN: ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ"
 
 test_expect_success GETTEXT_LOCALE 'gettext: Emitting UTF-8 from our UTF-8 *.mo files / Icelandic' '
     printf "TILRAUN: Halló Heimur!" >expect &&
@@ -15,7 +16,7 @@ test_expect_success GETTEXT_LOCALE 'gettext: Emitting UTF-8 from our UTF-8 *.mo
 '
 
 test_expect_success GETTEXT_LOCALE 'gettext: Emitting UTF-8 from our UTF-8 *.mo files / Runes' '
-    printf "TILRAUN: ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ" >expect &&
+    printf "%s" "$RUNES" >expect &&
     LANGUAGE=is LC_ALL="$is_IS_locale" gettext "TEST: Old English Runes" >actual &&
     test_cmp expect actual
 '
@@ -28,15 +29,19 @@ test_expect_success GETTEXT_ISO_LOCALE 'gettext: Emitting ISO-8859-1 from our UT
 
 test_expect_success GETTEXT_ISO_LOCALE 'gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Runes' '
     LANGUAGE=is LC_ALL="$is_IS_iso_locale" gettext "TEST: Old English Runes" >runes &&
-
-	if grep "^TEST: Old English Runes$" runes
+	runes=$(cat runes) &&
+	if test "z$runes" = "zTEST: Old English Runes"
+	then
+		say "Your system gives back the key to message catalog for an impossible request"
+	elif test "z$runes" = "zTILRAUN: ?? ???? ??? ?? ???? ?? ??? ????? ??????????? ??? ?? ????"
+	then
+		say "Your system replaces an impossible character with ?"
+ 	elif test "z$runes" = "z$RUNES"
 	then
-		say "Your system can not handle this complexity and returns the string as-is"
+		say "Your system gives back the raw message for an impossible request"
 	else
-		# Both Solaris and GNU libintl will return this stream of
-		# question marks, so it is s probably portable enough
-		printf "TILRAUN: ?? ???? ??? ?? ???? ?? ??? ????? ??????????? ??? ?? ????" >runes-expect &&
-		test_cmp runes-expect runes
+		say "We error behaviour your system shows"
+		false
 	fi
 '
 



--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]