You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[main] Test has incorrect errors for -x 1 2 3 4 #2392
I modified the test only to get an interim variable for parseResult,
When I do this, the error list is
I encountered this because for Powderhouse I encountered issues with options with collection types and I believe I am using the same or funcionally equivalent code - and this test passes. In exploring why my new tests were failing, I realized this test does not appear to be succeeding at what the CLI and the commandline request.
I believe this test should result in a single parse error - an unexpected argument only on the 4.
First, the test input is bad. The successful test a couple up shows how an option's argument with a minimum arity greater than 1 should be tested. Specifically the test input should be: command.Parse("-x 1 -x 2 -x 3 -x 4").
Now with that, said, even once that is corrected that will only solve your first three "Unrecognized command or argument" errors from your screenshot. You are then left with two "Option '-x' expects a single argument but 4 were provided." errors. I would propose both the error message is incorrect, as well as the fact that there are two errors (I agree there really should only be one). This is not something new with powerhouse, this is existing behavior on main.
Activity
Keboo commentedon Apr 23, 2024
I think this may be a bug (even on main).
First, the test input is bad. The successful test a couple up shows how an option's argument with a minimum arity greater than 1 should be tested. Specifically the test input should be:
command.Parse("-x 1 -x 2 -x 3 -x 4").Now with that, said, even once that is corrected that will only solve your first three "Unrecognized command or argument" errors from your screenshot. You are then left with two "Option '-x' expects a single argument but 4 were provided." errors. I would propose both the error message is incorrect, as well as the fact that there are two errors (I agree there really should only be one). This is not something new with powerhouse, this is existing behavior on main.
elgonzo commentedon Apr 23, 2024
For this test to succeed, it would be required to set the option's
AllowMultipleArgumentsPerTokenproperty totrue:command-line-api/src/System.CommandLine/CliOption.cs
Lines 85 to 99 in 4457da4
(Commit and discussion related to making this disabled by default during past SCL development: #1199, #1162)
Fixing issue dotnet#2392
Fix duplicate errors appended