zsh-5.9-do-not-use-egrep-in-tests.patch 4.5 KB

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