Hello community,

here is the log from the commit of package octave-forge-doctest for 
openSUSE:Factory checked in at 2019-11-28 10:14:00
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/octave-forge-doctest (Old)
 and      /work/SRC/openSUSE:Factory/.octave-forge-doctest.new.26869 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "octave-forge-doctest"

Thu Nov 28 10:14:00 2019 rev:5 rq:751198 version:0.7.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/octave-forge-doctest/octave-forge-doctest.changes    
    2018-07-28 12:40:26.240429796 +0200
+++ 
/work/SRC/openSUSE:Factory/.octave-forge-doctest.new.26869/octave-forge-doctest.changes
     2019-11-28 10:14:47.947637579 +0100
@@ -1,0 +2,9 @@
+Wed Nov 27 00:12:47 UTC 2019 - Stefan Brüns <[email protected]>
+
+- Update to version 0.7.0:
+  * Functions within compiled `.oct` files can now be tested.
+  * Tests are run with default number formatting (see `help doctest`).
+  * More robust to errors during testing.
+  * Makefile improvements and fixes.
+
+-------------------------------------------------------------------

Old:
----
  doctest-0.6.1.tar.gz

New:
----
  doctest-0.7.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ octave-forge-doctest.spec ++++++
--- /var/tmp/diff_new_pack.j0qLTm/_old  2019-11-28 10:14:48.595637586 +0100
+++ /var/tmp/diff_new_pack.j0qLTm/_new  2019-11-28 10:14:48.599637586 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package octave-forge-doctest
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,21 +12,21 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
 %define octpkg  doctest
 Name:           octave-forge-%{octpkg}
-Version:        0.6.1
+Version:        0.7.0
 Release:        0
 Summary:        Octave-Forge documentation tests
 License:        GPL-3.0-or-later AND BSD-3-Clause
 Group:          Productivity/Scientific/Math
-Url:            http://octave.sourceforge.net
-Source0:        
http://downloads.sourceforge.net/octave/%{octpkg}-%{version}.tar.gz
+URL:            https://octave.sourceforge.io
+Source0:        
https://downloads.sourceforge.net/octave/%{octpkg}-%{version}.tar.gz
 BuildRequires:  gcc-c++
-BuildRequires:  octave-devel
+BuildRequires:  octave-devel >= 4.2.0
 Requires:       octave-cli >= 4.2.0
 BuildArch:      noarch
 

++++++ doctest-0.6.1.tar.gz -> doctest-0.7.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/doctest-0.6.1/DESCRIPTION 
new/doctest-0.7.0/DESCRIPTION
--- old/doctest-0.6.1/DESCRIPTION       2018-01-04 20:48:27.000000000 +0100
+++ new/doctest-0.7.0/DESCRIPTION       2019-03-23 16:31:42.000000000 +0100
@@ -1,14 +1,14 @@
 Name: doctest
-Version: 0.6.1
-Date: 2018-01-04
+Version: 0.7.0
+Date: 2018-03-23
 Author: various authors
 Maintainer: Colin B. Macdonald <[email protected]>, Michael Walter 
<[email protected]>
 Title: Documentation tests
-Description: The Octave-Forge Doctest package finds specially-formatted
- blocks of example code within documentation files.  It then executes
- the code and confirms the output is correct.  This can be useful as part of
- a testing framework or simply to ensure that documentation stays up-to-date
- during software development.
+Description: Find and run example code within documentation.
+ Formatted blocks of example code are extracted from 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)
-Url: https://github.com/catch22/octave-doctest
+Url: https://octave.sourceforge.io/doctest
 License: BSD-3-Clause
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/doctest-0.6.1/NEWS new/doctest-0.7.0/NEWS
--- old/doctest-0.6.1/NEWS      2018-01-04 20:48:27.000000000 +0100
+++ new/doctest-0.7.0/NEWS      2019-03-23 16:31:42.000000000 +0100
@@ -1,3 +1,16 @@
+doctest 0.7.0 (2019-03-23)
+==========================
+
+  * Functions within compiled `.oct` files can now be tested.
+
+  * Tests are run with default number formatting (see `help doctest`).
+
+  * More robust to errors during testing.
+
+  * Makefile improvements and fixes.
+
+
+
 doctest 0.6.1 (2018-01-04)
 ==========================
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/doctest-0.6.1/README.md new/doctest-0.7.0/README.md
--- old/doctest-0.6.1/README.md 2018-01-04 20:48:27.000000000 +0100
+++ new/doctest-0.7.0/README.md 2019-03-23 16:31:42.000000000 +0100
@@ -9,13 +9,13 @@
 
 ~~~matlab
 function greeting = greet(user)
