# HG changeset patch # User Carlo de Falco # Date 1475074055 -7200 # Wed Sep 28 16:47:35 2016 +0200 # Node ID 34effa9b919c311a0670ea529a0cedc74a7fe4f4 # Parent b9f5ac691e03ebdafc9b34d7002521100edcea4e inputParser reset more parse results before new parse. (bug #49198) * scripts/general/inputParser.m(parse) : reset Unmatched and UsingDefaults before doing a new parse. diff --git a/scripts/general/inputParser.m b/scripts/general/inputParser.m --- a/scripts/general/inputParser.m +++ b/scripts/general/inputParser.m @@ -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 ());