about summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2020-06-23 12:32:44 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2020-06-25 10:24:11 +0000
commit304ce85a2ad9c42351903fb16da36f02ad144de7 (patch)
tree0905cd4901f9a0c7b81bbe8db14ecda38a05bce3 /Test
parentaf1c009c3ea97cb4ec79b54c8b208198230e3ffb (diff)
downloadzsh-304ce85a2ad9c42351903fb16da36f02ad144de7.tar.gz
zsh-304ce85a2ad9c42351903fb16da36f02ad144de7.tar.xz
zsh-304ce85a2ad9c42351903fb16da36f02ad144de7.zip
46102: test harness: Make the XPass message distinct from the Fail message.
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.
Diffstat (limited to 'Test')
-rwxr-xr-xTest/ztst.zsh15
1 files changed, 14 insertions, 1 deletions
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