diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7e846d7..db00bc6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/DESCRIPTION b/DESCRIPTION index 7692ba3..3ea2b8d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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 diff --git a/NEWS b/NEWS index 0a604e2..2b88e1b 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ doctest 0.8.1+ ============== + * Minimum Octave is now 4.4.0. diff --git a/inst/doctest.m b/inst/doctest.m index a032c70..bdb77e9 100644 --- a/inst/doctest.m +++ b/inst/doctest.m @@ -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'); diff --git a/inst/private/doctest_collect.m b/inst/private/doctest_collect.m index ac17121..f7a5a6c 100644 --- a/inst/private/doctest_collect.m +++ b/inst/private/doctest_collect.m @@ -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: ... diff --git a/test/bist.m b/test/bist.m index a695da2..88ae748 100644 --- a/test/bist.m +++ b/test/bist.m @@ -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