Skip to content
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

feat(Mutator): Add mutator for GeneratedRegex #3106

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -289,3 +289,5 @@ StrykerLogs/
*.DotSettings
/src/Stryker.CLI/TestStatisticsAnalyzer/test-stats-report.json
.DS_Store

*.received.*
1 change: 1 addition & 0 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<PackageVersion Include="NuGet.Protocol" Version="6.12.1" />
<PackageVersion Include="ResXResourceReader.NetStandard" Version="1.3.0" />
<PackageVersion Include="YamlDotNet" Version="16.2.0" />
<PackageVersion Include="Verify.MSTest" Version="26.6.0" />
<PackageVersion Include="Grynwald.MarkdownGenerator" Version="3.0.106" />
<PackageVersion Include="LibGit2Sharp" Version="0.30.0" />
<PackageVersion Include="FSharp.Compiler.Service" Version="42.7.100-preview.22427.1" />
Expand Down
3 changes: 3 additions & 0 deletions src/Stryker.Abstractions/IReadOnlyMutant.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Stryker.Abstractions.TestRunners;
using Stryker.Abstractions.Mutants;
using Microsoft.CodeAnalysis;

namespace Stryker.Abstractions;

Expand All @@ -17,4 +18,6 @@ public interface IReadOnlyMutant
ITestGuids AssessingTests { get; }
bool CountForStats { get; }
bool IsStaticValue { get; }
string ReplacementText => Mutation.ReplacementNode.ToString();
FileLinePositionSpan OriginalLocation => Mutation.OriginalNode.GetLocation().GetMappedLineSpan();
}
5 changes: 5 additions & 0 deletions src/Stryker.Abstractions/Mutation.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using Microsoft.CodeAnalysis;
using Stryker.Abstractions.Mutators;

