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

[PATCH v2 1/2] builtins: kill: Add basic test suite



This is not totally comprehensive, but at least it's a start for the
core functionality. In the next commit, we'll also use this base to add
some regression tests.
---
 Test/B11kill.ztst | 52 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 Test/B11kill.ztst

diff --git a/Test/B11kill.ztst b/Test/B11kill.ztst
new file mode 100644
index 000000000..6a548213b
--- /dev/null
+++ b/Test/B11kill.ztst
@@ -0,0 +1,52 @@
+# Tests for the kill builtin.
+
+%test
+
+# Correct invocation
+
+  if zmodload zsh/system &>/dev/null; then
+    (
+      trap 'exit 19' TERM
+      kill $sysparams[pid]
+    )
+  else
+    print -u $ZTST_fd 'Cannot zmodload zsh/system, skipping kill with no sigspec'
+  fi
+19:kill with no sigspec
+
+
+  if zmodload zsh/system &>/dev/null; then
+    (
+      trap 'exit 11' USR1
+      kill -USR1 $sysparams[pid]
+    )
+  else
+    print -u $ZTST_fd 'Cannot zmodload zsh/system, skipping kill with sigspec'
+  fi
+11:kill with sigspec
+
+# Incorrect invocation
+
+  (
+  kill a b c
+  )
+3:kill with multiple wrong inputs should increment status
+?(eval):kill:2: illegal pid: a
+?(eval):kill:2: illegal pid: b
+?(eval):kill:2: illegal pid: c
+
+  (
+  kill -INT a b c
+  )
+3:kill with sigspec and wrong inputs should increment status
+?(eval):kill:2: illegal pid: a
+?(eval):kill:2: illegal pid: b
+?(eval):kill:2: illegal pid: c
+
+  kill
+1:kill with no arguments
+?(eval):kill:1: not enough arguments
+
+  kill -INT
+1:kill with sigspec only
+?(eval):kill:1: not enough arguments
-- 
2.25.0



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