1#!/bin/sh
23
test_description='grep icase on non-English locales'
45
. ./lib-gettext.sh
67
test_expect_success GETTEXT_LOCALE 'setup' '
8test_write_lines "TILRAUN: Halló Heimur!" >file &&
9git add file &&
10LC_ALL="$is_IS_locale" &&
11export LC_ALL
12'
1314
test_have_prereq GETTEXT_LOCALE &&
15test-regex "HALLÓ" "Halló" ICASE &&
16test_set_prereq REGEX_LOCALE
1718
test_expect_success REGEX_LOCALE 'grep literal string, no -F' '
19git grep -i "TILRAUN: Halló Heimur!" &&
20git grep -i "TILRAUN: HALLÓ HEIMUR!"
21'
2223
test_expect_success GETTEXT_LOCALE,LIBPCRE 'grep pcre utf-8 icase' '
24git grep --perl-regexp "TILRAUN: H.lló Heimur!" &&
25git grep --perl-regexp -i "TILRAUN: H.lló Heimur!" &&
26git grep --perl-regexp -i "TILRAUN: H.LLÓ HEIMUR!"
27'
2829
test_expect_success GETTEXT_LOCALE,LIBPCRE 'grep pcre utf-8 string with "+"' '
30test_write_lines "TILRAUN: Hallóó Heimur!" >file2 &&
31git add file2 &&
32git grep -l --perl-regexp "TILRAUN: H.lló+ Heimur!" >actual &&
33echo file >expected &&
34echo file2 >>expected &&
35test_cmp expected actual
36'
3738
test_expect_success REGEX_LOCALE 'grep literal string, with -F' '
39git grep --debug -i -F "TILRAUN: Halló Heimur!" 2>&1 >/dev/null |
40grep fixed >debug1 &&
41test_write_lines "fixed TILRAUN: Halló Heimur!" >expect1 &&
42test_cmp expect1 debug1 &&
4344
git grep --debug -i -F "TILRAUN: HALLÓ HEIMUR!" 2>&1 >/dev/null |
45grep fixed >debug2 &&
46test_write_lines "fixed TILRAUN: HALLÓ HEIMUR!" >expect2 &&
47test_cmp expect2 debug2
48'
4950
test_expect_success REGEX_LOCALE 'grep string with regex, with -F' '
51test_write_lines "^*TILR^AUN:.* \\Halló \$He[]imur!\$" >file &&
5253
git grep --debug -i -F "^*TILR^AUN:.* \\Halló \$He[]imur!\$" 2>&1 >/dev/null |
54grep fixed >debug1 &&
55test_write_lines "fixed \\^*TILR^AUN:\\.\\* \\\\Halló \$He\\[]imur!\\\$" >expect1 &&
56test_cmp expect1 debug1 &&
5758
git grep --debug -i -F "^*TILR^AUN:.* \\HALLÓ \$HE[]IMUR!\$" 2>&1 >/dev/null |
59grep fixed >debug2 &&
60test_write_lines "fixed \\^*TILR^AUN:\\.\\* \\\\HALLÓ \$HE\\[]IMUR!\\\$" >expect2 &&
61test_cmp expect2 debug2
62'
6364
test_expect_success REGEX_LOCALE 'pickaxe -i on non-ascii' '
65git commit -m first &&
66git log --format=%f -i -S"TILRAUN: HALLÓ HEIMUR!" >actual &&
67echo first >expected &&
68test_cmp expected actual
69'
7071
test_done