Nguyễn Thái Ngọc Duy | 5c1ebcc | 2016-06-25 07:22:30 +0200 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='grep icase on non-English locales' |
| 4 | |
| 5 | . ./lib-gettext.sh |
| 6 | |
| 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 |
| 12 | ' |
| 13 | |
| 14 | test_have_prereq GETTEXT_LOCALE && |
Nguyễn Thái Ngọc Duy | 9038531 | 2018-03-24 08:44:53 +0100 | [diff] [blame] | 15 | test-tool regex "HALLÓ" "Halló" ICASE && |
Nguyễn Thái Ngọc Duy | 5c1ebcc | 2016-06-25 07:22:30 +0200 | [diff] [blame] | 16 | test_set_prereq REGEX_LOCALE |
| 17 | |
| 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!" |
| 21 | ' |
| 22 | |
Ævar Arnfjörð Bjarmason | 3eb585c | 2017-05-20 21:42:06 +0000 | [diff] [blame] | 23 | test_expect_success GETTEXT_LOCALE,PCRE 'grep pcre utf-8 icase' ' |
Nguyễn Thái Ngọc Duy | 18547aa | 2016-06-25 07:22:35 +0200 | [diff] [blame] | 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!" |
| 27 | ' |
| 28 | |
Ævar Arnfjörð Bjarmason | 3eb585c | 2017-05-20 21:42:06 +0000 | [diff] [blame] | 29 | test_expect_success GETTEXT_LOCALE,PCRE 'grep pcre utf-8 string with "+"' ' |
Nguyễn Thái Ngọc Duy | 18547aa | 2016-06-25 07:22:35 +0200 | [diff] [blame] | 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 |
| 36 | ' |
| 37 | |
Nguyễn Thái Ngọc Duy | 793dc67 | 2016-06-25 07:22:31 +0200 | [diff] [blame] | 38 | test_expect_success REGEX_LOCALE 'grep literal string, with -F' ' |
Ævar Arnfjörð Bjarmason | e01b4da | 2017-05-20 21:42:11 +0000 | [diff] [blame] | 39 | git grep -i -F "TILRAUN: Halló Heimur!" && |
| 40 | git grep -i -F "TILRAUN: HALLÓ HEIMUR!" |
Nguyễn Thái Ngọc Duy | 793dc67 | 2016-06-25 07:22:31 +0200 | [diff] [blame] | 41 | ' |
| 42 | |
| 43 | test_expect_success REGEX_LOCALE 'grep string with regex, with -F' ' |
Ævar Arnfjörð Bjarmason | e01b4da | 2017-05-20 21:42:11 +0000 | [diff] [blame] | 44 | test_write_lines "TILRAUN: Halló Heimur [abc]!" >file3 && |
| 45 | git add file3 && |
| 46 | git grep -i -F "TILRAUN: Halló Heimur [abc]!" file3 |
Nguyễn Thái Ngọc Duy | 793dc67 | 2016-06-25 07:22:31 +0200 | [diff] [blame] | 47 | ' |
| 48 | |
Nguyễn Thái Ngọc Duy | b51a9c1 | 2016-06-25 07:22:37 +0200 | [diff] [blame] | 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 |
| 54 | ' |
| 55 | |
Nguyễn Thái Ngọc Duy | 5c1ebcc | 2016-06-25 07:22:30 +0200 | [diff] [blame] | 56 | test_done |