changeset 6728:a25173d58101

[project @ 2007-06-14 21:10:48 by jwe]
author jwe
date Thu, 14 Jun 2007 21:10:48 +0000
parents 3d1e0a056e6e
children 9b4c16beea1c
files doc/ChangeLog doc/interpreter/testfun.txi scripts/ChangeLog scripts/testfun/test.m
diffstat 4 files changed, 33 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,7 @@
+2007-06-14  Paul Kienzle  <pkienzle@users.sf.net>
+
+	* interpreter/testfun.txi: Document xtest block
+
 2007-06-14  David Bateman  <dbateman@free.fr>
 
 	* interpreter/Makefile.in (SCRIPT_SORCES): add interimages.m
--- a/doc/interpreter/testfun.txi
+++ b/doc/interpreter/testfun.txi
@@ -32,7 +32,7 @@
 
 @example
 @group
-   %!test error("this test fails!");
+   %!test error ("this test fails!");
    %!test "this test doesn't fail since it doesn't generate an error";
 @end group
 @end example
@@ -41,7 +41,7 @@
 
 @example
 @group
-     ***** test error('this test fails!')
+     ***** test error ('this test fails!')
    !!!!! test failed
    this test fails!
 @end group
@@ -109,6 +109,19 @@
    %!test assert (@dots{})
 @end example
 
+Sometimes during development there is a test that should work but is
+known to fail.  You still want to leave the test in because when the
+final code is ready the test should pass, but you may not be able to
+fix it immediately.  To avoid unecessary bug reports for these known
+failures, mark the block with @code{xtest} rather than @code{test}:
+
+@example
+   %!xtest error ("This test is known to fail.")
+@end example
+
+Another use of @code{xtest} is for statistical tests which should
+pass most of the time but are known to fail occasionally.
+
 Each block is evaluated in its own function environment, which means
 that variables defined in one block are not automatically shared
 with other blocks.  If you do want to share variables, then you
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -2,6 +2,10 @@
 
 	* plot/__go_draw_axes__.m: Handle text rotation property.
 
+2007-06-14  Paul Kienzle  <pkienzle@users.sf.net>
+
+	* testfun/test.m: Add xtest support for tests known to fail.
+
 2007-06-14  Sebastian Schubert  <sebastian-schubert@gmx.de>
 
 	* plot/print.m: Handle pstex, pslatex, epslatex, and
--- a/scripts/testfun/test.m
+++ b/scripts/testfun/test.m
@@ -412,7 +412,7 @@
       __code = ""; # code already processed
       
     ## TEST
-    elseif (strcmp (__type, "test"))
+    elseif (strcmp (__type, "test") || strcmp (__type, "xtest"))
       __istest = 1;
       ## code will be evaluated below
       
@@ -436,8 +436,12 @@
 		       __shared_r,__shared, __code));
 	eval (sprintf ("%s__test__(%s);", __shared_r, __shared));
       catch
-	__success = 0;
-	__msg = sprintf ("%stest failed\n%s", __signal_fail, __error_text__);
+        if (strcmp (__type, "xtest"))
+           __msg = sprintf ("%sknown failure\n%s", __signal_fail, __error_text__);
+        else
+           __msg = sprintf ("%stest failed\n%s", __signal_fail, __error_text__);
+	   __success = 0;
+        endif
 	if (isempty (__error_text__))
 	  error ("empty error text, probably Ctrl-C --- aborting"); 
 	endif
@@ -579,6 +583,9 @@
   endif
 endfunction
 
+### Test for a known failure
+%!xtest error("This test is known to fail")
+
 ### example from toeplitz
 %!shared msg
 %! msg="expecting vector arguments";