Subject: Re: [PATCH v3 0/9] icase match on non-ascii

From: Torsten Bögershausen <[email-masked]>
Date: Wed, 15 Jul 2015 21:51:53 +0200

> I don't see any way around it, except dropping all the tests. I don't
> think there is a way for us to test regex locale support at runtime.
> 
(I don't think dropping all tests is a good way forward)
Either there is runtime code similar to test-regex.c,
or how about something like this:

commit a1cdac0fc0df1dad20f4dc196688a73c11b00480
Author: Torsten Bögershausen <[email-masked]>
Date:   Wed Jul 15 21:43:47 2015 +0200

    t7812: More LIBPCRE preconditions

    Some (e.g. BSD based) regex libraries are not able to handle
    UTF-8 strings case-insensitive (if asked so)

    Exclude some test cases by using the LIBPCRE precondition

diff --git a/t/t7812-grep-icase-non-ascii.sh b/t/t7812-grep-icase-non-ascii.sh
index d07fa20..30d3d68 100755
--- a/t/t7812-grep-icase-non-ascii.sh
+++ b/t/t7812-grep-icase-non-ascii.sh
@@ -11,9 +11,12 @@ test_expect_success GETTEXT_LOCALE 'setup' '
 	export LC_ALL
 '

-test_expect_success GETTEXT_LOCALE 'grep literal string, no -F' '
-	git grep -i "TILRAUN: Halló Heimur!" &&
-	git grep -i "TILRAUN: HALLÓ HEIMUR!"
+test_expect_success GETTEXT_LOCALE 'grep literal low string, no -F' '
+	git grep -i "TILRAUN: Halló Heimur!"
+'
+
+test_expect_success GETTEXT_LOCALE,LIBPCRE 'grep literal up string, no -F' '
+	git grep -i "TILRAUN: HALLÓ. HEIMUR!"
 '

 test_expect_success GETTEXT_LOCALE,LIBPCRE 'grep pcre utf-8 icase' '
@@ -31,33 +34,37 @@ test_expect_success GETTEXT_LOCALE,LIBPCRE 'grep pcre utf-8
string with "+"' '
 	test_cmp expected actual
 '

-test_expect_success GETTEXT_LOCALE 'grep literal string, with -F' '
+test_expect_success GETTEXT_LOCALE 'grep literal low string, with -F' '
 	git grep --debug -i -F "TILRAUN: Halló Heimur!"  2>&1 >/dev/null |
 		 grep fixed >debug1 &&
 	echo "fixedTILRAUN: Halló Heimur!" >expect1 &&
-	test_cmp expect1 debug1 &&
+	test_cmp expect1 debug1
+'

+test_expect_success GETTEXT_LOCALE 'grep literal up string, with -F' '
 	git grep --debug -i -F "TILRAUN: HALLÓ HEIMUR!"  2>&1 >/dev/null |
 		 grep fixed >debug2 &&
 	echo "fixedTILRAUN: HALLÓ HEIMUR!" >expect2 &&
 	test_cmp expect2 debug2
 '

-test_expect_success GETTEXT_LOCALE 'grep string with regex, with -F' '
+test_expect_success GETTEXT_LOCALE,LIBPCRE 'grep string with regex, with -F' '
 	printf "^*TILR^AUN:.* \\Halló \$He[]imur!\$" >file &&

 	git grep --debug -i -F "^*TILR^AUN:.* \\Halló \$He[]imur!\$" 2>&1 >/dev/null |
 		 grep fixed >debug1 &&
 	echo "fixed\\^*TILR^AUN:\\.\\* \\\\Halló \$He\\[]imur!\\\$" >expect1 &&
-	test_cmp expect1 debug1 &&
+	test_cmp expect1 debug1
+'

+test_expect_success GETTEXT_LOCALE,LIBPCRE 'grep up string with regex, with -F' '
 	git grep --debug -i -F "^*TILR^AUN:.* \\HALLÓ \$HE[]IMUR!\$"  2>&1 >/dev/null |
 		 grep fixed >debug2 &&
 	echo "fixed\\^*TILR^AUN:\\.\\* \\\\HALLÓ \$HE\\[]IMUR!\\\$" >expect2 &&
 	test_cmp expect2 debug2
 '

-test_expect_success GETTEXT_LOCALE 'pickaxe -i on non-ascii' '
+test_expect_success GETTEXT_LOCALE,LIBPCRE 'pickaxe -i on non-ascii' '
 	git commit -m first &&
 	git log --format=%f -i -S"TILRAUN: HALLÓ HEIMUR!" >actual &&
 	echo first >expected &&