Skip to content

Commit

Permalink
Adjust tests for Octave 9, link to new issues
Browse files Browse the repository at this point in the history
Fixes Issue #268.  But opens Issue #288.
  • Loading branch information
cbm755 committed Mar 2, 2024
1 parent 4a373e1 commit 1527a23
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
8 changes: 6 additions & 2 deletions inst/private/doctest_collect.m
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand Down
33 changes: 30 additions & 3 deletions test/bist.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1527a23

Please sign in to comment.