[PATCH 2/4] test-lib.sh: add test_utf8() function

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

 



test_utf8() checks for en_US.UTF-8 locale availability using lib-locale.pl.
The function returns 1 if a locale was not found, otherwise it returns 0,
set prereq UTF8 and export GIT_LC_UTF8 with the locale name.

If a test needs to use an en_US.UTF-8 locale, it has to call test_utf8() first.
Then it can do tests based on prereq UTF8 availability and use LC_ALL=$GIT_LC_UTF8.

Signed-off-by: Yann Droneaud <yann@xxxxxxxxxxx>
---
 t/test-lib.sh |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index cb1ca97..3e92360 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1066,6 +1066,20 @@ case $(uname -s) in
 	;;
 esac
 
+# check UTF-8 locale availability
+test_utf8 () {
+    if test_have_prereq PERL ; then
+	# output an en_US.UTF-8 locale compatible name
+	GIT_LC_UTF8=`$PERL_PATH $GIT_BUILD_DIR/t/lib-locale.pl`
+    fi
+    if test -z "$GIT_LC_UTF8" ; then
+	return 1
+    else
+	test_set_prereq UTF8
+	return 0
+    fi
+}
+
 test -z "$NO_PERL" && test_set_prereq PERL
 test -z "$NO_PYTHON" && test_set_prereq PYTHON
 
-- 
1.7.3.4

--
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]