-
Notifications
You must be signed in to change notification settings - Fork 385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip branches in generated MoveNext()
for singleton iterators
#813
Conversation
You should add also a complete real test inside folder https://github.com/tonerdo/coverlet/tree/master/test/coverlet.core.tests/Coverage:
If you need to debug your test you have to simply change code like ( FunctionExecutor.RunInProcess(async (string[] pathSerialize) =>
{
// Run load and call a delegate passing class as dynamic to simplify method call
CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run<SelectionStatements>(instance =>
{
// We call method to trigger coverage hits
instance.If(true);
// For now we have only async Run helper
return Task.CompletedTask;
}, persistPrepareResultToFile: pathSerialize[0], disableRestoreModules: true);
// we return 0 if we return something different assert fail
return 0;
}, new string[] { path }); These real tests run in separate process so you cannot debug as is, you need to change in 2 place Let me know if you're in trouble. |
cc: @matteoerigozzi can you take a look too? |
Ok, I'll look into it. I noticed one problem though: I'm unable to run the tests as described in CONTRIBUTING.md:
The escaping of the list doesn't seem to work on my end. Is this guideline still accurate? |
You're inside powershell you need to escape differently https://github.com/tonerdo/coverlet/blob/master/Documentation/MSBuildIntegration.md#note-for-powershell--vsts-users |
Well that was easier than expected. Do you want me to squash those commits? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well that was easier than expected. Do you want me to squash those commits?
No I'll squash on merge.
I'm bit busy these days...update seems ok but I need to go a bit deeper to confirm, I'll come back asap!Thank's! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pattern recognition seems too much generic
…(just guessing here)" This reverts commit 23607b7.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some more tests, seems ok.
Yup, that's right. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nits and a question on enumerable test.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
I refactored a bit tests to be more clear.
@bert2 feel free to take any other issue, if you like coverage one this is the query https://github.com/coverlet-coverage/coverlet/issues?q=is%3Aissue+is%3Aopen+label%3Atenet-coverage maybe start from |
CI ran but there were some issue between github and AzDo likely because we're in the middle of move btw this is the link of CI https://dev.azure.com/tonerdo/coverlet/_build/results?buildId=1023&view=results |
@MarcoRossignoli it definitely was a very interesting journey :) I will probably look into some of the coverage bugs, however I'm not sure when I'll be able to spend that much time for it again. |
No props at all it's not mandatory it's oss!Thank's again for the PR and help! |
Hey @MarcoRossignoli, I wrote a CodeLens extension for Visual Studio that shows you the instructions of a method: https://github.com/bert2/microscope Shameless self-promotion, I know, but it I think it could be quite useful when working on software like coverlet 😊 |
Thank you I'll give it a try for sure! |
This fixes #810 by skipping the two branches inside
MoveNext()
that will be generated when the iterator onlyyield
s once.For instance, the iterator...
...will result in a generated
MoveNext()
method that has noswitch
instruction, but abrfalse.s
and abeq.s
instruction instead: