changeset 23373:67a638ac7f24

Add test case for classdef with local functions (bug #41723) * test/bug-41723/bug-41723.tst, test/bug-41723/class_bug41723.m, test/bug-41723/module.mk: New test files. * test/module.mk: Update to include bug-41723.
author Mike Miller <mtmiller@octave.org>
date Mon, 03 Apr 2017 21:12:07 -0700
parents 8a23ed65ef21
children a84c5a702035
files test/bug-41723/bug-41723.tst test/bug-41723/class_bug41723.m test/bug-41723/module.mk test/module.mk
diffstat 4 files changed, 53 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/bug-41723/bug-41723.tst	Mon Apr 03 21:12:07 2017 -0700
@@ -0,0 +1,22 @@
+## Copyright (C) 2017 Mike Miller
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+%!test <41723>
+%! a = class_bug41723 ();
+%! assert (a.value, 42);
+%! assert (a.getval (), 84);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/bug-41723/class_bug41723.m	Mon Apr 03 21:12:07 2017 -0700
@@ -0,0 +1,25 @@
+classdef class_bug41723 < handle
+  properties
+    value
+  endproperties
+  methods
+    function obj = class_bug41723 ()
+      obj.value = helper_function ();
+    endfunction
+    function val = getval (obj)
+      val = helper_function_2 ();
+    endfunction
+  endmethods
+endclassdef
+
+function y = helper_function ()
+  y = 42;
+endfunction
+
+function y = helper_function_2 (in)
+  if (! nargin)
+    y = helper_function_2 (true);
+  else
+    y = 2 * helper_function ();
+  endif
+endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/bug-41723/module.mk	Mon Apr 03 21:12:07 2017 -0700
@@ -0,0 +1,5 @@
+bug_41723_TEST_FILES = \
+  test/bug-41723/bug-41723.tst \
+  test/bug-41723/class_bug41723.m
+
+TEST_FILES += $(bug_41723_TEST_FILES)
--- a/test/module.mk	Fri Apr 07 18:26:18 2017 -0400
+++ b/test/module.mk	Mon Apr 03 21:12:07 2017 -0700
@@ -48,6 +48,7 @@
 include test/bug-36025/module.mk
 include test/bug-38236/module.mk
 include test/bug-38691/module.mk
+include test/bug-41723/module.mk
 include test/bug-44940/module.mk
 include test/bug-46660/module.mk
 include test/bug-50014/module.mk