Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Testing interactive features (Re: capturing output of !! not working)



On Mar 23,  5:54pm, Bart Schaefer wrote:
}
} Since writing it, I noticed that history aggressively directs output
} to /dev/tty.  I haven't come up with any way to suppress that, and if
} you run it without a tty the stderr pattern does not match.
} 
} However, that's not the only test that has problems if there is no tty:
} 
} + not interactive and can't open terminal
} + not interactive and can't open terminal
} + not interactive and can't open terminal
} Test ../../zsh-5.0/Test/X02zlevi.ztst failed: error output differs from

Here's a revised Test/W01* that works with no TTY and warns about the
output when there is one, plus a patch to comptest for the Test/X01*
failure with no TTY.


diff --git a/Test/W01history.ztst b/Test/W01history.ztst
new file mode 100644
index 0000000..2492c41
--- /dev/null
+++ b/Test/W01history.ztst
@@ -0,0 +1,19 @@
+# Tests for BANG_HIST replacements
+
+%prep
+
+  [[ -t 0 ]] && print -u $ZTST_fd History tests write to /dev/tty
+
+%test
+
+  $ZTST_testdir/../Src/zsh -fis <<<'
+  echo foo bar
+  echo $(!!) again
+  echo more $( !! )' 2>/dev/null
+0:Regression test for history references in command substitution
+>foo bar
+>foo bar again
+>more foo bar again
+*?*
+F:Check that a history bug introduced by workers/34160 is working again.
+F:Discarded line of error output consumes prompts printed by "zsh -i".
diff --git a/Test/comptest b/Test/comptest
index 9c92f96..ef84217 100644
--- a/Test/comptest
+++ b/Test/comptest
@@ -164,7 +164,7 @@ zletest () {
   for input; do
     # zpty_flush Before zletest
     # sleep for $KEYTIMEOUT
-    (( first++ )) && read -t 0.011 -k 1 < /dev/null
+    (( first++ )) && read -t 0.011 -u 0 -k 1 < /dev/null
     zpty -n -w zsh "$input"
   done
   zpty -n -w zsh $'\C-X'



Messages sorted by: Reverse Date, Date, Thread, Author