Skip to content

Commit

Permalink
empty strings in target should be skipped
Browse files Browse the repository at this point in the history
  • Loading branch information
cbm755 committed Sep 20, 2019
1 parent 8f507c5 commit 330133a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions inst/private/doctest_collect.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
% TODO: methods('logical') octave/matlab differ: which behaviour do we want?
% TODO: what about builtin "test" versus dir "test/"? Do we prefer dir?

if (isempty(w))
return
end

% determine type of target
if is_octave()
% Note: ripe for refactoring once "exist(w, 'class')" works in Octave.
Expand Down
17 changes: 17 additions & 0 deletions test/bist.m
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,20 @@ function bist()
%! assert (n == 0)
%! assert (t == 0)
%! assert (summ.num_targets == 0)

%!test
%! % skip empty targets
%! [n, t, summ] = doctest({'', ''});
%! assert (n == 0)
%! assert (t == 0)
%! assert (summ.num_targets == 0)
%! assert (summ.num_targets_with_extraction_errors == 0)

%!test
%! % skip empty targets
%! [n1, t1, summ1] = doctest('doctest');
%! [n2, t2, summ2] = doctest({'', '', 'doctest', ''});
%! assert (n1 == n2)
%! assert (t1 == t2)
%! assert (summ1.num_targets == summ2.num_targets)
%! assert (summ2.num_targets_with_extraction_errors == 0)

0 comments on commit 330133a

Please sign in to comment.