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

From: Torsten Bögershausen <hidden>
Date: 2016-06-15 22:53:13
Subsystem: the rest · Maintainer: Linus Torvalds

t0204 tries to use a ISO-8859-1 locale and expects that characters
outside the ISO-8859-1 code range are converted in "question marks".

The gettext under Mac OS X ignores the ISO-8859-1 locale and uses
UTF-8 anyway.

Fixed even whitespace in this very test case.

Let the test pass when UTF-8 is returned.

Signed-off-by: Torsten Bögershausen <redacted>
---
 This is a suggestion to make t0204--gettext-reencode-sanity.sh to pass under Mac OSX
 The tests checks if unicode characters outside ISO-8859-1 are converted into '?'.
 The Mac OS X version of gettext does not seem to support ISO-8859-1 at all.
 Even if we set the locale to ISO-8859-1, UTF-8 is used anyway.


 t/t0204-gettext-reencode-sanity.sh |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/t/t0204-gettext-reencode-sanity.sh b/t/t0204-gettext-reencode-sanity.sh
index 189af90..78f0889 100755
--- a/t/t0204-gettext-reencode-sanity.sh
+++ b/t/t0204-gettext-reencode-sanity.sh
@@ -27,16 +27,22 @@ 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 &&
+	LANGUAGE=is LC_ALL="$is_IS_iso_locale" gettext "TEST: Old English Runes" >runes &&
 
 	if grep "^TEST: Old English Runes$" runes
 	then
 		say "Your system can not handle this complexity and returns the string as-is"
 	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
+		if grep "^TILRAUN: ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ" runes
+		then
+			# Mac OS supports only UTF-8, even if we want ISO-8859-1 we get UTF-8
+			say "Your system handles only utf-8"
+		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
+		fi
 	fi
 '
 
-- 
1.7.9.rc2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help