diff scripts/testfun/test.m @ 16170:2a4f83826024

new way to test for features in Octave scripts * __have_feature__.m: New file. * test.m, geometryimages.m, sparseimages.m: Use it. Delete tests for testif and xfail. * config-features.sh: New file. * libinterp/Makefile.am (EXTRA_DIST): Include config-features.sh in the list. (oct-conf-features.h): New target. (BUILT_NODISTFILES, nodist_liboctinterp_la_SOURCES): Include oct-conf-features.h in the list.
author John W. Eaton <jwe@octave.org>
date Sat, 02 Mar 2013 07:41:50 -0500
parents 5b2126a8c84f
children 13affad7347c
line wrap: on
line diff
--- a/scripts/testfun/test.m
+++ b/scripts/testfun/test.m
@@ -463,15 +463,16 @@
       ## Strip comment any comment from testif line before looking for features
       __feat_line = strtok (__code(1:__e), '#%'); 
       __feat = regexp (__feat_line, '\w+', 'match');
-      __have_feat = strfind (octave_config_info ("DEFS"), __feat); 
-      if (any (cellfun ("isempty", __have_feat)))
+      __feat = strrep (__feat, "HAVE_", "");
+      __have_feat = __have_feature__ (__feat);
+      if (__have_feat)
+        __istest = 1;
+        __code = __code(__e + 1 : end);
+      else
         __xskip++;
         __istest = 0;
         __code = ""; # Skip the code.
         __msg = sprintf ("%sskipped test\n", __signal_skip);
-      else
-        __istest = 1;
-        __code = __code(__e + 1 : end);
       endif
 
 ### TEST
@@ -679,19 +680,6 @@
   endif
 endfunction
 
-### Test for test for missing features
-%!testif OCTAVE_SOURCE
-%! ## This test should be run
-%! assert (true);
-
-### Disable this test to avoid spurious skipped test for "make check"
-% !testif HAVE_FOOBAR
-% ! ## missing feature. Fail if this test is run
-% ! error ("Failed missing feature test");
-
-### Test for a known failure
-%!xtest error ("This test is known to fail")
-
 ### example from toeplitz
 %!shared msg1,msg2
 %! msg1="C must be a vector";