summary refs log tree commit diff
diff options
context:
space:
mode:
authordana <dana@dana.is>2019-01-23 20:35:38 -0600
committerdana <dana@dana.is>2019-01-23 20:35:38 -0600
commite3cab52ca26f5c5c4c07c481406d841a3b69de60 (patch)
treeb8b1f1432c98df0fb52b92871cc05ebdbb095a9c
parentd683d278c793681069800417b77e8d53e7ce21f1 (diff)
downloadzsh-e3cab52ca26f5c5c4c07c481406d841a3b69de60.tar.gz
zsh-e3cab52ca26f5c5c4c07c481406d841a3b69de60.tar.xz
zsh-e3cab52ca26f5c5c4c07c481406d841a3b69de60.zip
44012: X04zlehighlight: Fix spurious test failures on OpenBSD
-rw-r--r--ChangeLog5
-rw-r--r--Test/X04zlehighlight.ztst9
2 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 8cefc0d86..e62ea5f62 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-01-23  dana  <dana@dana.is>
+
+	* 44012: Test/X04zlehighlight.ztst: Fix spurious test failures
+	on OpenBSD
+
 2019-01-23  Mikael Magnusson  <mikachu@gmail.com>
 
 	* 44011: Doc/Zsh/zle.yo, Src/prompt.c, Test/X04zlehighlight.ztst:
diff --git a/Test/X04zlehighlight.ztst b/Test/X04zlehighlight.ztst
index f162594c9..000949698 100644
--- a/Test/X04zlehighlight.ztst
+++ b/Test/X04zlehighlight.ztst
@@ -29,6 +29,8 @@
       integer i
       for (( i = 0; i < ${1:-1}; ++i )); do
         zpty -r zsh REPLY
+        # Normalise me/sgr0 to \e[0m. We also need to strip \e(B in zpty_stop()
+        REPLY=${REPLY//${termcap[me]}/$'\x1b[0m'}
         # P is for "preserve", and induces keeping some
         # expected color codes to test region_highlight,
         # etc. - the color codes are made a regular text.
@@ -54,7 +56,12 @@
       # zpty gives no output when piped without these braces (?)
       # The while loop with // substitution is to convert `e^Mexit'
       # into `exit' (see zpty_line). The sed commands remove escapes
-      { zpty -r zsh } | sed -e $'/[^\t\r ]/!d' -e $'s/\r$//' -e $'s/\x1b\\[[0-9;]*m//g' | while read REPLY; do REPLY=${REPLY//(#b)((?(#c0,1))$cm(?(#c0,1)))/${${${(M)match[2]:#${match[3]}}:+${match[2]}}:-${${match[1]##[[:space:]]##}%%[[:space:]]##}}}; print -rn -- "$REPLY"; done
+      { zpty -r zsh } |
+      sed -e $'/[^\t\r ]/!d' -e $'s/\r$//' -e $'s/\x1b\\[[0-9;]*m//g' -e $'s/\x1b([A-Z]//g' |
+      while read REPLY; do
+        REPLY=${REPLY//(#b)((?(#c0,1))$cm(?(#c0,1)))/${${${(M)match[2]:#${match[3]}}:+${match[2]}}:-${${match[1]##[[:space:]]##}%%[[:space:]]##}}}
+        print -rn -- "$REPLY"
+      done
       zpty -d
       :
     }