archrelease: copy trunk to extra-x86_64
[arch-packages.git] / zsh / repos / extra-x86_64 / 0001-50629-do-not-use-egrep-in-tests.patch
blob01325fb99fb3c764affe2f941ca1e067d5821fd3
1 commit 4fc5dc0292acd77f17281f451774ba2ca4203026
2 Author: Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
3 Date: Thu Sep 15 18:56:20 2022 +0900
5 50629: do not use egrep in tests
7 diff --git a/Test/D07multibyte.ztst b/Test/D07multibyte.ztst
8 index e2e9a25ef..6909346cb 100644
9 --- a/Test/D07multibyte.ztst
10 +++ b/Test/D07multibyte.ztst
11 @@ -1,19 +1,7 @@
12 %prep
14 -# Find a UTF-8 locale.
15 - setopt multibyte
16 -# Don't let LC_* override our choice of locale.
17 - unset -m LC_\*
18 - mb_ok=
19 - langs=(en_{US,GB}.{UTF-,utf}8 en.UTF-8
20 - $(locale -a 2>/dev/null | egrep 'utf8|UTF-8'))
21 - for LANG in $langs; do
22 - if [[ é = ? ]]; then
23 - mb_ok=1
24 - break;
25 - fi
26 - done
27 - if [[ -z $mb_ok ]]; then
28 + LANG=$(ZTST_find_UTF8)
29 + if [[ -z $LANG ]]; then
30 ZTST_unimplemented="no UTF-8 locale or multibyte mode is not implemented"
31 else
32 print -u $ZTST_fd Testing multibyte with locale $LANG
33 diff --git a/Test/E01options.ztst b/Test/E01options.ztst
34 index 2acbfd357..d38fbed74 100644
35 --- a/Test/E01options.ztst
36 +++ b/Test/E01options.ztst
37 @@ -651,7 +651,7 @@
38 >noktarg1
39 >0 1
41 - showopt() { setopt | egrep 'localoptions|ksharrays'; }
42 + showopt() { echo ${(FM)${(@f)"$(setopt)"}:#(localoptions|ksharrays)*} }
43 f1() { setopt localoptions ksharrays; showopt }
44 f2() { setopt ksharrays; showopt }
45 setopt kshoptionprint
46 diff --git a/Test/V07pcre.ztst b/Test/V07pcre.ztst
47 index c9c844d2a..ca13419e5 100644
48 --- a/Test/V07pcre.ztst
49 +++ b/Test/V07pcre.ztst
50 @@ -6,20 +6,8 @@
51 return 0
53 setopt rematch_pcre
54 -# Find a UTF-8 locale.
55 - setopt multibyte
56 -# Don't let LC_* override our choice of locale.
57 - unset -m LC_\*
58 - mb_ok=
59 - langs=(en_{US,GB}.{UTF-,utf}8 en.UTF-8
60 - $(locale -a 2>/dev/null | egrep 'utf8|UTF-8'))
61 - for LANG in $langs; do
62 - if [[ é = ? ]]; then
63 - mb_ok=1
64 - break;
65 - fi
66 - done
67 - if [[ -z $mb_ok ]]; then
68 + LANG=$(ZTST_find_UTF8)
69 + if [[ -z $LANG ]]; then
70 ZTST_unimplemented="no UTF-8 locale or multibyte mode is not implemented"
71 else
72 print -u $ZTST_fd Testing PCRE multibyte with locale $LANG
73 diff --git a/Test/X02zlevi.ztst b/Test/X02zlevi.ztst
74 index 8146d6752..203c13c32 100644
75 --- a/Test/X02zlevi.ztst
76 +++ b/Test/X02zlevi.ztst
77 @@ -1,16 +1,7 @@
78 # Tests of the vi mode of ZLE
80 %prep
81 - unset -m LC_\*
82 - ZSH_TEST_LANG=
83 - langs=(en_{US,GB}.{UTF-,utf}8 en.UTF-8
84 - $(locale -a 2>/dev/null | egrep 'utf8|UTF-8'))
85 - for LANG in $langs; do
86 - if [[ é = ? ]]; then
87 - ZSH_TEST_LANG=$LANG
88 - break;
89 - fi
90 - done
91 + ZSH_TEST_LANG=$(ZTST_find_UTF8)
92 if ( zmodload zsh/zpty 2>/dev/null ); then
93 . $ZTST_srcdir/comptest
94 comptestinit -v -z $ZTST_testdir/../Src/zsh
95 diff --git a/Test/X03zlebindkey.ztst b/Test/X03zlebindkey.ztst
96 index 43692a85b..5277332a7 100644
97 --- a/Test/X03zlebindkey.ztst
98 +++ b/Test/X03zlebindkey.ztst
99 @@ -3,16 +3,7 @@
100 # into bindings. The latter is particularly tricky with multibyte sequences.
102 %prep
103 - unset -m LC_\*
104 - ZSH_TEST_LANG=
105 - langs=(en_{US,GB}.{UTF-,utf}8 en.UTF-8
106 - $(locale -a 2>/dev/null | egrep 'utf8|UTF-8'))
107 - for LANG in $langs; do
108 - if [[ é = ? ]]; then
109 - ZSH_TEST_LANG=$LANG
110 - break;
111 - fi
112 - done
113 + ZSH_TEST_LANG=$(ZTST_find_UTF8)
114 if ( zmodload zsh/zpty 2>/dev/null ); then
115 . $ZTST_srcdir/comptest
116 comptestinit -z $ZTST_testdir/../Src/zsh
117 diff --git a/Test/Y01completion.ztst b/Test/Y01completion.ztst
118 index 6af0efc6d..f976f9f91 100644
119 --- a/Test/Y01completion.ztst
120 +++ b/Test/Y01completion.ztst
121 @@ -1,16 +1,7 @@
122 # Tests for completion system.
124 %prep
125 - unset -m LC_\*
126 - ZSH_TEST_LANG=
127 - langs=(en_{US,GB}.{UTF-,utf}8 en.UTF-8
128 - $(locale -a 2>/dev/null | egrep 'utf8|UTF-8'))
129 - for LANG in $langs; do
130 - if [[ é = ? ]]; then
131 - ZSH_TEST_LANG=$LANG
132 - break;
133 - fi
134 - done
135 + ZSH_TEST_LANG=$(ZTST_find_UTF8)
136 if ( zmodload zsh/zpty 2>/dev/null ); then
137 . $ZTST_srcdir/comptest
138 mkdir comp.tmp
139 diff --git a/Test/ztst.zsh b/Test/ztst.zsh
140 index aca275c1c..d95b726e7 100755
141 --- a/Test/ztst.zsh
142 +++ b/Test/ztst.zsh
143 @@ -37,6 +37,21 @@ emulate -R zsh
144 # LANG must be passed to child zsh.
145 export LANG
147 +# find UTF-8 locale
148 +ZTST_find_UTF8 () {
149 + setopt multibyte
150 + # Don't let LC_* override our choice of locale.
151 + unset -m LC_\*
152 + local langs=(en_{US,GB}.{UTF-,utf}8 en.UTF-8
153 + ${(M)$(locale -a 2>/dev/null):#*.(utf8|UTF-8)})
154 + for LANG in $langs; do
155 + if [[ é = ? ]]; then
156 + echo $LANG
157 + return
158 + fi
159 + done
162 # Don't propagate variables that are set by default in the shell.
163 typeset +x WORDCHARS