Mercurial > octave
changeset 23507:7648014dccc6
Allow compile-time feature tests to pass with an empty set of features
* __have_feature__.m: Return true on an empty cell array of features.
Add actual %!tests.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Wed, 17 May 2017 18:45:14 -0700 |
parents | 7626613f3978 |
children | 4b38c9687331 |
files | scripts/testfun/__have_feature__.m |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/testfun/__have_feature__.m Wed May 17 18:20:34 2017 -0400 +++ b/scripts/testfun/__have_feature__.m Wed May 17 18:45:14 2017 -0700 @@ -31,7 +31,7 @@ if (iscellstr (feature)) retval = (all (isfield (features, feature)) - && cellfun (@(x) features.(x), feature)); + && all (cellfun (@(x) features.(x), feature))); elseif (ischar (feature)) retval = isfield (features, feature) && features.(feature); else @@ -41,5 +41,9 @@ endfunction -## No test coverage for internal function. It is tested through calling fcn. -%!assert (1) +%!assert (islogical (__have_feature__ ("MAGICK"))) +%!assert (isscalar (__have_feature__ ("MAGICK"))) +%!assert (__have_feature__ ("MAGICK") == __have_feature__ ({"MAGICK", "MAGICK"})) + +## Test that an empty feature set returns true +%!assert (__have_feature__ ({}))