l10n: fr.po v2.25.0 rnd 1
[git/debian.git] / t / t4210-log-i18n.sh
blobc3792081e627ffd10676b0a2a449bdc4df73a7f8
1 #!/bin/sh
3 test_description='test log with i18n features'
4 . ./lib-gettext.sh
6 # two forms of é
7 utf8_e=$(printf '\303\251')
8 latin1_e=$(printf '\351')
10 # invalid UTF-8
11 invalid_e=$(printf '\303\50)') # ")" at end to close opening "("
13 test_expect_success 'create commits in different encodings' '
14 test_tick &&
15 cat >msg <<-EOF &&
16 utf8
18 t${utf8_e}st
19 EOF
20 git add msg &&
21 git -c i18n.commitencoding=utf8 commit -F msg &&
22 cat >msg <<-EOF &&
23 latin1
25 t${latin1_e}st
26 EOF
27 git add msg &&
28 git -c i18n.commitencoding=ISO-8859-1 commit -F msg
31 test_expect_success 'log --grep searches in log output encoding (utf8)' '
32 cat >expect <<-\EOF &&
33 latin1
34 utf8
35 EOF
36 git log --encoding=utf8 --format=%s --grep=$utf8_e >actual &&
37 test_cmp expect actual
40 test_expect_success !MINGW 'log --grep searches in log output encoding (latin1)' '
41 cat >expect <<-\EOF &&
42 latin1
43 utf8
44 EOF
45 git log --encoding=ISO-8859-1 --format=%s --grep=$latin1_e >actual &&
46 test_cmp expect actual
49 test_expect_success !MINGW 'log --grep does not find non-reencoded values (utf8)' '
50 git log --encoding=utf8 --format=%s --grep=$latin1_e >actual &&
51 test_must_be_empty actual
54 test_expect_success !MINGW 'log --grep does not find non-reencoded values (latin1)' '
55 git log --encoding=ISO-8859-1 --format=%s --grep=$utf8_e >actual &&
56 test_must_be_empty actual
59 for engine in fixed basic extended perl
61 prereq=
62 if test $engine = "perl"
63 then
64 prereq="PCRE"
65 else
66 prereq=""
68 force_regex=
69 if test $engine != "fixed"
70 then
71 force_regex=.*
73 test_expect_success !MINGW,!REGEX_ILLSEQ,GETTEXT_LOCALE,$prereq "-c grep.patternType=$engine log --grep does not find non-reencoded values (latin1 + locale)" "
74 cat >expect <<-\EOF &&
75 latin1
76 utf8
77 EOF
78 LC_ALL=\"$is_IS_locale\" git -c grep.patternType=$engine log --encoding=ISO-8859-1 --format=%s --grep=\"$force_regex$latin1_e\" >actual &&
79 test_cmp expect actual
82 test_expect_success !MINGW,GETTEXT_LOCALE,$prereq "-c grep.patternType=$engine log --grep does not find non-reencoded values (latin1 + locale)" "
83 LC_ALL=\"$is_IS_locale\" git -c grep.patternType=$engine log --encoding=ISO-8859-1 --format=%s --grep=\"$force_regex$utf8_e\" >actual &&
84 test_must_be_empty actual
87 test_expect_success !MINGW,!REGEX_ILLSEQ,GETTEXT_LOCALE,$prereq "-c grep.patternType=$engine log --grep does not die on invalid UTF-8 value (latin1 + locale + invalid needle)" "
88 LC_ALL=\"$is_IS_locale\" git -c grep.patternType=$engine log --encoding=ISO-8859-1 --format=%s --grep=\"$force_regex$invalid_e\" >actual &&
89 test_must_be_empty actual
91 done
93 test_done