Mercurial > octave
changeset 22560:55dde71ee251
inputParser reset more parse results before new parse. (bug #49198)
* scripts/general/inputParser.m(parse) : reset Unmatched and UsingDefaults before doing
a new parse.
author | Carlo de Falco <carlo.defalco@polimi.it> |
---|---|
date | Fri, 30 Sep 2016 13:21:42 +0200 |
parents | 121e9639b604 |
children | 202c6871f07d |
files | scripts/general/inputParser.m |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/general/inputParser.m Thu Sep 29 15:44:54 2016 -0700 +++ b/scripts/general/inputParser.m Fri Sep 30 13:21:42 2016 +0200 @@ -373,6 +373,8 @@ function parse (this, varargin) this.Results = struct (); + this.Unmatched = struct (); + this.UsingDefaults = cell (); if (numel (varargin) < numel (this.Required)) if (this.FunctionName) print_usage (this.FunctionName); @@ -740,4 +742,13 @@ %! p.parse ("a", 1); %! p.parse ("b", 1); %! assert (p.Results, struct ("a", [], "b", 1)); +%! assert (p.UsingDefaults, {"a"}); +%!test +%! p = inputParser; +%! p.addParameter ("b", []); +%! p.KeepUnmatched = true; +%! p.parse ("a", 1); +%! p.parse ("b", 1); +%! assert (p.Results, struct ("b", 1)); +%! assert (p.Unmatched, struct ());