-% Returns a greeting.
-%
-% >> greet World
-%
-% Hello, World!
+  % Returns a greeting.
+  %
+  % >> greet World
+  %
+  % Hello, World!
 
-greeting = ['Hello, ' user '!'];
+  greeting = ['Hello, ' user '!'];
 
 end
 ~~~
@@ -32,7 +32,7 @@
 1/1 targets passed, 0 without tests.
 ~~~
 
-Doctest also supports Texinfo markup, which is [quite 
popular](https://www.gnu.org/software/octave/doc/interpreter/Documentation-Tips.html)
 in the Octave world, and it provides various toggles and switches for 
customizing its behavior.
-The [Doctest 
documentation](http://octave.sourceforge.net/doctest/function/doctest.html) 
contains information on all this.
+Doctest also supports Texinfo markup, which is 
[popular](https://www.gnu.org/software/octave/doc/interpreter/Documentation-Tips.html)
 in the Octave world, and it provides various toggles and switches for 
customizing its behavior.
+The [Doctest 
documentation](https://octave.sourceforge.io/doctest/function/doctest.html) 
contains information on all this.
 Quite appropriately, Doctest can test its own documentation.
 We also maintain a [list of 
software](https://github.com/catch22/octave-doctest/wiki/WhoIsUsingDoctest) 
that is using Doctest.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/doctest-0.6.1/inst/doctest.m 
new/doctest-0.7.0/inst/doctest.m
--- old/doctest-0.6.1/inst/doctest.m    2018-01-04 20:48:27.000000000 +0100
+++ new/doctest-0.7.0/inst/doctest.m    2019-03-23 16:31:42.000000000 +0100
@@ -1,6 +1,6 @@
 %% Copyright (c) 2010 Thomas Grenfell Smith
 %% Copyright (c) 2011, 2013-2016 Michael Walter
-%% Copyright (c) 2015-2017 Colin B. Macdonald
+%% Copyright (c) 2015-2019 Colin B. Macdonald
 %%
 %% Redistribution and use in source and binary forms, with or without
 %% modification, are permitted provided that the following conditions are met:
@@ -41,6 +41,7 @@
 %% @item function;
 %% @item class;
 %% @item Texinfo file;
+%% @item .oct/.mex compiled code;
 %% @item directory/folder (pass @code{-nonrecursive} to skip subfolders);
 %% @item cell array of such items.
 %% @end itemize
@@ -191,6 +192,31 @@
 %%
 %% To disable the @code{...} wildcard, use the @code{-ELLIPSIS} directive.
 %%
+%%
+%% @strong{Numerical Format}
+%% Tests are run using default formatting:
+%% @example
+%% @group
+%% >> 6/5
+%% ans = 1.2000
+%% @end group
+%% @end example
+%%
+%% If your test changes the global state (e.g., @code{format} or
+%% @code{chdir}), you may need to undo your changes afterwards.
+%% In this example, we followup with @code{format} to reset to the
+%% default five digits:
+%%
+%% @example
+%% @group
+%% >> format long
+%% >> 355/113
+%% ans = 3.14159292035...
+%% >> format
+%% @end group
+%% @end example
+%%
+%%
 %% @strong{Diary Style}
 %% When the m-file contains plaintext documentation, doctest finds tests
 %% by searching for lines that begin with @code{>>}.  It then finds the
@@ -229,10 +255,12 @@
 % Process parameters.
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-% print usage?
-if nargin < 1
-  help doctest;
-  return;
+if (nargin < 1 || nargout > 3)
+  if (is_octave)
+    print_usage()
+  end
+  help doctest
+  return
 end
 
 % if given a single object, wrap it in a cell array
@@ -242,6 +270,11 @@
 
 % input parsing for options and directives
 recursive = true;
+if (nargout < 3)
+  verbose = true;
+else
+  verbose = false;
+end
 directives = doctest_default_directives();
 for i = 1:(nargin-1)
   assert(ischar(varargin{i}))
@@ -255,6 +288,14 @@
     case 'nonrecursive'
       assert(strcmp(pm, '-'))
       recursive = false;
+    case 'quiet'
+      % currently not mentioned in help text
+      assert(strcmp(pm, '-'))
+      verbose = false;
+    case 'verbose'
+      % currently not mentioned in help text
+      assert(strcmp(pm, '-'))
+      verbose = true;
     otherwise
       assert(strcmp(pm, '+') || strcmp(pm, '-'))
       warning('Doctest:deprecated', ...
@@ -272,9 +313,9 @@
 % get terminal color codes
 [color_ok, color_err, color_warn, reset] = doctest_colors(fid);
 
-% print banner
-fprintf(fid, 'Doctest v0.6.1: this is Free Software without warranty, see 
source.\n\n');
-
+if (verbose)
+  fprintf(fid, 'Doctest v0.7.0: this is Free Software without warranty, see 
source.\n\n');
+end
 
 summary = struct();
 summary.num_targets = 0;
@@ -284,27 +325,53 @@
 summary.num_tests = 0;
 summary.num_tests_passed = 0;
 
+% 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
+else
+  save_format = get(0, 'Format');
+  save_spacing = get(0, 'FormatSpacing');
+end
+% force default formatting
+format()
+
 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Collect and run tests
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 for i=1:numel(what)
-  summary = doctest_collect(what{i}, directives, summary, recursive, 0, fid);
+  summary = doctest_collect(what{i}, directives, summary, recursive, verbose, 
0, fid);
 end
 
 
+% restore user's formatting
+format(save_format)
+format(save_spacing)
+
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % Report summary
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-fprintf(fid, '\nSummary:\n\n');
-if (summary.num_tests_passed == summary.num_tests)
-  fprintf(fid, ['   ' color_ok 'PASS %4d/%-4d' reset '\n\n'], 
summary.num_tests_passed, summary.num_tests);
-else
-  fprintf(fid, ['   ' color_err 'FAIL %4d/%-4d' reset '\n\n'], 
summary.num_tests - summary.num_tests_passed, summary.num_tests);
-end
+if (verbose)
+  fprintf(fid, '\nSummary:\n\n');
+  if (summary.num_tests_passed == summary.num_tests)
+    fprintf(fid, ['   ' color_ok 'PASS %4d/%-4d' reset '\n\n'], 
summary.num_tests_passed, summary.num_tests);
+  else
+    fprintf(fid, ['   ' color_err 'FAIL %4d/%-4d' reset '\n\n'], 
summary.num_tests - summary.num_tests_passed, summary.num_tests);
+  end
 
-fprintf(fid, '%d/%d targets passed, %d without tests', 
summary.num_targets_passed, summary.num_targets, 
summary.num_targets_without_tests);
-if summary.num_targets_with_extraction_errors > 0
-  fprintf(fid, [', ' color_err '%d with extraction errors' reset], 
summary.num_targets_with_extraction_errors);
+  fprintf(fid, '%d/%d targets passed, %d without tests', 
summary.num_targets_passed, summary.num_targets, 
summary.num_targets_without_tests);
+  if summary.num_targets_with_extraction_errors > 0
+    fprintf(fid, [', ' color_err '%d with extraction errors' reset], 
summary.num_targets_with_extraction_errors);
+  end
+  fprintf(fid, '.\n\n');
 end
-fprintf(fid, '.\n\n');
 
 if nargout == 1
   varargout = {summary.num_targets_passed == summary.num_targets};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/doctest-0.6.1/inst/private/doctest_collect.m 
new/doctest-0.7.0/inst/private/doctest_collect.m
--- old/doctest-0.6.1/inst/private/doctest_collect.m    2018-01-04 
20:48:27.000000000 +0100
+++ new/doctest-0.7.0/inst/private/doctest_collect.m    2019-03-23 
16:31:42.000000000 +0100
@@ -1,4 +1,4 @@
-function summary = doctest_collect(what, directives, summary, recursive, 
depth, fid)
+function summary = doctest_collect(what, directives, summary, recursive, 
verbose, depth, fid)
 %DOCTEST_COLLECT  Find and run doctests.
 %
 %   The parameter WHAT is the name of a class, directory, function or filename:
@@ -10,8 +10,9 @@
 %%
 % Copyright (c) 2010 Thomas Grenfell Smith
 % Copyright (c) 2015 Michael Walter
-% Copyright (c) 2015-2017 Colin B. Macdonald
+% Copyright (c) 2015-2019 Colin B. Macdonald
 % Copyright (c) 2015 Oliver Heimlich
+% Copyright (C) 2018 Mike Miller
 % This is Free Software, BSD-3-Clause, see doctest.m for details.
 
 
@@ -24,7 +25,12 @@
   [~, ~, ext] = fileparts(what);
   if any(strcmpi(ext, {'.texinfo' '.texi' '.txi' '.tex'}))
     type = 'texinfo';
-  elseif (exist(what, 'file') && ~exist(what, 'dir')) || exist(what, 
'builtin');
+  elseif (strcmp (ext, '.oct') && exist (what) == 3)  % .oct explicitly
+    type = 'octfile';
+  elseif (exist (what) == 3)  % .oct/.mex
+    [~, what, ~] = fileparts (what);  % strip extension if present
+    type = 'function';                % then access like any function
+  elseif (exist(what, 'file') && ~exist(what, 'dir')) || exist(what, 'builtin')
     if (exist(['@' what], 'dir'))
       % special case, e.g., @logical is class, logical is builtin
       type = 'class';
@@ -88,7 +94,9 @@
     else
       slashchar = filesep();
     end
-    fprintf(fid, '%s%s%s\n', spaces, what, slashchar);
+    if (verbose)
+      fprintf(fid, '%s%s%s\n', spaces, what, slashchar);
+    end
   end
   oldcwd = chdir(what);
   files = dir('.');
@@ -109,12 +117,13 @@
       end
     else
       [~, ~, ext] = fileparts(f);
-      if (~ any(strcmpi(ext, {'.m' '.texinfo' '.texi' '.txi' '.tex'})))
+      if (~ any(strcmpi(ext, ...
+                {'.m' '.texinfo' '.texi' '.txi' '.tex' '.oct' '.mex'})))
         %fprintf(fid, 'Debug: ignoring file "%s"\n', f)
         continue
       end
     end
-    summary = doctest_collect(f, directives, summary, recursive, depth + 1, 
fid);
+    summary = doctest_collect(f, directives, summary, recursive, verbose, 
depth + 1, fid);
   end
   chdir(oldcwd);
   return
@@ -135,6 +144,8 @@
   targets = [target];
 elseif strcmp(type, 'class')
   targets = collect_targets_class(what, depth);
+elseif strcmp (type, 'octfile')
+  targets = collect_targets_octfile (what, depth);
 elseif strcmp(type, 'texinfo')
   target = struct();
   target.name = what;
@@ -165,13 +176,17 @@
   target = targets(i);
   spaces = repmat(' ', 1, 2*target.depth);
   dots = repmat('.', 1, 55 - numel(target.name) - 2*target.depth);
-  fprintf(fid, '%s%s %s ', spaces, target.name, dots);
+  if (verbose)
+    fprintf(fid, '%s%s %s ', spaces, target.name, dots);
+  end
 
   % extraction error?
   if target.error
     summary.num_targets_with_extraction_errors = 
summary.num_targets_with_extraction_errors + 1;
-    fprintf(fid, [color_err  'EXTRACTION ERROR' reset '\n\n']);
-    fprintf(fid, '    %s\n\n', target.error);
+    if (verbose)
+      fprintf(fid, [color_err  'EXTRACTION ERROR' reset '\n\n']);
+      fprintf(fid, '    %s\n\n', target.error);
+    end
     continue;
   end
 
@@ -197,22 +212,24 @@
     summary.num_targets_without_tests = summary.num_targets_without_tests + 1;
   end
 
-  % pretty print outcome
-  if num_tests == 0
-    fprintf(fid, 'NO TESTS\n');
-  elseif num_tests_passed == num_tests
-    fprintf(fid, [color_ok 'PASS %4d/%-4d' reset '\n'], num_tests_passed, 
num_tests);
-  else
-    fprintf(fid, [color_err 'FAIL %4d/%-4d' reset '\n\n'], num_tests - 
num_tests_passed, num_tests);
-    for j = 1:num_tests
-      if ~results(j).passed
-        fprintf(fid, '   >> %s\n\n', results(j).source);
-        fprintf(fid, [ '      expected: ' '%s' '\n' ], results(j).want);
-        fprintf(fid, [ '      got     : ' color_err '%s' reset '\n' ], 
results(j).got);
-        if results(j).xfail
-          fprintf(fid, '      expected failure, but test succeeded!');
+  if (verbose)
+    % pretty print outcome
+    if num_tests == 0
+      fprintf(fid, 'NO TESTS\n');
+    elseif num_tests_passed == num_tests
+      fprintf(fid, [color_ok 'PASS %4d/%-4d' reset '\n'], num_tests_passed, 
num_tests);
+    else
+      fprintf(fid, [color_err 'FAIL %4d/%-4d' reset '\n\n'], num_tests - 
num_tests_passed, num_tests);
+      for j = 1:num_tests
+        if ~results(j).passed
+          fprintf(fid, '   >> %s\n\n', results(j).source);
+          fprintf(fid, [ '      expected: ' '%s' '\n' ], results(j).want);
+          fprintf(fid, [ '      got     : ' color_err '%s' reset '\n' ], 
results(j).got);
+          if results(j).xfail
+            fprintf(fid, '      expected failure, but test succeeded!');
+          end
+          fprintf(fid, '\n');
         end
-        fprintf(fid, '\n');
       end
     end
   end
@@ -283,6 +300,35 @@
 end
 
 
+function targets = collect_targets_octfile (file, depth)
+  % first target is the name of the octfile (w/o extension)
+  [~, basename, ext] = fileparts (file);
+  assert (strcmp (ext, '.oct'))
+  target = collect_targets_function (basename);
+  target.name = file;
+  target.depth = depth;
+  targets = [target];
+
+  % octfile may have many fcns in it: find them using the autoload map
+  autoloadmap = autoload ();
+  len = numel (file);
+  % matches both "/foo/bar.oct" and "/baz/bar.oct"; uncommon in practice
+  pmatch = @(e) (numel (e.file) >= len) && strcmp (e.file(end-len+1:end), 
file);
+  idx = find (arrayfun (pmatch, autoloadmap));
+
+  if (~ isempty (idx))
+    % indicate that octfile has other fcns, and indent those targets
+    targets(1).name = [targets(1).name ':'];
+    for i = 1:numel (idx)
+      f = autoloadmap(idx(i)).function;
+      target = collect_targets_function (f);
+      target.depth = depth + 1;
+      targets = [targets; target];
+    end
+  end
+end
+
+
 function [docstring, error] = extract_docstring(name)
   if is_octave()
     [docstring, format] = get_help_text(name);
@@ -341,6 +387,7 @@
 
   % 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
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/doctest-0.6.1/inst/private/doctest_format_exception.m 
new/doctest-0.7.0/inst/private/doctest_format_exception.m
--- old/doctest-0.6.1/inst/private/doctest_format_exception.m   2018-01-04 
20:48:27.000000000 +0100
+++ new/doctest-0.7.0/inst/private/doctest_format_exception.m   2019-03-23 
16:31:42.000000000 +0100
@@ -7,14 +7,14 @@
 
 %%
 % Copyright (c) 2010 Thomas Grenfell Smith
-% Copyright (c) 2015 Colin B. Macdonald
+% Copyright (c) 2015, 2019 Colin B. Macdonald
 % Copyright (c) 2015, 2017 Michael Walter
 % This is Free Software, BSD-3-Clause, see doctest.m for details.
 
 
 % octave?
 if is_octave()
-  formatted = ['??? ' ex.message];
+  formatted = ['??? ' strtrim(ex.message)];
   return
 end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/doctest-0.6.1/inst/private/doctest_run_docstring.m 
new/doctest-0.7.0/inst/private/doctest_run_docstring.m
--- old/doctest-0.6.1/inst/private/doctest_run_docstring.m      2018-01-04 
20:48:27.000000000 +0100
+++ new/doctest-0.7.0/inst/private/doctest_run_docstring.m      2019-03-23 
16:31:42.000000000 +0100
@@ -13,11 +13,17 @@
 %   results.got:      the output that was recieved
 %   results.passed:   whether .want and .got match each other according to
 %                     doctest_compare.
+%   results.xfail:    true/false/empty: whether the test was expected to
+%                     fail.
+%   results.skip:     true/false: whether the test was skipped, some skips
+%                     could also set passed=false.
+%
+%   There may be other fields as well; these can change at any time.
 
 %%
 % Copyright (c) 2010 Thomas Grenfell Smith
 % Copyright (c) 2011, 2015 Michael Walter
-% Copyright (c) 2015-2017 Colin B. Macdonald
+% Copyright (c) 2015-2017, 2019 Colin B. Macdonald
 % License: BSD-3-Clause, see doctest.m for details
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/doctest-0.6.1/inst/private/doctest_run_tests.m 
new/doctest-0.7.0/inst/private/doctest_run_tests.m
--- old/doctest-0.6.1/inst/private/doctest_run_tests.m  2018-01-04 
20:48:27.000000000 +0100
+++ new/doctest-0.7.0/inst/private/doctest_run_tests.m  2019-03-23 
16:31:42.000000000 +0100
@@ -17,7 +17,7 @@
 %%
 % Copyright (c) 2010 Thomas Grenfell Smith
 % Copyright (c) 2011, 2015 Michael Walter
-% Copyright (c) 2015-2017 Colin B. Macdonald
+% Copyright (c) 2015-2017, 2019 Colin B. Macdonald
 % License: BSD-3-Clause, see doctest.m for details
 
 
@@ -46,21 +46,42 @@
 
   % determine whether test should be skipped
   % (careful about Octave bug #46397 to not change the current value of “ans”)
-  eval (strcat ('DOCTEST__current_test.skip = ', ...
-                 doctest_join_conditions(DOCTEST__current_test.skip), ...
-                ';'));
-  if (DOCTEST__current_test.skip)
-     doctest_datastore('set_current_test', DOCTEST__current_test);
-     continue
+  try
+    eval (strcat ('DOCTEST__current_test.skip = ', ...
+                  doctest_join_conditions(DOCTEST__current_test.skip), ...
+                  ';'));
+  catch DOCTEST__exception
+    DOCTEST__current_test.skip = true;
+    DOCTEST__current_test.xfail = [];   % don't know (yet)
+    % hack: put the error message into "got"
+    DOCTEST__current_test.got = strcat('There was a problem executing +SKIP 
directive:', ...
+                                       sprintf('\n'), ...
+                                       
doctest_format_exception(DOCTEST__exception));
+    DOCTEST__current_test.passed = false;
   end
 
   % determine whether test is expected to fail
   % (careful about Octave bug #46397 to not change the current value of “ans”)
-  eval (strcat ('DOCTEST__current_test.xfail = ', ...
-                 doctest_join_conditions(DOCTEST__current_test.xfail), ...
-                ';'));
+  try
+    eval (strcat ('DOCTEST__current_test.xfail = ', ...
+                  doctest_join_conditions(DOCTEST__current_test.xfail), ...
+                  ';'));
+  catch DOCTEST__exception
+    DOCTEST__current_test.skip = true;  % test is not going to run
+    DOCTEST__current_test.xfail = [];  % cannot say
+    % hack: put the error message into "got"
+    DOCTEST__current_test.got = strcat('problem executing +XFAIL directive:', 
...
+                                       sprintf('\n'), ...
+                                       
doctest_format_exception(DOCTEST__exception));
+    DOCTEST__current_test.passed = false;
+  end
+
   doctest_datastore('set_current_test', DOCTEST__current_test);
 
+  if (DOCTEST__current_test.skip)
+    continue
+  end
+
   % run the test code
   try
     DOCTEST__got = evalc(DOCTEST__current_test.source);
@@ -90,7 +111,8 @@
 %DOCTEST__results = cell2mat(tests);  % fails b/c they have different fields
 DOCTEST__results = [];
 for j=1:numel(tests)
-  if ~any(tests{j}.skip)
+  if (~any(tests{j}.skip) || isfield(tests{j}, 'passed'))
+    % skipped but pass was false, may be a directive so keep
     DOCTEST__results = [DOCTEST__results tests{j}];
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/doctest-0.6.1/octave-doctest.metainfo.xml 
new/doctest-0.7.0/octave-doctest.metainfo.xml
--- old/doctest-0.6.1/octave-doctest.metainfo.xml       2018-01-04 
20:48:27.000000000 +0100
+++ new/doctest-0.7.0/octave-doctest.metainfo.xml       2019-03-23 
16:31:42.000000000 +0100
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-Copyright 2016 Colin B. Macdonald
+Copyright 2016, 2019 Colin B. Macdonald
 
 Copying and distribution of this file, with or without modification,
 are permitted in any medium without royalty provided the copyright
@@ -11,13 +11,12 @@
   <id>octave-doctest</id>
   <extends>www.octave.org-octave.desktop</extends>
   <name>Doctest</name>
-  <summary>Finds and tests example code within documentation</summary>
+  <summary>Find and run example code within documentation</summary>
   <description>
-    <p>Finds specially-formatted blocks of example code within
-    documentation files.  Then execute that code and confirm the
-    output is correct.  This can be useful as part of a testing
-    framework or simply to ensure that documentation stays up-to-date
-    during software development.</p>
+    <p>Formatted blocks of example code are extracted from 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.</p>
   </description>
   <keywords>
     <keyword>development</keyword>
@@ -26,9 +25,9 @@
     <keyword>documentation</keyword>
   </keywords>
   <translation/>
-  <url type="homepage">http://octave.sourceforge.net/doctest</url>
+  <url type="homepage">https://octave.sourceforge.io/doctest</url>
   <url 
type="bugtracker">https://github.com/catch22/octave-doctest/issues/new</url>
-  <metadata_license>FSFAP</metadata_license>-->
+  <metadata_license>FSFAP</metadata_license>
   <project_license>BSD-3-Clause</project_license>
   <developer_name>Octave-Forge Community</developer_name>
   <update_contact>[email protected]</update_contact>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/doctest-0.6.1/test/bist.m 
new/doctest-0.7.0/test/bist.m
--- old/doctest-0.6.1/test/bist.m       1970-01-01 01:00:00.000000000 +0100
+++ new/doctest-0.7.0/test/bist.m       2019-03-23 16:31:42.000000000 +0100
@@ -0,0 +1,103 @@
+function bist()
+% built-in self tests for Doctest
+%
+% Doctest mostly tests itself but in some cases we want to ensure
+% exactly what is being tested and yet we cannat call doctest recursively
+% https://github.com/catch22/octave-doctest/issues/184
+
+end
+
+
+%!error <Invalid> doctest ()
+%!error <Invalid> [a, b, c, d] = doctest ('double')
+
+%!assert (doctest ('doctest', '-quiet'))
+
+%!assert (~ doctest ('there_is_no_such_file', '-quiet'))
+
+%!assert (~ doctest ({'doctest', 'there_is_no_such_file'}, '-quiet'))
+
+%!error
+%! % TODO: maybe this should be EXTRACTION_ERROR, not raise an error...
+%! doctest @there_is_no_such_class -quiet
+
+%!test
+%! [n, t] = doctest ('doctest', '-quiet');
+%! assert (n == t)
+%! assert (t >= 10)
+
+%!test
+%! [n, t, summ] = doctest ('doctest');
+%! assert (n == t)
+%! assert (t >= 10)
+%! assert (summ.num_targets == 1)
+%! assert (summ.num_tests == t)
+%! assert (summ.num_tests_passed == n)
+
+%!test
+%! % list input
+%! [n, t1, summ] = doctest ({'doctest'});
+%! [n, t2, summ] = doctest ({'doctest' 'doctest'});
+%! assert (t2 == 2*t1)
+%! assert (summ.num_targets == 2)
+
+%!test
+%! % nonrecursion stays out of subdirs
+%! [n1, t1] = doctest ('test_dir', '-quiet');
+%! [n2, t2] = doctest ('test_dir', '-nonrecursive', '-quiet');
+%! assert (t2 < t1)
+
+%!test
+%! [nump, numt, summ] = doctest ('@test_classdef/amethod');
+%! assert (nump == 1 && numt == 1)
+
+%!xtest
+%! % https://github.com/catch22/octave-doctest/issues/92
+%! [nump, numt, summ] = doctest ('@test_classdef/disp');
+%! assert (nump == 1 && numt == 1)
+
+%!xtest
+%! % https://github.com/catch22/octave-doctest/issues/92
+%! % Should have 4 targets and 5 tests
+%! %   * general class help (2 tests)
+%! %   * ctor (1 test)
+%! %   * disp method (1 test)
+%! %   * amethod in external file (1 test)
+%! [nump, numt, summ] = doctest ('test_classdef');
+%! assert (nump == 5 && numt == 5)
+%! assert (summ.num_targets == 4)
+
+%!xtest
+%! % Currently cannot even run
+%! % https://github.com/catch22/octave-doctest/issues/199
+%! [nump, numt, summ] = doctest ('@classdef_infile/disp');
+%! assert (nump >= 0)
+
+%!xtest
+%! % https://github.com/catch22/octave-doctest/issues/92
+%! [nump, numt, summ] = doctest ('@classdef_infile/disp');
+%! assert (nump == 1 && numt == 1)
+
+%!xtest
+%! % https://github.com/catch22/octave-doctest/issues/92
+%! % Should have 3 targets and 4 tests
+%! %   * general class help (2 tests)
+%! %   * ctor (1 test)
+%! %   * disp method (1 test)
+%! [nump, numt, summ] = doctest ('classdef_infile');
+%! assert (nump == 4 && numt == 4)
+%! assert (summ.num_targets == 3)
+
+%!xtest
+%! % monkey-patching methods to existing builtin-objects
+%! [nump, numt, summ1] = doctest ('logical');
+%! % First, there is (at least) the "logical" builtin
+%! % >= b/c of https://github.com/catch22/octave-doctest/issues/87
+%! assert (summ1.num_targets >= 1)
+%! savepath = addpath ('test_methods_in_subdir');
+%! % there should be at least "logical" builtin and "logical.mynewmethod"
+%! [nump, numt, summ] = doctest ('logical');
+%! assert (summ.num_targets >= 2)
+%! assert (summ.num_targets >= summ1.num_targets)
+%! assert (nump >= 3 && numt >= 3)
+%! path(savepath);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/doctest-0.6.1/test/bist_skip_xfail_errors.m.txt 
new/doctest-0.7.0/test/bist_skip_xfail_errors.m.txt
--- old/doctest-0.6.1/test/bist_skip_xfail_errors.m.txt 1970-01-01 
01:00:00.000000000 +0100
+++ new/doctest-0.7.0/test/bist_skip_xfail_errors.m.txt 2019-03-23 
16:31:42.000000000 +0100
@@ -0,0 +1,42 @@
+function bist_skip_xfail_errors()
+% >> a = 42
+% a = 42
+%
+%
+% The directive has an undefined error
+% >> a = 43    %doctest: +SKIP_IF(truthy)
+% a = 43
+%
+%
+% The directive failed; test should not have run
+% >> a
+% a = 42
+%
+%
+% The directive has an undefined error
+% >> b = 44    %doctest: +XFAIL_IF(undef)
+% b = 44
+%
+%
+% The directive has a syntax error
+% >> b = 45    %doctest: +XFAIL_IF(\m/)
+% b = 45
+%
+%
+% An actual passing test
+% >> c = 46
+% c = 46
+%
+%
+% An actual failing test
+% >> c = 47
+% c = 4200
+
+end
+
+
+%!test
+%! % some are supposed to fail
+%! [n, t, summ] = doctest('bist_skip_xfail_errors');
+%! assert (n == 3)
+%! assert (t == 7)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/doctest-0.6.1/test/classdef_infile.m 
new/doctest-0.7.0/test/classdef_infile.m
--- old/doctest-0.6.1/test/classdef_infile.m    1970-01-01 01:00:00.000000000 
+0100
+++ new/doctest-0.7.0/test/classdef_infile.m    2019-03-23 16:31:42.000000000 
+0100
@@ -0,0 +1,44 @@
+classdef classdef_infile
+%CLASSDEF_INFILE  A classdef living in a single m-file
+%
+%   Some tests:
+%   >> 6 + 7
+%   ans = 13
+%
+%   >> a = classdef_infile()
+%   a =
+%   class name = "default", age = 42
+%
+%
+%   This general help text should be shown for "help classdef_infile".
+%
+%   There are also tests in the methods below.
+
+  properties
+    name
+    age
+  end
+
+  methods
+
+    function obj = classdef_infile(n, a)
+      % constructor
+      % >> a = 13 + 1
+      % a = 14
+      if (nargin ~= 2)
+        obj.name = 'default';
+        obj.age = 42;
+      else
+        obj.name = n;
+        obj.age = a;
+      end
+    end
+  end
+  methods
+    function disp(obj)
+      % >> a = 30 + 2
+      % a = 32
+      fprintf('class name = "%s", age = %d\n', obj.name, obj.age)
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/doctest-0.6.1/test/test_dir/test1.m 
new/doctest-0.7.0/test/test_dir/test1.m
--- old/doctest-0.6.1/test/test_dir/test1.m     1970-01-01 01:00:00.000000000 
+0100
+++ new/doctest-0.7.0/test/test_dir/test1.m     2019-03-23 16:31:42.000000000 
+0100
@@ -0,0 +1,4 @@
+function test1()
+% >> a = 42
+% a = 42
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/doctest-0.6.1/test/test_dir/test_subdir/test2.m 
new/doctest-0.7.0/test/test_dir/test_subdir/test2.m
--- old/doctest-0.6.1/test/test_dir/test_subdir/test2.m 1970-01-01 
01:00:00.000000000 +0100
+++ new/doctest-0.7.0/test/test_dir/test_subdir/test2.m 2019-03-23 
16:31:42.000000000 +0100
@@ -0,0 +1,4 @@
+function test2()
+% >> b = 43
+% b = 43
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/doctest-0.6.1/test/test_format.m 
new/doctest-0.7.0/test/test_format.m
--- old/doctest-0.6.1/test/test_format.m        1970-01-01 01:00:00.000000000 
+0100
+++ new/doctest-0.7.0/test/test_format.m        2019-03-23 16:31:42.000000000 
+0100
@@ -0,0 +1,19 @@
+% Default number formatting
+% >> a = 1.3
+% a =  1.3000
+%
+%
+% If tests change it...
+% >> format long
+% >> b = 10/6
+% b = 1.66666666...7
+%
+%
+% ... they should change it back to defaults
+% >> format()
+% >> a
+% a =  1.3000
+%
+%
+% TODO: should test that we restore the users settings, but probably
+% Issue #184 prevents doing this within our doctests.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/doctest-0.6.1/test/test_methods_in_subdir/@logical/mynewmethod.m 
new/doctest-0.7.0/test/test_methods_in_subdir/@logical/mynewmethod.m
--- old/doctest-0.6.1/test/test_methods_in_subdir/@logical/mynewmethod.m        
1970-01-01 01:00:00.000000000 +0100
+++ new/doctest-0.7.0/test/test_methods_in_subdir/@logical/mynewmethod.m        
2019-03-23 16:31:42.000000000 +0100
@@ -0,0 +1,10 @@
+function y = mynewmethod(x)
+%MYNEWMETHOD: monkey patch something onto class logical
+%   >> a = 42
+%   a = 42
+%   >> mynewmethod(true)
+%   ans = 0
+%   >> islogical(ans)
+%   ans = 1
+  y = ~ x;
+end


Reply via email to