octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #50752] inputParser Parameter key are parsed a


From: A.R. Burgers
Subject: [Octave-bug-tracker] [bug #50752] inputParser Parameter key are parsed as Optional
Date: Sun, 9 Apr 2017 16:31:59 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0

Follow-up Comment #6, bug #50752 (project octave):

Here the output for the 3 snippets:


% Does this errors about missing value for parameter line?
p = inputParser ();
p.addOptional ('op1', 'val1');
p.addParameter ('line', 'circle');
p.parse ('line');
p.Results ()

The argument 'line' is a string scalar or character vector and does not match
any parameter names. It failed validation for the argument 'op1'.



 % Does this error about invalid argument for line? Or does it
% backtracks and retests it as values for op1 and op2?
p = inputParser ();
p.addOptional ('op1', 'val1');
p.addOptional ('op2', 'val2');
p.addParameter ('line', 'circle', @ischar);
p.parse ('line', 89);
p.Results ()

The value of 'line' is invalid. It must satisfy the function: ischar.



 % If there's enough arguments to fill the positional options
% and param/key, does it do it?
p = inputParser ();
p.addOptional ('op1', 'val1');
p.addOptional ('op2', 'val2');
p.addParameter ('line', 'tree');
p.parse ('line', 'circle', 'line', 'rectangle');
p.Results ()

ans = struct with fields:
    line: 'rectangle'
     op1: 'val1'
     op2: 'val2'


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?50752>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]