Mercurial > octave-nkf
changeset 20089:cbba639b956b
fail if single argument to assert is empty. (bug #44793)
* assert.m: Also fail for single empty arguments. New tests.
Fix test for assert ([]).
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 09 Apr 2015 13:54:07 -0400 |
parents | ac59136f1f10 |
children | 438485f6a479 |
files | scripts/testfun/assert.m |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/testfun/assert.m Wed Apr 08 21:07:04 2015 -0400 +++ b/scripts/testfun/assert.m Thu Apr 09 13:54:07 2015 -0400 @@ -76,7 +76,8 @@ endif if (nargin == 1 || (nargin > 1 && islogical (cond) && ischar (varargin{1}))) - if ((! isnumeric (cond) && ! islogical (cond)) || ! all (cond(:))) + if ((! isnumeric (cond) && ! islogical (cond)) + || isempty (cond) || ! all (cond(:))) if (nargin == 1) ## Perhaps, say which elements failed? argin = ["(" strjoin(cellstr (argn), ",") ")"]; @@ -404,7 +405,10 @@ ## empty input -%!assert ([]) +%!error assert ([]) +%!error assert ("") +%!error assert ({}) +%!error assert (struct ([])) %!assert (zeros (3,0), zeros (3,0)) %!error <O\(3x0\)\s+E\(0x2\)> assert (zeros (3,0), zeros (0,2)) %!error <Dimensions don't match> assert (zeros (3,0), [])