Expand All @@ -8,9 +9,13 @@
/// </summary>
public class Mutation
{
public SyntaxNode OriginalNode { get; set; }

Check warning on line 12 in src/Stryker.Abstractions/Mutation.cs

View workflow job for this annotation

GitHub Actions / integration-test

Non-nullable property 'OriginalNode' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 12 in src/Stryker.Abstractions/Mutation.cs

View workflow job for this annotation

GitHub Actions / integration-test

Non-nullable property 'OriginalNode' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
public SyntaxNode ReplacementNode { get; set; }

Check warning on line 13 in src/Stryker.Abstractions/Mutation.cs

View workflow job for this annotation

GitHub Actions / integration-test

Non-nullable property 'ReplacementNode' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 13 in src/Stryker.Abstractions/Mutation.cs

View workflow job for this annotation

GitHub Actions / integration-test

Non-nullable property 'ReplacementNode' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
public string DisplayName { get; set; }

Check warning on line 14 in src/Stryker.Abstractions/Mutation.cs

View workflow job for this annotation

GitHub Actions / integration-test

Non-nullable property 'DisplayName' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

Check warning on line 14 in src/Stryker.Abstractions/Mutation.cs

View workflow job for this annotation

GitHub Actions / integration-test

Non-nullable property 'DisplayName' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
public Mutator Type { get; set; }
public string Description { get; set; }

public string? ReplacementText { get; set; }

public FileLinePositionSpan? OriginalLocation { get; set; }
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Text.RegularExpressions;
namespace StrykerNet.UnitTest.Mutants.TestResources;
public partial class R {
private static Regex AbcGeneratedRegex() => (StrykerNamespace.MutantControl.IsActive(13)?AbcGeneratedRegex_RegexQuantifierRemovalMutation_uJA6aLkSDZf1nNEqTTrmUwkVMpUC():(StrykerNamespace.MutantControl.IsActive(12)?AbcGeneratedRegex_RegexPredefinedCharacterClassToCharacterClassWithItsNegationChange_MDzkRwclKiIgJcKRendsP7fvRxsC():(StrykerNamespace.MutantControl.IsActive(11)?AbcGeneratedRegex_RegexPredefinedCharacterClassNullification_zvabPNkNXi5E4WVy9DbXSDBtJBcC():(StrykerNamespace.MutantControl.IsActive(10)?AbcGeneratedRegex_RegexGreedyQuantifierToReluctantQuantifierModification_w4583iXfF3f5E1wYY0vUHvf89GsC():(StrykerNamespace.MutantControl.IsActive(9)?AbcGeneratedRegex_RegexGreedyQuantifierQuantityMutation_SxSBojTcWfK90GNEzOYCcKxKPEMC():(StrykerNamespace.MutantControl.IsActive(8)?AbcGeneratedRegex_RegexGreedyQuantifierQuantityMutation_EemMBA83KH5r9vsxwuYTbZItICIC():(StrykerNamespace.MutantControl.IsActive(7)?AbcGeneratedRegex_RegexGreedyQuantifierQuantityMutation_0IPy0NkuaZuus5vyaBNObDf8YBEC():(StrykerNamespace.MutantControl.IsActive(6)?AbcGeneratedRegex_RegexCharacterClassToAnycharChange_ChZb0RJfdWiCoO7uZWgXV9GKRWoC():(StrykerNamespace.MutantControl.IsActive(5)?AbcGeneratedRegex_RegexCharacterClassShorthandNegationMutation_MlYZgMyXCSRTuWJOS9wBgXbB5tcC():(StrykerNamespace.MutantControl.IsActive(4)?AbcGeneratedRegex_RegexCharacterClassNegationMutation_sUNdnI9ukFndVf8l6TkBoumJJRQC():(StrykerNamespace.MutantControl.IsActive(3)?AbcGeneratedRegex_RegexCharacterClassChildRemoval_yxJAlmw5XA356qagdqMKq3btNCEC():(StrykerNamespace.MutantControl.IsActive(2)?AbcGeneratedRegex_RegexCharacterClassChildRemoval_e4iNMNHMRl5IY1AYBopi97YjMQwC():(StrykerNamespace.MutantControl.IsActive(1)?AbcGeneratedRegex_RegexCharacterClassChildRemoval_5XPHLFUGLBs4SAQEaHNXnV9D4MkC():(StrykerNamespace.MutantControl.IsActive(0)?AbcGeneratedRegex_RegexAnchorRemovalMutation_SdtdlVHq9QAJyltvbdr0AfzHrW4C():AbcGeneratedRegex_Original()))))))))))))));
[GeneratedRegex(@"^[abc]\d?", RegexOptions.IgnoreCase, "en-US")]
private static partial Regex AbcGeneratedRegex_Original();
[GeneratedRegex("[abc]\\d?", RegexOptions.IgnoreCase, "en-US")]
private static partial Regex AbcGeneratedRegex_RegexAnchorRemovalMutation_SdtdlVHq9QAJyltvbdr0AfzHrW4C();
[GeneratedRegex("^[ab]\\d?", RegexOptions.IgnoreCase, "en-US")]
private static partial Regex AbcGeneratedRegex_RegexCharacterClassChildRemoval_5XPHLFUGLBs4SAQEaHNXnV9D4MkC();
[GeneratedRegex("^[ac]\\d?", RegexOptions.IgnoreCase, "en-US")]
private static partial Regex AbcGeneratedRegex_RegexCharacterClassChildRemoval_e4iNMNHMRl5IY1AYBopi97YjMQwC();
[GeneratedRegex("^[bc]\\d?", RegexOptions.IgnoreCase, "en-US")]
private static partial Regex AbcGeneratedRegex_RegexCharacterClassChildRemoval_yxJAlmw5XA356qagdqMKq3btNCEC();
[GeneratedRegex("^[^abc]\\d?", RegexOptions.IgnoreCase, "en-US")]
private static partial Regex AbcGeneratedRegex_RegexCharacterClassNegationMutation_sUNdnI9ukFndVf8l6TkBoumJJRQC();
[GeneratedRegex("^[abc]\\D?", RegexOptions.IgnoreCase, "en-US")]
private static partial Regex AbcGeneratedRegex_RegexCharacterClassShorthandNegationMutation_MlYZgMyXCSRTuWJOS9wBgXbB5tcC();
[GeneratedRegex("^[\\w\\W]\\d?", RegexOptions.IgnoreCase, "en-US")]
private static partial Regex AbcGeneratedRegex_RegexCharacterClassToAnycharChange_ChZb0RJfdWiCoO7uZWgXV9GKRWoC();
[GeneratedRegex("^[abc]\\d{0,0}", RegexOptions.IgnoreCase, "en-US")]
private static partial Regex AbcGeneratedRegex_RegexGreedyQuantifierQuantityMutation_0IPy0NkuaZuus5vyaBNObDf8YBEC();
[GeneratedRegex("^[abc]\\d{0,2}", RegexOptions.IgnoreCase, "en-US")]
private static partial Regex AbcGeneratedRegex_RegexGreedyQuantifierQuantityMutation_EemMBA83KH5r9vsxwuYTbZItICIC();
[GeneratedRegex("^[abc]\\d{1,1}", RegexOptions.IgnoreCase, "en-US")]
private static partial Regex AbcGeneratedRegex_RegexGreedyQuantifierQuantityMutation_SxSBojTcWfK90GNEzOYCcKxKPEMC();
[GeneratedRegex("^[abc]\\d??", RegexOptions.IgnoreCase, "en-US")]
private static partial Regex AbcGeneratedRegex_RegexGreedyQuantifierToReluctantQuantifierModification_w4583iXfF3f5E1wYY0vUHvf89GsC();
[GeneratedRegex("^[abc]d?", RegexOptions.IgnoreCase, "en-US")]
private static partial Regex AbcGeneratedRegex_RegexPredefinedCharacterClassNullification_zvabPNkNXi5E4WVy9DbXSDBtJBcC();
[GeneratedRegex("^[abc][\\d\\D]?", RegexOptions.IgnoreCase, "en-US")]
private static partial Regex AbcGeneratedRegex_RegexPredefinedCharacterClassToCharacterClassWithItsNegationChange_MDzkRwclKiIgJcKRendsP7fvRxsC();
[GeneratedRegex("^[abc]\\d", RegexOptions.IgnoreCase, "en-US")]
private static partial Regex AbcGeneratedRegex_RegexQuantifierRemovalMutation_uJA6aLkSDZf1nNEqTTrmUwkVMpUC();
}
Loading
Loading