ci: skip GitHub workflow runs for already-tested commits/trees
[git.git] / t / t7812-grep-icase-non-ascii.sh
blob03dba6685ab7a0fc3d19a48196e5987d714ba62e
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-tool 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,PCRE '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,PCRE '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 -i -F "TILRAUN: Halló Heimur!" &&
40 git grep -i -F "TILRAUN: HALLÓ HEIMUR!"
43 test_expect_success REGEX_LOCALE 'grep string with regex, with -F' '
44 test_write_lines "TILRAUN: Halló Heimur [abc]!" >file3 &&
45 git add file3 &&
46 git grep -i -F "TILRAUN: Halló Heimur [abc]!" file3
49 test_expect_success REGEX_LOCALE 'pickaxe -i on non-ascii' '
50 git commit -m first &&
51 git log --format=%f -i -S"TILRAUN: HALLÓ HEIMUR!" >actual &&
52 echo first >expected &&
53 test_cmp expected actual
56 test_expect_success GETTEXT_LOCALE,LIBPCRE2 'PCRE v2: setup invalid UTF-8 data' '
57 printf "\\200\\n" >invalid-0x80 &&
58 echo "ævar" >expected &&
59 cat expected >>invalid-0x80 &&
60 git add invalid-0x80
63 test_expect_success GETTEXT_LOCALE,LIBPCRE2 'PCRE v2: grep ASCII from invalid UTF-8 data' '
64 git grep -h "var" invalid-0x80 >actual &&
65 test_cmp expected actual &&
66 git grep -h "(*NO_JIT)var" invalid-0x80 >actual &&
67 test_cmp expected actual
70 test_expect_success GETTEXT_LOCALE,LIBPCRE2 'PCRE v2: grep non-ASCII from invalid UTF-8 data' '
71 git grep -h "æ" invalid-0x80 >actual &&
72 test_cmp expected actual &&
73 git grep -h "(*NO_JIT)æ" invalid-0x80 >actual &&
74 test_cmp expected actual
77 test_expect_success GETTEXT_LOCALE,LIBPCRE2 'PCRE v2: grep non-ASCII from invalid UTF-8 data with -i' '
78 test_might_fail git grep -hi "Æ" invalid-0x80 >actual &&
79 if test -s actual
80 then
81 test_cmp expected actual
82 fi &&
83 test_must_fail git grep -hi "(*NO_JIT)Æ" invalid-0x80 >actual &&
84 ! test_cmp expected actual
87 test_done