changeset 15521:bcace51598ed

Improve demo() to warn when an input function does not exist. * demo.m: Check return code from test to see whether function exists and issue a warning if it does not. * test.m: Return -1 for second retval when grabdemo option given and function does not exist.
author Rik <rik@octave.org>
date Sun, 14 Oct 2012 20:18:22 -0700
parents f915996325b7
children e92dde30f754
files scripts/testfun/demo.m scripts/testfun/test.m
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/testfun/demo.m
+++ b/scripts/testfun/demo.m
@@ -101,7 +101,11 @@
   endif
 
   [code, idx] = test (name, "grabdemo");
-  if (isempty (idx))
+
+  if (idx == -1)
+    warning ("no function %s found", name);
+    return;
+  elseif (isempty (idx))
     warning ("no demo available for %s", name);
     return;
   elseif (n >= length (idx))
--- a/scripts/testfun/test.m
+++ b/scripts/testfun/test.m
@@ -171,7 +171,7 @@
   if (isempty (__file))
     if (__grabdemo)
       __ret1 = "";
-      __ret2 = [];
+      __ret2 = -1;
     else
       if (exist (__name) == 3)
         fprintf (__fid, "%s%s source code with tests for dynamically linked function not found\n", __signal_empty, __name);