diff scripts/testfun/test.m @ 18166:c9b4d3177de3

Don't count expected failures as passed tests. * test.m: count expected failures separately from passed tests * __run_test_suite__.m: report expected failures and skipped tests during progress
author Carlo de Falco <cdf@users.sourceforge.net>
date Mon, 23 Dec 2013 18:38:53 +0100
parents d63878346099
children 7bbe3658c5ef
line wrap: on
line diff
--- a/scripts/testfun/test.m	Mon Dec 23 21:42:33 2013 -0800
+++ b/scripts/testfun/test.m	Mon Dec 23 18:38:53 2013 +0100
@@ -265,6 +265,7 @@
     ## Assume the block will succeed.
     __success = 1;
     __msg = [];
+    __isxtest = 0;
 
 ### DEMO
 
@@ -492,10 +493,17 @@
 
 ### TEST
 
-    elseif (strcmp (__type, "test") || strcmp (__type, "xtest"))
+    elseif (strcmp (__type, "test"))
       __istest = 1;
       ## Code will be evaluated below.
 
+### XTEST
+
+    elseif (strcmp (__type, "xtest"))
+      __istest = 0;
+      __isxtest = 1;
+      ## Code will be evaluated below.
+
 ### Comment block.
 
     elseif (strcmp (__block(1:1), "#"))
@@ -529,6 +537,7 @@
         if (strcmp (__type, "xtest"))
            __msg = sprintf ("%sknown failure\n%s", __signal_fail, lasterr ());
            __xfail++;
+           __success = 0;
         else
            __msg = sprintf ("%stest failed\n%s", __signal_fail, lasterr ());
            __success = 0;
@@ -558,7 +567,7 @@
         fflush (__fid);
       endif
     endif
-    if (__success == 0)
+    if (__success == 0 && !__isxtest)
       __all_success = 0;
       ## Stop after one error if not in batch mode.
       if (! __batch)
@@ -571,8 +580,8 @@
         return;
       endif
     endif
-    __tests += __istest;
-    __successes += __success * __istest;
+    __tests += (__istest || __isxtest);
+    __successes += __success * (__istest || __isxtest);
   endfor
   ## Clear any test functions created
   eval (__clear, "");