-
Notifications
You must be signed in to change notification settings - Fork 188
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
Stryker messes with compiler directives #3081
Comments
No fix has been provided for that. I suspect this triggers avoidable CompilationError mutations, so nothing urgent here. |
I started to look into that, and integrated the actual result from the first unit test I made. Thinking about it, it looks like Stryker should have a dedicated logic for trivia. Something along the lines of: |
That being said, fixing this will probably have quite an impact on the mutation step design. Nothing to worry about, but it may change some historical signatures. Mutation workflow will be impacted as more steps are required: strip undesired trivia during mutation generation and restoring them when injecting mutations |
Arghh: I forgot how hard it was to work with Roslyn's immutability approach... |
update: finally making progress public void SomeMethod() {if(StrykerNamespace.MutantControl.IsActive(0)){}else{
var x = 0;
#if !DEBUG
if(StrykerNamespace.MutantControl.IsActive(1)){;}else{if(StrykerNamespace.MutantControl.IsActive(2)){#if !DEBUG
x--;
}else{x++;}}
#endif
} directives are still part of the mutations, but are properly handled by switching logic |
Describe the bug
Mutated code may end up containing ill-formed compiler directives. I.e, Stryker does not ensure directives appear at the beginning of source lines. They may end up being captured within flow control statements.
Logs
When mutating this method
Stryker generates this version
Expected behavior
Compiler directives should not be transformed by the mutation step.
Previous example should result in something like this:
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: