# HG changeset patch # User Carlo de Falco # Date 1474991794 -7200 # Node ID 4b7ab10b5c38a9cfc64b1495ce432196c2bcce7c # Parent 6574e90e8e27f51f14d7370a7b37575133cef396 inputParser clear previous results before new parse (bug #49198) * scripts/general/inputParser.m(parse) : reset Results before doing a new parse. diff -r 6574e90e8e27 -r 4b7ab10b5c38 scripts/general/inputParser.m --- a/scripts/general/inputParser.m Tue Sep 27 13:22:22 2016 +0200 +++ b/scripts/general/inputParser.m Tue Sep 27 17:56:34 2016 +0200 @@ -372,6 +372,7 @@ endfunction function parse (this, varargin) + this.Results = struct (); if (numel (varargin) < numel (this.Required)) if (this.FunctionName) print_usage (this.FunctionName); @@ -731,3 +732,12 @@ %! p.addParameter ("line", "tree"); %! p.parse ("line", "circle"); %! assert (p.Results, struct ("op1", "val", "line", "circle")); + +%!test +%! p = inputParser; +%! p.addParameter ("a", []); +%! p.addParameter ("b", []); +%! p.parse ("a", 1); +%! p.parse ("b", 1); +%! assert (p.Results, struct ("a", [], "b", 1)); +