read-cache: touch shared index files when used
[alt-git.git] / t / t7812-grep-icase-non-ascii.sh
blob169fd8d7065f89ce78f5241eeb7bf376c3f3172d
1 #!/bin/sh
3 test_description='grep icase on non-English locales'
5 . ./lib-gettext.sh
7 test_expect_success GETTEXT_LOCALE 'setup' '
8 test_write_lines "TILRAUN: Halló Heimur!" >file &&
9 git add file &&
10 LC_ALL="$is_IS_locale" &&
11 export LC_ALL
14 test_have_prereq GETTEXT_LOCALE &&
15 test-regex "HALLÓ" "Halló" ICASE &&
16 test_set_prereq REGEX_LOCALE
18 test_expect_success REGEX_LOCALE 'grep literal string, no -F' '
19 git grep -i "TILRAUN: Halló Heimur!" &&
20 git grep -i "TILRAUN: HALLÓ HEIMUR!"
23 test_expect_success GETTEXT_LOCALE,LIBPCRE 'grep pcre utf-8 icase' '
24 git grep --perl-regexp "TILRAUN: H.lló Heimur!" &&
25 git grep --perl-regexp -i "TILRAUN: H.lló Heimur!" &&
26 git grep --perl-regexp -i "TILRAUN: H.LLÓ HEIMUR!"
29 test_expect_success GETTEXT_LOCALE,LIBPCRE 'grep pcre utf-8 string with "+"' '
30 test_write_lines "TILRAUN: Hallóó Heimur!" >file2 &&
31 git add file2 &&
32 git grep -l --perl-regexp "TILRAUN: H.lló+ Heimur!" >actual &&
33 echo file >expected &&
34 echo file2 >>expected &&
35 test_cmp expected actual
38 test_expect_success REGEX_LOCALE 'grep literal string, with -F' '
39 git grep --debug -i -F "TILRAUN: Halló Heimur!" 2>&1 >/dev/null |
40 grep fixed >debug1 &&
41 test_write_lines "fixed TILRAUN: Halló Heimur!" >expect1 &&
42 test_cmp expect1 debug1 &&
44 git grep --debug -i -F "TILRAUN: HALLÓ HEIMUR!" 2>&1 >/dev/null |
45 grep fixed >debug2 &&
46 test_write_lines "fixed TILRAUN: HALLÓ HEIMUR!" >expect2 &&
47 test_cmp expect2 debug2
50 test_expect_success REGEX_LOCALE 'grep string with regex, with -F' '
51 test_write_lines "^*TILR^AUN:.* \\Halló \$He[]imur!\$" >file &&
53 git grep --debug -i -F "^*TILR^AUN:.* \\Halló \$He[]imur!\$" 2>&1 >/dev/null |
54 grep fixed >debug1 &&
55 test_write_lines "fixed \\^*TILR^AUN:\\.\\* \\\\Halló \$He\\[]imur!\\\$" >expect1 &&
56 test_cmp expect1 debug1 &&
58 git grep --debug -i -F "^*TILR^AUN:.* \\HALLÓ \$HE[]IMUR!\$" 2>&1 >/dev/null |
59 grep fixed >debug2 &&
60 test_write_lines "fixed \\^*TILR^AUN:\\.\\* \\\\HALLÓ \$HE\\[]IMUR!\\\$" >expect2 &&
61 test_cmp expect2 debug2
64 test_expect_success REGEX_LOCALE 'pickaxe -i on non-ascii' '
65 git commit -m first &&
66 git log --format=%f -i -S"TILRAUN: HALLÓ HEIMUR!" >actual &&
67 echo first >expected &&
68 test_cmp expected actual
71 test_done