zsh-workers
 help / color / mirror / code / Atom feed
From: Chris Down <chris@chrisdown.name>
To: zsh-workers@zsh.org
Cc: Daniel Shahaf <d.s@daniel.shahaf.name>
Subject: [PATCH v2 1/2] builtins: kill: Add basic test suite
Date: Sat, 15 Feb 2020 20:20:55 -0400	[thread overview]
Message-ID: <e65ea745a197e445818a2c5192af51f829f75f8e.1581812420.git.chris@chrisdown.name> (raw)

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


             reply	other threads:[~2020-02-16  0:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-16  0:20 Chris Down [this message]
2020-02-16  0:21 ` [PATCH v2 2/2] builtins: kill: Do not signal current process group when pid is empty Chris Down
2020-02-16 10:39   ` Daniel Shahaf
2020-02-17 14:11     ` Chris Down
2020-02-17 14:33       ` Daniel Shahaf
2020-02-16 10:34 ` [PATCH v2 1/2] builtins: kill: Add basic test suite Daniel Shahaf
2020-02-17 13:49   ` Chris Down

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e65ea745a197e445818a2c5192af51f829f75f8e.1581812420.git.chris@chrisdown.name \
    --to=chris@chrisdown.name \
    --cc=d.s@daniel.shahaf.name \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).