Mercurial > octave
changeset 22559:27f2a7a3b55d stable
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 | 1751d490dc2f |
children | b828361c8949 |
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:59:48 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 ());