Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
strategy:
fail-fast: false
matrix:
octave: [4.2.0, 4.2.1, 4.2.2, 4.4.0, 4.4.1, 5.1.0, 5.2.0, 6.1.0, 6.2.0, 6.3.0, 6.4.0, 7.1.0, 7.2.0, 7.3.0, 8.1.0, 8.2.0, 8.3.0, 8.4.0, 9.1.0, 9.2.0, 9.3.0, 9.4.0, 10.1.0, 10.2.0, latest]
octave: [4.4.0, 4.4.1, 5.1.0, 5.2.0, 6.1.0, 6.2.0, 6.3.0, 6.4.0, 7.1.0, 7.2.0, 7.3.0, 8.1.0, 8.2.0, 8.3.0, 8.4.0, 9.1.0, 9.2.0, 9.3.0, 9.4.0, 10.1.0, 10.2.0, latest]
steps:
- uses: actions/checkout@v5
- name: Container setup
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ Description: Find and run example code within documentation.
files and executed to confirm their output is correct. This can be
part of a testing framework or simply to ensure that documentation
stays up-to-date during software development.
Depends: octave (>= 4.2.0)
Depends: octave (>= 4.4.0)
Url: https://gnu-octave.github.io/packages/doctest/
License: BSD-3-Clause
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
doctest 0.8.1+
==============

* Minimum Octave is now 4.4.0.



Expand Down
8 changes: 1 addition & 7 deletions inst/doctest.m
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,7 @@

% stash user's formatting
if (is_octave)
try
[save_format, save_spacing] = format();
catch
% TODO: remove when we drop support for Octave < 4.4.0
save_format = eval('__formatstring__()');
save_spacing = eval('ifelse(__compactformat__(), "compact", "loose")');
end
[save_format, save_spacing] = format();
else
save_format = get(0, 'Format');
save_spacing = get(0, 'FormatSpacing');
Expand Down
44 changes: 10 additions & 34 deletions inst/private/doctest_collect.m
Original file line number Diff line number Diff line change
Expand Up @@ -426,40 +426,16 @@
% example blocks after conversion from texi to plain text. Also consider
% indentation, so we can later correctly unindent the example's content.

% These should work, but I keep hitting ARM-specific when $1 is empty:
% https://savannah.gnu.org/bugs/index.php?52810
% TODO: fixed in 4.2.2, so can revert this once we drop 4.2.1 support
%str = regexprep (str, ...
% '^([ \t]*)(\@example)(.*)$', ...
% [ '$1$2$3\n', ... % retain original line
% '$1###### EXAMPLE START ######'], ...
% 'lineanchors', 'dotexceptnewline', 'emptymatch');
%str = regexprep (str, ...
% '^([ \t]*)(\@end example)(.*)$', ...
% [ '$1###### EXAMPLE STOP ######\n', ...
% '$1$2$3'], ... % retain original line
% 'lineanchors', 'dotexceptnewline', 'emptymatch');

% Instead we do it manually
[S, E, TE, M, T, NM, SP] = regexp (str, '^([ \t]*)(\@example)(.*)$', ...
'lineanchors', 'dotexceptnewline', 'emptymatch');
str = SP{1};
for i=1:length (T)
str = [str ...
T{i}{:} sprintf('\n') ... % retain original line
T{i}{1} '###### EXAMPLE START ######' ...
SP{i+1}];
end

[S, E, TE, M, T, NM, SP] = regexp (str, '^([ \t]*)(\@end example)(.*)$', ...
'lineanchors', 'dotexceptnewline', 'emptymatch');
str = SP{1};
for i=1:length (T)
str = [str ...
T{i}{1} '###### EXAMPLE STOP ######' sprintf('\n') ...
T{i}{:} ... % retain original line
SP{i+1}];
end
str = regexprep (str, ...
'^([ \t]*)(\@example)(.*)$', ...
[ '$1$2$3\n', ... % retain original line
'$1###### EXAMPLE START ######'], ...
'lineanchors', 'dotexceptnewline', 'emptymatch');
str = regexprep (str, ...
'^([ \t]*)(\@end example)(.*)$', ...
[ '$1###### EXAMPLE STOP ######\n', ...
'$1$2$3'], ... % retain original line
'lineanchors', 'dotexceptnewline', 'emptymatch');

% special comments "@c doctest: cmd" are translated
% FIXME the expression would also match @@c doctest: ...
Expand Down
34 changes: 15 additions & 19 deletions test/bist.m
Original file line number Diff line number Diff line change
Expand Up @@ -112,29 +112,25 @@ function bist()
%! %% Issue #220, workarounds for testing classdef are sensitive to
%! % the order of tests above. Here we clear first. But we "preload"
%! % some methods as a workaround.
%! if (compare_versions (OCTAVE_VERSION(), '4.4.0', '>='))
%! clear classes
%! if (compare_versions (OCTAVE_VERSION(), '6.0.0', '>='))
%! doc = help ('@test_classdef/amethod');
%! assert (length (doc) > 10)
%! % dot notation broken before Octave 6
%! doc = help ('test_classdef.disp');
%! assert (length (doc) > 10)
%! end
%! % doctest ('test_classdef')
%! [numpass, numtest, summary] = doctest ('test_classdef');
%! assert (numpass == numtest)
%! if (compare_versions (OCTAVE_VERSION(), '4.4.0', '>='))
%! assert (summary.num_targets_without_tests <= 2)
%! end
%! if (compare_versions (OCTAVE_VERSION(), '6.0.0', '>='))
%! assert (summary.num_targets_without_tests <= 1)
%! end
%! clear classes
%! if (compare_versions (OCTAVE_VERSION(), '6.0.0', '>='))
%! doc = help ('@test_classdef/amethod');
%! assert (length (doc) > 10)
%! % dot notation broken before Octave 6
%! doc = help ('test_classdef.disp');
%! assert (length (doc) > 10)
%! end
%! % doctest ('test_classdef')
%! [numpass, numtest, summary] = doctest ('test_classdef');
%! assert (numpass == numtest)
%! assert (summary.num_targets_without_tests <= 2)
%! if (compare_versions (OCTAVE_VERSION(), '6.0.0', '>='))
%! assert (summary.num_targets_without_tests <= 1)
%! end
%! % glorious future! Issue #261
%! % if (compare_versions (OCTAVE_VERSION(), 'X.Y.Z', '>='))
%! % assert (summary.num_targets_without_tests == 0)
%! % end
%! end


%!test
Expand Down