# HG changeset patch # User Carlo de Falco # Date 1475234502 -7200 # Node ID 27f2a7a3b55d71f4d0b3df5cdab9d876128cacc6 # Parent 1751d490dc2fe41a11307cd76a446ae7b9a6f6c3 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 -r 1751d490dc2f -r 27f2a7a3b55d scripts/general/inputParser.m --- 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 ());