zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: [PATCH] test harness: Make the XPass message distinct from the Fail message.
Date: Tue, 23 Jun 2020 12:32:44 +0000	[thread overview]
Message-ID: <20200623123244.28818-1-danielsh@tarpaulin.shahaf.local2> (raw)

The new output is:

    ./Test/B02typeset.ztst: starting.
    Test ./Test/B02typeset.ztst was expected to fail, but passed.
    Was testing: this is the description that's after the colon on in the ztst file
    ./Test/B02typeset.ztst: test XPassed.
    **************************************
    0 successful test scripts, 1 failure, 0 skipped
    **************************************
    make[1]: *** [Makefile:190: check] Error 1
    make: *** [Makefile:263: check] Error 2

The new function is deliberately very similar to ZTST_testfailed() just
above it.
---
 Test/ztst.zsh | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/Test/ztst.zsh b/Test/ztst.zsh
index 375efd16c..e668ae942 100755
--- a/Test/ztst.zsh
+++ b/Test/ztst.zsh
@@ -146,6 +146,19 @@ $ZTST_failmsg"
   ZTST_testfailed=1
   return 1
 }
+ZTST_testxpassed() {
+  print -r "Test $ZTST_testname was expected to fail, but passed."
+  if [[ -n $ZTST_message ]]; then
+    print -r "Was testing: $ZTST_message"
+  fi
+  print -r "$ZTST_testname: test XPassed."
+  if [[ -n $ZTST_failmsg ]]; then
+    print -r "The following may (or may not) help identifying the cause:
+$ZTST_failmsg"
+  fi
+  ZTST_testfailed=1
+  return 1
+}
 
 # Print messages if $ZTST_verbose is non-empty
 ZTST_verbose() {
@@ -520,7 +533,7 @@ $ZTST_code"
 	return 1
       fi
       if (( expected_to_fail )); then
-        ZTST_testfailed "test was expected to fail, but passed."
+        ZTST_testxpassed
         return 1
       fi
     fi

                 reply	other threads:[~2020-06-23 12:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200623123244.28818-1-danielsh@tarpaulin.shahaf.local2 \
    --to=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).