about summary refs log tree commit diff
path: root/Test/ztst.zsh
diff options
context:
space:
mode:
authorPeter Stephenson <p.stephenson@samsung.com>2018-04-25 10:16:51 +0100
committerPeter Stephenson <p.stephenson@samsung.com>2018-04-25 10:16:51 +0100
commitc6dbd862d0c5d1d539ad3d58dc1c754a9f166308 (patch)
tree1e44bf35d71399bf2c36189a1fce380fd0b43a0f /Test/ztst.zsh
parent95d861d0283e47c64980c844d66be44c6c4aad8a (diff)
downloadzsh-c6dbd862d0c5d1d539ad3d58dc1c754a9f166308.tar.gz
zsh-c6dbd862d0c5d1d539ad3d58dc1c754a9f166308.tar.xz
zsh-c6dbd862d0c5d1d539ad3d58dc1c754a9f166308.zip
42714: Add fg and bg tests.
Use ed to get minimal user interaction without needing
advanced terminal handling.

Improve test output of failures of pattern differences.
Diffstat (limited to 'Test/ztst.zsh')
-rwxr-xr-xTest/ztst.zsh23
1 files changed, 21 insertions, 2 deletions
diff --git a/Test/ztst.zsh b/Test/ztst.zsh
index 0b2679927..1a6a0b543 100755
--- a/Test/ztst.zsh
+++ b/Test/ztst.zsh
@@ -315,7 +315,8 @@ ZTST_diff() {
       
   if (( diff_pat )); then
     local -a diff_lines1 diff_lines2
-    integer failed i
+    integer failed i l n
+    local p
 
     diff_lines1=("${(f)$(<$argv[-2])}")
     diff_lines2=("${(f)$(<$argv[-1])}")
@@ -330,7 +331,25 @@ ZTST_diff() {
       done
     fi
     if (( failed )); then
-      print -rl "Pattern match failed:" \<${^diff_lines1} \>${^diff_lines2}
+      print -r "Pattern match failed, line $i:"
+      n=${#diff_lines1}
+      (( ${#diff_lines2} > $n )) && n=${#diff_lines2}
+      for (( l = 1; l <= n; ++l )); do
+	if (( l == i )); then
+	  p="-"
+	else
+	  p=" "
+	fi
+	print -r -- "$p<${diff_lines1[l]}"
+      done
+      for (( l = 1; l <= n; ++l )); do
+	if (( l == i )); then
+	  p="+"
+	else
+	  p=" "
+	fi
+	print -r -- "$p>${diff_lines2[l]}"
+      done
       diff_ret=1
     fi
   else