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
14 -# Find a UTF-8 locale.
16 -# Don't let LC_* override our choice of locale.
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
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"
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
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 }
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
54 -# Find a UTF-8 locale.
56 -# Don't let LC_* override our choice of locale.
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
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"
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
78 # Tests of the vi mode of ZLE
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
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
100 # into bindings. The latter is particularly tricky with multibyte sequences.
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
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
122 # Tests for completion system.
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
135 + ZSH_TEST_LANG=$(ZTST_find_UTF8)
136 if ( zmodload zsh/zpty 2>/dev/null ); then
137 . $ZTST_srcdir/comptest
139 diff --git a/Test/ztst.zsh b/Test/ztst.zsh
140 index aca275c1c..d95b726e7 100755
143 @@ -37,6 +37,21 @@ emulate -R zsh
144 # LANG must be passed to child zsh.
150 + # Don't let LC_* override our choice of locale.
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
162 # Don't propagate variables that are set by default in the shell.