changeset 29067:913088ffe8e3

maint: merge stable to default.
author Markus Mützel <markus.muetzel@gmx.de>
date Sat, 14 Nov 2020 09:54:31 +0100
parents be19672a3c49 (current diff) a922c2176394 (diff)
children d8089b13d4d7
files test/module.mk
diffstat 6 files changed, 64 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/bug-59451/bug-59451.tst	Sat Nov 14 09:54:31 2020 +0100
@@ -0,0 +1,47 @@
+########################################################################
+##
+## Copyright (C) 2020 The Octave Project Developers
+##
+## See the file COPYRIGHT.md in the top-level directory of this
+## distribution or <https://octave.org/copyright/>.
+##
+## 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
+## <https://www.gnu.org/licenses/>.
+##
+########################################################################
+
+## Test if function handles correctly dispatch to class methods while keeping
+## a link to the original function file.
+%!test <*59451>
+%! dpi = pi;
+%! spi = single (pi);
+%! ## Create function handle
+%! fh = @bug59451;
+%! ## All of these must dispatch to the corresponding function file.
+%! assert (fh (dpi, dpi), "none");
+%! assert (fh (dpi, spi), "none");
+%! assert (fh (spi, spi), "none");
+%! assert (fh (spi, dpi), "none");
+%! assert (fh ({}, {}), "none");
+%! ## cd to a directory that contains class overloads
+%! cd foo
+%! ## The overloads must take precedence.
+%! assert (fh (dpi, dpi), "double");
+%! assert (fh (dpi, spi), "single");
+%! assert (fh (spi, spi), "single");
+%! assert (fh (spi, dpi), "single");
+%! ## This must still dispatch to the original function file.
+%! assert (fh ({}, {}), "none");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/bug-59451/bug59451.m	Sat Nov 14 09:54:31 2020 +0100
@@ -0,0 +1,3 @@
+function s = bug59451 (x, y)
+  s = "none";
+endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/bug-59451/foo/@double/bug59451.m	Sat Nov 14 09:54:31 2020 +0100
@@ -0,0 +1,3 @@
+function s = bug59451 (x, y)
+  s = "double";
+endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/bug-59451/foo/@single/bug59451.m	Sat Nov 14 09:54:31 2020 +0100
@@ -0,0 +1,3 @@
+function s = bug59451 (x, y)
+  s = "single";
+endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/bug-59451/module.mk	Sat Nov 14 09:54:31 2020 +0100
@@ -0,0 +1,7 @@
+bug_59451_TEST_FILES = \
+  %reldir%/bug-59451.tst \
+  %reldir%/bug59451.m \
+  %reldir%/foo/@double/bug59451.m \
+  %reldir%/foo/@single/bug59451.m
+
+TEST_FILES += $(bug_59451_TEST_FILES)
--- a/test/module.mk	Fri Nov 13 20:43:19 2020 -0500
+++ b/test/module.mk	Sat Nov 14 09:54:31 2020 +0100
@@ -86,6 +86,7 @@
 include %reldir%/bug-55758/module.mk
 include %reldir%/bug-58572/module.mk
 include %reldir%/bug-58593/module.mk
+include %reldir%/bug-59451/module.mk
 include %reldir%/class-concat/module.mk
 include %reldir%/classdef/module.mk
 include %reldir%/classdef-multiple-inheritance/module.mk