From 1527a23b735f2f356fb5859cb8b2a2774ec0f53f Mon Sep 17 00:00:00 2001 From: "Colin B. Macdonald" Date: Sat, 2 Mar 2024 01:02:30 -0800 Subject: [PATCH] Adjust tests for Octave 9, link to new issues Fixes Issue #268. But opens Issue #288. --- inst/private/doctest_collect.m | 8 ++++++-- test/bist.m | 33 ++++++++++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/inst/private/doctest_collect.m b/inst/private/doctest_collect.m index 0415e06..b446dd2 100644 --- a/inst/private/doctest_collect.m +++ b/inst/private/doctest_collect.m @@ -309,10 +309,14 @@ for i=1:numel(meths) target = struct(); if is_octave() - if compare_versions (OCTAVE_VERSION, '7.0.0', '>=') && exist (w, "class") == 8 + if compare_versions (OCTAVE_VERSION, '9.0.0', '>=') && exist (w, "class") == 8 % classdef on newish Octave: use cls.method + target.name = sprintf ('%s.%s', w, meths{i}); + target.link = ''; + elseif compare_versions (OCTAVE_VERSION, '7.0.0', '>=') && exist (w, "class") == 8 + % use cls.method, use cls.method, but skip cls.cls if strcmp (meths{i}, w) - % TODO: gathering the ctor help fails https://savannah.gnu.org/bugs/?62803 + % gathering the ctor help fails https://savannah.gnu.org/bugs/?62803 continue end target.name = sprintf ('%s.%s', w, meths{i}); diff --git a/test/bist.m b/test/bist.m index b2893d8..357d432 100644 --- a/test/bist.m +++ b/test/bist.m @@ -73,20 +73,38 @@ function bist() %!xtest %! % https://github.com/gnu-octave/octave-doctest/issues/268 +%! % Now on Octave 9, #268 fixed but it fails in new way: +%! % https://github.com/gnu-octave/octave-doctest/issues/288 +%! % These issues test separately elsewhere %! if (compare_versions (OCTAVE_VERSION(), '7.0.0', '>=')) %! [nump, numt, summ] = doctest ('classdef_infile'); %! assert (nump == numt && numt == 5) %! assert (summ.num_targets == 4) %! end +%!test +%! % https://github.com/gnu-octave/octave-doctest/issues/268 +%! if (compare_versions (OCTAVE_VERSION(), '9.0.0', '>=')) +%! [nump, numt, summ] = doctest ('classdef_infile.classdef_infile'); +%! assert (nump == numt && numt == 1) +%! assert (summ.num_targets == 1) +%! end + +%!test +%! % https://github.com/gnu-octave/octave-doctest/issues/268 +%! if (compare_versions (OCTAVE_VERSION(), '9.0.0', '>=')) +%! [nump, numt, summ] = doctest ('test_classdef.test_classdef'); +%! assert (nump == numt && numt == 1) +%! assert (summ.num_targets == 1) +%! end + %!test %! %% Issue #220, Issue #261, clear and w/o special order or workarounds %! if (compare_versions (OCTAVE_VERSION(), '7.0.0', '>=')) %! clear classes -%! % doctest ('test_classdef') %! [numpass, numtest, summary] = doctest ('test_classdef'); %! assert (numpass == numtest) -%! assert (summary.num_targets_without_tests == 0) +%! assert (summary.num_targets >= 3) %! end %!test @@ -244,7 +262,16 @@ function bist() %!test %! % classdef.method, where method is external file -%! if (compare_versions (OCTAVE_VERSION(), '6.0.0', '>=')) +%! if ((compare_versions (OCTAVE_VERSION(), '6.0.0', '>=')) && ... +%! (compare_versions (OCTAVE_VERSION(), '9.0.0', '<'))) +%! [n, t, summary] = doctest ("test_classdef.amethod"); +%! assert (n == t) +%! assert (n == 1) +%! end +%!xtest +%! % classdef.method, where method is external file +%! % https://github.com/gnu-octave/octave-doctest/issues/288 +%! if (compare_versions (OCTAVE_VERSION(), '9.0.0', '>=')) %! [n, t, summary] = doctest ("test_classdef.amethod"); %! assert (n == t) %! assert (n == 1)