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
Resolve differences between NUnit Console and NUnitLite implementations of @filename #1877
We (well actually I) mistakenly merged the nunitlite changes thinking that the differences between the console runner and nunitlite implementations had already been resolved between @NikolayPianikov and @oznetmaster
We need to decide first what features to include / exclude then change one or both of them so that users do not get confused and features we have not decided to support do not become supported by default.
Eventually, we should also resolve code differences for the common features but that can await the point where we create a shared codebase for conmmand-line option processing.
I'm putting this in the discussion pipeline so that the NUnit team can work out what we want to support. Everyone else is welcome to participate in the discussion as well.
I've used Regex from @oznetmaster and I could add the nesting of any levels during 5 minutes if it is needed. I agree it would be better to have one code base and it doesn't matter for me which code will be preferable. I am just interested in implementation of this feature.
So I would like to highlight some questions:
About requirements:
We should clarify a list of requirements.
Should we implement minimum sufficient set of requirements? Or ...
Will we support the nesting?
Will we support symbol " within the argument?
About implementation:
Should we duplicate a code or should we use some common assembly?
Which code we will choose?
Who will be responsible for implementation?
Is it possible to use our Linq in the implementation (additional reference)?
"I guess I am recommending we leave at least one level of nesting (currently my code has two - it is only a constant), and remove the alternative delimiter. Then modify the console code to support the same syntax."
I think this is a minimum fix that will keep users from getting confused.
As already stated, I don't support trying to make the code common right now. There's a bigger project I would like to do that would include this: developing an entire shared codebase for option handling, including our own version of Options.cs and using a submodule to share the code. But we have many more high priority things to worry about right now, so I think this can wait. So long as the two bits of code actually do the same thing, we will avoid complaints from our users.
I intended this to be in the Discussion pipeline when I created it but didn't put it there.
@NikolayPianikov Once we are done discussing and have decided on a course of action, we'll move it to the Backlog. Someone will decide to do it or we will pick someone. Then they will do it. 😄
The number of levels of nesting in my code is a constant. It is only there to eliminate the possibility of infinite recursion. It serves no other function.
@oznetmasterI looked in the repo for your code, but didn't see it. I guess you are talking about your private build. Did you retain compatibility with external runners? That is, do you still pass a single string to the framework containing the parameter info, or are you passing a list?
Since the console runner already handles --where "method =~ /Source.*Test/ && class =~ 'My.Namespace.Classname'"
so that should also be how it should be written in a file.
@oznetmaster Still waiting to hear from you regarding how you suggest that multiple-line options, like where clauses, should be handled. It's not clear to me from your comments so far.
So far, there doesn't seem to be a clean way to handle multi-line arguments containing spaces other than putting them into quotes. I'd really like something like the cited example above to work.
@CharliePoole the way I would imagine is for each argument to control consumption of the remainder of the command line. So --where's logic is that it takes the rest of the command line unless it runs into a -- not inside a string which would signify the start of a new switch. Or perhaps even -[a-z0-9].
@jnm2
That would be the best solution if we were ready to redo our command-line processing - and maybe this will push us to that.
Currently, the handling of @filename in the command-line is done by a pre-processing step. The actual processing is done by Mono.Options, which is included as source in both NUnitLite and the console runner, but which we have made it a practice to leave unmodified.
I have a back-burner project to create our own command-line options processor. Mono.Options has features we don't need and lacks a few things we could use. I was hoping, however, to be able to fix the current issue while sticking with the pre-processor model.
One option may be a "smarter" pre-processor. Or I may just do as much as is possible within the current design constraints and deal with better stuff later.
@oznetmaster
FYI, I found and fixed a few issues in the tests themselves:
The expected result is tested as a string, using Join, but that doesn't allow for the fact that various string arrays can produce the same string. When I added new tests, I found that some things looked correct when joined but that the arguments were not separated correctly, especially when spaces were involved.
The character '|' is used with a special meaning but it's a commonly used character in the where clause. I may end up with a whole new test method just for where clauses.
General approach I plan to use for resolving this issue together with nunit/nunit-console#126...
Use @NikolayPianikov 's approach to the tests. I may also move away from TestCase to use of TestCaseSource, which is cleaner when the arguments get more complicated.
Drop use of the [] notation to specify a delimiter that replaces newlines. Although this is useful in @oznetmaster 's extended implementation, it doesn't really serve a purpose in ours right now. If we needed something like this in the future, I'd prefer to see it implemented as special comments at the start of the included file. That way, the user doesn't have to remember a special option to use with each file. Anyway, we don't need it for the moment.
Explore some special syntax for use in the file when specifying multi-line arguments. This is particularly useful for TSL, which we should be able to lay out like a program in the file. May also be useful for options. I'll post ideas as I get to this part.
Activity
NikolayPianikov commentedon Nov 1, 2016
I've used Regex from @oznetmaster and I could add the nesting of any levels during 5 minutes if it is needed. I agree it would be better to have one code base and it doesn't matter for me which code will be preferable. I am just interested in implementation of this feature.
So I would like to highlight some questions:
About requirements:
About implementation:
CharliePoole commentedon Nov 1, 2016
I support @oznetmaster 's proposal in PR #1856:
"I guess I am recommending we leave at least one level of nesting (currently my code has two - it is only a constant), and remove the alternative delimiter. Then modify the console code to support the same syntax."
I think this is a minimum fix that will keep users from getting confused.
As already stated, I don't support trying to make the code common right now. There's a bigger project I would like to do that would include this: developing an entire shared codebase for option handling, including our own version of Options.cs and using a submodule to share the code. But we have many more high priority things to worry about right now, so I think this can wait. So long as the two bits of code actually do the same thing, we will avoid complaints from our users.
CharliePoole commentedon Nov 1, 2016
I intended this to be in the Discussion pipeline when I created it but didn't put it there.
@NikolayPianikov Once we are done discussing and have decided on a course of action, we'll move it to the Backlog. Someone will decide to do it or we will pick someone. Then they will do it. 😄
CharliePoole commentedon Nov 5, 2016
OK... I don't see any action on this folks, so I'll lay out a proposal...
Let's allow a single level of nesting and remove the alternative delimiter as @oznetmaster suggested.
If this is agreed upon, then we need to
@rprouse @oznetmaster @NikolayPianikov Do you agree?
oznetmaster commentedon Nov 5, 2016
The number of levels of nesting in my code is a constant. It is only there to eliminate the possibility of infinite recursion. It serves no other function.
Removing the alternative delimiter is easy.
rprouse commentedon Nov 5, 2016
Agreed to all points.
CharliePoole commentedon Nov 6, 2016
Replicating the issue for nunit-console
CharliePoole commentedon Nov 6, 2016
@oznetmaster
I looked in the repo for your code, but didn't see it. I guess you are talking about your private build. Did you retain compatibility with external runners? That is, do you still pass a single string to the framework containing the parameter info, or are you passing a list?oznetmaster commentedon Nov 6, 2016
@CharliePoole not sure what you are asking. This issue is about @filename, not parameters
CharliePoole commentedon Nov 6, 2016
My mistake - I had both issues open.
NikolayPianikov commentedon Nov 7, 2016
I agree with it
15 remaining items
JustinRChou commentedon Apr 16, 2017
Since the console runner already handles
--where "method =~ /Source.*Test/ && class =~ 'My.Namespace.Classname'"so that should also be how it should be written in a file.
CharliePoole commentedon Apr 16, 2017
@oznetmaster I'd like to hear how the user would input those examples in your implementation.
@JustinRChou While I like your example, the fact is that there isn't a standard for how options are specified at the command-line. The OS handles it.
CharliePoole commentedon Apr 18, 2017
@oznetmaster Still waiting to hear from you regarding how you suggest that multiple-line options, like where clauses, should be handled. It's not clear to me from your comments so far.
CharliePoole commentedon Apr 19, 2017
I decided to add tests as a starting point. 😄
oznetmaster commentedon Apr 19, 2017
I have tests for the my nunitlite implementation.
Do you want them?
oznetmaster commentedon Apr 19, 2017
Actually, they are in the repo in nunitlite.tests\CommandLineTests.cs
CharliePoole commentedon Apr 19, 2017
Yes, I started with those and am expanding them.
So far, there doesn't seem to be a clean way to handle multi-line arguments containing spaces other than putting them into quotes. I'd really like something like the cited example above to work.
jnm2 commentedon Apr 19, 2017
@CharliePoole the way I would imagine is for each argument to control consumption of the remainder of the command line. So
--where's logic is that it takes the rest of the command line unless it runs into a--not inside a string which would signify the start of a new switch. Or perhaps even-[a-z0-9].CharliePoole commentedon Apr 19, 2017
@jnm2
That would be the best solution if we were ready to redo our command-line processing - and maybe this will push us to that.
Currently, the handling of @filename in the command-line is done by a pre-processing step. The actual processing is done by Mono.Options, which is included as source in both NUnitLite and the console runner, but which we have made it a practice to leave unmodified.
I have a back-burner project to create our own command-line options processor. Mono.Options has features we don't need and lacks a few things we could use. I was hoping, however, to be able to fix the current issue while sticking with the pre-processor model.
One option may be a "smarter" pre-processor. Or I may just do as much as is possible within the current design constraints and deal with better stuff later.
@oznetmaster
FYI, I found and fixed a few issues in the tests themselves:
CharliePoole commentedon Apr 19, 2017
General approach I plan to use for resolving this issue together with nunit/nunit-console#126...
Use @NikolayPianikov 's approach to the tests. I may also move away from
TestCaseto use ofTestCaseSource, which is cleaner when the arguments get more complicated.Drop use of the [] notation to specify a delimiter that replaces newlines. Although this is useful in @oznetmaster 's extended implementation, it doesn't really serve a purpose in ours right now. If we needed something like this in the future, I'd prefer to see it implemented as special comments at the start of the included file. That way, the user doesn't have to remember a special option to use with each file. Anyway, we don't need it for the moment.
Explore some special syntax for use in the file when specifying multi-line arguments. This is particularly useful for TSL, which we should be able to lay out like a program in the file. May also be useful for options. I'll post ideas as I get to this part.