blob: 0c685d35986eebf4dd72861b650c82fb6b515b51 [file] [log] [blame]
Nguyễn Thái Ngọc Duy5c1ebcc2016-06-25 07:22:30 +02001#!/bin/sh
2
3test_description='grep icase on non-English locales'
4
5. ./lib-gettext.sh
6
7test_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
14test_have_prereq GETTEXT_LOCALE &&
Nguyễn Thái Ngọc Duy90385312018-03-24 08:44:53 +010015test-tool regex "HALLÓ" "Halló" ICASE &&
Nguyễn Thái Ngọc Duy5c1ebcc2016-06-25 07:22:30 +020016test_set_prereq REGEX_LOCALE
17
18test_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ð Bjarmason3eb585c2017-05-20 21:42:06 +000023test_expect_success GETTEXT_LOCALE,PCRE 'grep pcre utf-8 icase' '
Nguyễn Thái Ngọc Duy18547aa2016-06-25 07:22:35 +020024 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ð Bjarmason3eb585c2017-05-20 21:42:06 +000029test_expect_success GETTEXT_LOCALE,PCRE 'grep pcre utf-8 string with "+"' '
Nguyễn Thái Ngọc Duy18547aa2016-06-25 07:22:35 +020030 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 Duy793dc672016-06-25 07:22:31 +020038test_expect_success REGEX_LOCALE 'grep literal string, with -F' '
Ævar Arnfjörð Bjarmasone01b4da2017-05-20 21:42:11 +000039 git grep -i -F "TILRAUN: Halló Heimur!" &&
40 git grep -i -F "TILRAUN: HALLÓ HEIMUR!"
Nguyễn Thái Ngọc Duy793dc672016-06-25 07:22:31 +020041'
42
43test_expect_success REGEX_LOCALE 'grep string with regex, with -F' '
Ævar Arnfjörð Bjarmasone01b4da2017-05-20 21:42:11 +000044 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 Duy793dc672016-06-25 07:22:31 +020047'
48
Nguyễn Thái Ngọc Duyb51a9c12016-06-25 07:22:37 +020049test_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 Duy5c1ebcc2016-06-25 07:22:30 +020056test_done