changeset 24590:b6818c2b0483

test.m: Remove requirement to avoid nested functions in %!test blocks. * test.m: Remove regexp test for function definitions in %!test blocks which effectively become nested functions. This no longer produces segfaults.
author Rik <rik@octave.org>
date Fri, 12 Jan 2018 08:08:46 -0800
parents 9b36fc7bd002
children bccb203494f6
files scripts/testfun/test.m
diffstat 1 files changed, 3 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/testfun/test.m	Thu Jan 11 17:26:53 2018 -0800
+++ b/scripts/testfun/test.m	Fri Jan 12 08:08:46 2018 -0800
@@ -644,17 +644,9 @@
       ## evaluate code for test, shared, and assert.
       if (! isempty(__code))
         try
-          ## FIXME: Must check for embedded test functions, which cause
-          ## segfaults, until issues with subfunctions in functions are fixed.
-          embed_func = regexp (__code, '^\s*function ', 'once', 'lineanchors');
-          if (isempty (embed_func))
-            eval (sprintf ("function %s__test__(%s)\n%s\nendfunction",
-                           __shared_r, __shared, __code));
-            eval (sprintf ("%s__test__(%s);", __shared_r, __shared));
-          else
-            error (["Functions embedded in %!test blocks are not allowed.\n", ...
-                    "Use the %!function/%!endfunction syntax instead to define shared functions for testing.\n"]);
-          endif
+          eval (sprintf ("function %s__test__(%s)\n%s\nendfunction",
+                         __shared_r, __shared, __code));
+          eval (sprintf ("%s__test__(%s);", __shared_r, __shared));
         catch
           if (isempty (lasterr ()))
             error ("test: empty error text, probably Ctrl-C --- aborting");