From 705bc66a46905340c1c2149ea83e94fe9952f423 Mon Sep 17 00:00:00 2001
From: iamdmitrij <3024338+iamdmitrij@users.noreply.github.com>
Date: Tue, 21 May 2024 23:03:23 +0300
Subject: [PATCH 01/14] Add support for Utf8 string literals
---
docs/mutations.md | 2 +
.../NetCoreTestProject.XUnit.csproj | 1 +
.../String/Utf8StringMagicTests.cs | 50 +++++++++++++++++
.../TargetProject/String/Utf8StringMagic.cs | 33 ++++++++++++
.../Mutators/StringMutatorTests.cs | 23 ++++++++
.../Stryker.Core/Mutators/StringMutator.cs | 54 +++++++++++++++++--
6 files changed, 158 insertions(+), 5 deletions(-)
create mode 100644 integrationtest/TargetProjects/NetCoreTestProject.XUnit/String/Utf8StringMagicTests.cs
create mode 100644 integrationtest/TargetProjects/TargetProject/String/Utf8StringMagic.cs
diff --git a/docs/mutations.md b/docs/mutations.md
index 4f20d17aaa..9fda87f165 100644
--- a/docs/mutations.md
+++ b/docs/mutations.md
@@ -157,7 +157,9 @@ Do you have a suggestion for a (new) mutator? Feel free to create an [issue](htt
| Original | Mutated |
| ------------- | ------------- |
| `"foo"` | `""` |
+| `"foo"u8` | `""u8` |
| `""` | `"Stryker was here!"` |
+| `""u8` | `"Stryker was here!"u8` |
| `$"foo {bar}"` | `$""` |
| `@"foo"` | `@""` |
| `string.Empty` | `"Stryker was here!"` |
diff --git a/integrationtest/TargetProjects/NetCoreTestProject.XUnit/NetCoreTestProject.XUnit.csproj b/integrationtest/TargetProjects/NetCoreTestProject.XUnit/NetCoreTestProject.XUnit.csproj
index 68f3462fb8..64c3ceaf2d 100644
--- a/integrationtest/TargetProjects/NetCoreTestProject.XUnit/NetCoreTestProject.XUnit.csproj
+++ b/integrationtest/TargetProjects/NetCoreTestProject.XUnit/NetCoreTestProject.XUnit.csproj
@@ -2,6 +2,7 @@
net6.0
+ latest
diff --git a/integrationtest/TargetProjects/NetCoreTestProject.XUnit/String/Utf8StringMagicTests.cs b/integrationtest/TargetProjects/NetCoreTestProject.XUnit/String/Utf8StringMagicTests.cs
new file mode 100644
index 0000000000..17c4ab4e27
--- /dev/null
+++ b/integrationtest/TargetProjects/NetCoreTestProject.XUnit/String/Utf8StringMagicTests.cs
@@ -0,0 +1,50 @@
+using ExampleProject.String;
+using Xunit;
+
+namespace ExampleProject.XUnit.String
+{
+ public class Utf8StringMagicTests
+ {
+ [Fact]
+ public void AddTwoStrings()
+ {
+ var sut = new Utf8StringMagic();
+ var actual = sut.HelloWorld();
+ Assert.Equal("Hello World!"u8, actual);
+ }
+
+ [Fact]
+ public void IsNullOrEmpty()
+ {
+ var sut = new Utf8StringMagic();
+ var actual = sut.IsNullOrEmpty("hello"u8);
+ Assert.False(actual);
+ }
+
+ [Fact]
+ public void IsNullOrEmpty_Empty()
+ {
+ var sut = new Utf8StringMagic();
+ var actual = sut.IsNullOrEmpty(""u8);
+ Assert.True(actual);
+ }
+
+ [Fact]
+ public void Referenced()
+ {
+ var sut = new Utf8StringMagic();
+ var input = "hello"u8;
+ sut.Referenced(out input);
+ Assert.Equal("world"u8, input);
+ }
+
+ [Fact]
+ public void ReferencedEmpty()
+ {
+ var sut = new Utf8StringMagic();
+ var input = "hello"u8;
+ sut.ReferencedEmpty(out input);
+ Assert.Equal(""u8, input);
+ }
+ }
+}
diff --git a/integrationtest/TargetProjects/TargetProject/String/Utf8StringMagic.cs b/integrationtest/TargetProjects/TargetProject/String/Utf8StringMagic.cs
new file mode 100644
index 0000000000..75b1438732
--- /dev/null
+++ b/integrationtest/TargetProjects/TargetProject/String/Utf8StringMagic.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Linq;
+
+namespace ExampleProject.String
+{
+ public class Utf8StringMagic
+ {
+ public ReadOnlySpan HelloWorld()
+ {
+ var a = "";
+ return "Hello"u8 + " "u8 + "World!"u8;
+ }
+
+ public void Referenced(out ReadOnlySpan test)
+ {
+ test = "world"u8;
+ }
+
+ public void ReferencedEmpty(out ReadOnlySpan test)
+ {
+ test = ""u8;
+ }
+
+ public bool IsNullOrEmpty(ReadOnlySpan myString)
+ {
+ if (myString.IsEmpty)
+ {
+ return true;
+ }
+ return false;
+ }
+ }
+}
diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Mutators/StringMutatorTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Mutators/StringMutatorTests.cs
index 39cf4f90d9..3ac93b385c 100644
--- a/src/Stryker.Core/Stryker.Core.UnitTest/Mutators/StringMutatorTests.cs
+++ b/src/Stryker.Core/Stryker.Core.UnitTest/Mutators/StringMutatorTests.cs
@@ -16,6 +16,29 @@ public void ShouldBeMutationLevelStandard()
target.MutationLevel.ShouldBe(MutationLevel.Standard);
}
+ [Theory]
+ [InlineData("", """
+ "Stryker was here!"u8
+ """)]
+ [InlineData("foo", """
+ ""u8
+ """)]
+ public void ShouldMutateUtf8(string original, string expected)
+ {
+ var syntaxTree = CSharpSyntaxTree.ParseText($"""var = "{original}"u8;""");
+
+ var literalExpression = syntaxTree.GetRoot().DescendantNodes().OfType().First();
+ var mutator = new StringMutator();
+
+ var result = mutator.ApplyMutations(literalExpression, null).ToList();
+
+ var mutation = result.ShouldHaveSingleItem();
+
+ mutation.ReplacementNode.ShouldBeOfType()
+ .Token.Text.ShouldBe(expected);
+ mutation.DisplayName.ShouldBe("String mutation");
+ }
+
[Theory]
[InlineData("", "Stryker was here!")]
[InlineData("foo", "")]
diff --git a/src/Stryker.Core/Stryker.Core/Mutators/StringMutator.cs b/src/Stryker.Core/Stryker.Core/Mutators/StringMutator.cs
index f2fe819e25..db3050f4d0 100644
--- a/src/Stryker.Core/Stryker.Core/Mutators/StringMutator.cs
+++ b/src/Stryker.Core/Stryker.Core/Mutators/StringMutator.cs
@@ -17,24 +17,52 @@ public override IEnumerable ApplyMutations(LiteralExpressionSyntax nod
// Get objectCreationSyntax to check if it contains a regex type.
var root = node.Parent?.Parent?.Parent;
- if (!IsSpecialType(root) && IsStringLiteral(node))
+ if (!IsSpecialType(root))
{
- var currentValue = (string)node.Token.Value;
- var replacementValue = currentValue == "" ? "Stryker was here!" : "";
+ SyntaxNode syntaxNode;
+ string currentValue;
+ string replacementValue;
+
+ if (IsStringLiteral(node))
+ {
+ currentValue = (string)node.Token.Value;
+ replacementValue = currentValue == "" ? "Stryker was here!" : "";
+ syntaxNode = SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression,
+ SyntaxFactory.Literal(replacementValue));
+ }
+ else if(IsUtf8StringLiteral(node))
+ {
+ currentValue = (string)node.Token.Value;
+ replacementValue = currentValue == "" ? "Stryker was here!" : "";
+ syntaxNode = CreateUtf88String(node.GetLeadingTrivia(), replacementValue, node.GetTrailingTrivia());
+ }
+ else
+ {
+ yield break;
+ }
+
+
yield return new Mutation
{
OriginalNode = node,
- ReplacementNode = SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, SyntaxFactory.Literal(replacementValue)),
+ ReplacementNode = syntaxNode,
DisplayName = "String mutation",
Type = Mutator.String
};
}
}
+ private static bool IsUtf8StringLiteral(LiteralExpressionSyntax node)
+ {
+ var kind = node.Kind();
+ return kind is SyntaxKind.Utf8StringLiteralExpression
+ && node.Parent is not ConstantPatternSyntax;
+ }
+
private static bool IsStringLiteral(LiteralExpressionSyntax node)
{
var kind = node.Kind();
- return kind == SyntaxKind.StringLiteralExpression
+ return kind is SyntaxKind.StringLiteralExpression
&& node.Parent is not ConstantPatternSyntax;
}
@@ -49,4 +77,20 @@ private static bool IsCtorOfType(ObjectCreationExpressionSyntax ctor, Type type)
var ctorType = ctor.Type.ToString();
return ctorType == type.Name || ctorType == type.FullName;
}
+
+ private static LiteralExpressionSyntax CreateUtf88String(SyntaxTriviaList leadingTrivia, string stringValue, SyntaxTriviaList trailingTrivia)
+ {
+ var quoteCharacter = '"';
+ var suffix = "u8";
+
+ var literal = SyntaxFactory.Token(
+ leading: leadingTrivia,
+ kind: SyntaxKind.Utf8StringLiteralToken,
+ text: quoteCharacter + stringValue + quoteCharacter + suffix,
+ valueText: "",
+ trailing: trailingTrivia);
+
+ return SyntaxFactory.LiteralExpression(SyntaxKind.Utf8StringLiteralExpression, literal);
+ }
+
}
From 4430981ac30e320439cd899fe78f104947549fb0 Mon Sep 17 00:00:00 2001
From: iamdmitrij <3024338+iamdmitrij@users.noreply.github.com>
Date: Wed, 22 May 2024 08:02:01 +0300
Subject: [PATCH 02/14] Change integration test results
---
integrationtest/ValidationProject/ValidateStrykerResults.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/integrationtest/ValidationProject/ValidateStrykerResults.cs b/integrationtest/ValidationProject/ValidateStrykerResults.cs
index 2bc35f71b3..fe1f4ad95e 100644
--- a/integrationtest/ValidationProject/ValidateStrykerResults.cs
+++ b/integrationtest/ValidationProject/ValidateStrykerResults.cs
@@ -82,7 +82,7 @@ public void NetCore()
var report = JsonConvert.DeserializeObject(strykerRunOutput);
- CheckReportMutants(report, total: 114, ignored: 55, survived: 4, killed: 6, timeout: 2, nocoverage: 45);
+ CheckReportMutants(report, total: 130, ignored: 60, survived: 5, killed: 10, timeout: 2, nocoverage: 45);
CheckReportTestCounts(report, total: 14);
}
@@ -140,7 +140,7 @@ public void SolutionRun()
var report = JsonConvert.DeserializeObject(strykerRunOutput);
- CheckReportMutants(report, total: 114, ignored: 55, survived: 4, killed: 6, timeout: 2, nocoverage: 45);
+ CheckReportMutants(report, total: 130, ignored: 55, survived: 4, killed: 6, timeout: 2, nocoverage: 45);
CheckReportTestCounts(report, total: 30);
}
From b09a3a82f504488274389ee2adcedcba3a6c251b Mon Sep 17 00:00:00 2001
From: iamdmitrij <3024338+iamdmitrij@users.noreply.github.com>
Date: Wed, 22 May 2024 08:05:24 +0300
Subject: [PATCH 03/14] Fix test results
---
integrationtest/ValidationProject/ValidateStrykerResults.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/integrationtest/ValidationProject/ValidateStrykerResults.cs b/integrationtest/ValidationProject/ValidateStrykerResults.cs
index fe1f4ad95e..80545465c1 100644
--- a/integrationtest/ValidationProject/ValidateStrykerResults.cs
+++ b/integrationtest/ValidationProject/ValidateStrykerResults.cs
@@ -83,7 +83,7 @@ public void NetCore()
var report = JsonConvert.DeserializeObject(strykerRunOutput);
CheckReportMutants(report, total: 130, ignored: 60, survived: 5, killed: 10, timeout: 2, nocoverage: 45);
- CheckReportTestCounts(report, total: 14);
+ CheckReportTestCounts(report, total: 19);
}
[Fact]
From efcfa2f2d156bce6593e0fe3b23c97d8ef85c78b Mon Sep 17 00:00:00 2001
From: iamdmitrij <3024338+iamdmitrij@users.noreply.github.com>
Date: Wed, 22 May 2024 08:05:57 +0300
Subject: [PATCH 04/14] Refactor ApplyMutations method
---
.../Stryker.Core/Mutators/StringMutator.cs | 60 ++++++++++---------
1 file changed, 31 insertions(+), 29 deletions(-)
diff --git a/src/Stryker.Core/Stryker.Core/Mutators/StringMutator.cs b/src/Stryker.Core/Stryker.Core/Mutators/StringMutator.cs
index db3050f4d0..0db91571af 100644
--- a/src/Stryker.Core/Stryker.Core/Mutators/StringMutator.cs
+++ b/src/Stryker.Core/Stryker.Core/Mutators/StringMutator.cs
@@ -17,39 +17,41 @@ public override IEnumerable ApplyMutations(LiteralExpressionSyntax nod
// Get objectCreationSyntax to check if it contains a regex type.
var root = node.Parent?.Parent?.Parent;
- if (!IsSpecialType(root))
+ if (IsSpecialType(root))
{
- SyntaxNode syntaxNode;
- string currentValue;
- string replacementValue;
+ yield break;
+ }
- if (IsStringLiteral(node))
- {
- currentValue = (string)node.Token.Value;
- replacementValue = currentValue == "" ? "Stryker was here!" : "";
- syntaxNode = SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression,
- SyntaxFactory.Literal(replacementValue));
- }
- else if(IsUtf8StringLiteral(node))
- {
- currentValue = (string)node.Token.Value;
- replacementValue = currentValue == "" ? "Stryker was here!" : "";
- syntaxNode = CreateUtf88String(node.GetLeadingTrivia(), replacementValue, node.GetTrailingTrivia());
- }
- else
- {
- yield break;
- }
-
+ SyntaxNode syntaxNode;
+ string currentValue;
+ string replacementValue;
- yield return new Mutation
- {
- OriginalNode = node,
- ReplacementNode = syntaxNode,
- DisplayName = "String mutation",
- Type = Mutator.String
- };
+ if (IsStringLiteral(node))
+ {
+ currentValue = (string)node.Token.Value;
+ replacementValue = currentValue == "" ? "Stryker was here!" : "";
+ syntaxNode = SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression,
+ SyntaxFactory.Literal(replacementValue));
+ }
+ else if(IsUtf8StringLiteral(node))
+ {
+ currentValue = (string)node.Token.Value;
+ replacementValue = currentValue == "" ? "Stryker was here!" : "";
+ syntaxNode = CreateUtf88String(node.GetLeadingTrivia(), replacementValue, node.GetTrailingTrivia());
}
+ else
+ {
+ yield break;
+ }
+
+
+ yield return new Mutation
+ {
+ OriginalNode = node,
+ ReplacementNode = syntaxNode,
+ DisplayName = "String mutation",
+ Type = Mutator.String
+ };
}
private static bool IsUtf8StringLiteral(LiteralExpressionSyntax node)
From c73643b3988c990c66cfb6d520f364543b3df446 Mon Sep 17 00:00:00 2001
From: iamdmitrij <3024338+iamdmitrij@users.noreply.github.com>
Date: Wed, 22 May 2024 08:19:46 +0300
Subject: [PATCH 05/14] Remove new lines
---
src/Stryker.Core/Stryker.Core/Mutators/StringMutator.cs | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/Stryker.Core/Stryker.Core/Mutators/StringMutator.cs b/src/Stryker.Core/Stryker.Core/Mutators/StringMutator.cs
index 0db91571af..cf0dc94026 100644
--- a/src/Stryker.Core/Stryker.Core/Mutators/StringMutator.cs
+++ b/src/Stryker.Core/Stryker.Core/Mutators/StringMutator.cs
@@ -43,7 +43,6 @@ public override IEnumerable ApplyMutations(LiteralExpressionSyntax nod
{
yield break;
}
-
yield return new Mutation
{
@@ -94,5 +93,4 @@ private static LiteralExpressionSyntax CreateUtf88String(SyntaxTriviaList leadin
return SyntaxFactory.LiteralExpression(SyntaxKind.Utf8StringLiteralExpression, literal);
}
-
}
From bf247d258ae5f33698f0729dd6f3a9330cb5f80c Mon Sep 17 00:00:00 2001
From: iamdmitrij <3024338+iamdmitrij@users.noreply.github.com>
Date: Wed, 22 May 2024 08:29:52 +0300
Subject: [PATCH 06/14] Fix ShouldMutateUtf8 unit test
---
.../Stryker.Core.UnitTest/Mutators/StringMutatorTests.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Mutators/StringMutatorTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Mutators/StringMutatorTests.cs
index 3ac93b385c..17262e8552 100644
--- a/src/Stryker.Core/Stryker.Core.UnitTest/Mutators/StringMutatorTests.cs
+++ b/src/Stryker.Core/Stryker.Core.UnitTest/Mutators/StringMutatorTests.cs
@@ -23,9 +23,9 @@ public void ShouldBeMutationLevelStandard()
[InlineData("foo", """
""u8
""")]
- public void ShouldMutateUtf8(string original, string expected)
+ public void ShouldMutateUtf8StringLiteral(string original, string expected)
{
- var syntaxTree = CSharpSyntaxTree.ParseText($"""var = "{original}"u8;""");
+ var syntaxTree = CSharpSyntaxTree.ParseText($"""var test = "{original}"u8;""");
var literalExpression = syntaxTree.GetRoot().DescendantNodes().OfType().First();
var mutator = new StringMutator();
From 9ac57f4c1ce133f517dabb34a39e47dde8e2c851 Mon Sep 17 00:00:00 2001
From: iamdmitrij <3024338+iamdmitrij@users.noreply.github.com>
Date: Wed, 22 May 2024 08:36:45 +0300
Subject: [PATCH 07/14] Remove plain string from integration test
---
.../TargetProjects/TargetProject/String/Utf8StringMagic.cs | 1 -
1 file changed, 1 deletion(-)
diff --git a/integrationtest/TargetProjects/TargetProject/String/Utf8StringMagic.cs b/integrationtest/TargetProjects/TargetProject/String/Utf8StringMagic.cs
index 75b1438732..de92605da3 100644
--- a/integrationtest/TargetProjects/TargetProject/String/Utf8StringMagic.cs
+++ b/integrationtest/TargetProjects/TargetProject/String/Utf8StringMagic.cs
@@ -7,7 +7,6 @@ public class Utf8StringMagic
{
public ReadOnlySpan HelloWorld()
{
- var a = "";
return "Hello"u8 + " "u8 + "World!"u8;
}
From 684172942429132f093285a1a633f1170ef5f4e7 Mon Sep 17 00:00:00 2001
From: Dmitrij <3024338+iamdmitrij@users.noreply.github.com>
Date: Wed, 22 May 2024 09:32:18 +0300
Subject: [PATCH 08/14] Update ValidateStrykerResults.cs
---
integrationtest/ValidationProject/ValidateStrykerResults.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/integrationtest/ValidationProject/ValidateStrykerResults.cs b/integrationtest/ValidationProject/ValidateStrykerResults.cs
index 80545465c1..335673cc85 100644
--- a/integrationtest/ValidationProject/ValidateStrykerResults.cs
+++ b/integrationtest/ValidationProject/ValidateStrykerResults.cs
@@ -82,7 +82,7 @@ public void NetCore()
var report = JsonConvert.DeserializeObject(strykerRunOutput);
- CheckReportMutants(report, total: 130, ignored: 60, survived: 5, killed: 10, timeout: 2, nocoverage: 45);
+ CheckReportMutants(report, total: 129, ignored: 59, survived: 5, killed: 10, timeout: 2, nocoverage: 45);
CheckReportTestCounts(report, total: 19);
}
From 54653f8c65dbf2cfbf167388fe5c8c57273107fb Mon Sep 17 00:00:00 2001
From: Dmitrij <3024338+iamdmitrij@users.noreply.github.com>
Date: Wed, 22 May 2024 09:43:47 +0300
Subject: [PATCH 09/14] Update ValidateStrykerResults.cs
---
integrationtest/ValidationProject/ValidateStrykerResults.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/integrationtest/ValidationProject/ValidateStrykerResults.cs b/integrationtest/ValidationProject/ValidateStrykerResults.cs
index 335673cc85..dcec4cdf38 100644
--- a/integrationtest/ValidationProject/ValidateStrykerResults.cs
+++ b/integrationtest/ValidationProject/ValidateStrykerResults.cs
@@ -140,7 +140,7 @@ public void SolutionRun()
var report = JsonConvert.DeserializeObject(strykerRunOutput);
- CheckReportMutants(report, total: 130, ignored: 55, survived: 4, killed: 6, timeout: 2, nocoverage: 45);
+ CheckReportMutants(report, total: 129, ignored: 59, survived: 5, killed: 10, timeout: 2, nocoverage: 45);
CheckReportTestCounts(report, total: 30);
}
From 318b569d803e607d91d1d3c3f92a6ad80fe2f0e8 Mon Sep 17 00:00:00 2001
From: Dmitrij <3024338+iamdmitrij@users.noreply.github.com>
Date: Wed, 22 May 2024 09:52:46 +0300
Subject: [PATCH 10/14] Update ValidateStrykerResults.cs
---
integrationtest/ValidationProject/ValidateStrykerResults.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/integrationtest/ValidationProject/ValidateStrykerResults.cs b/integrationtest/ValidationProject/ValidateStrykerResults.cs
index dcec4cdf38..f891dc020f 100644
--- a/integrationtest/ValidationProject/ValidateStrykerResults.cs
+++ b/integrationtest/ValidationProject/ValidateStrykerResults.cs
@@ -122,7 +122,7 @@ public void NetCoreWithTwoTestProjects()
var report = JsonConvert.DeserializeObject(strykerRunOutput);
CheckReportMutants(report, total: 114, ignored: 27, survived: 8, killed: 8, timeout: 2, nocoverage: 67);
- CheckReportTestCounts(report, total: 30);
+ CheckReportTestCounts(report, total: 35);
}
[Fact]
@@ -141,7 +141,7 @@ public void SolutionRun()
var report = JsonConvert.DeserializeObject(strykerRunOutput);
CheckReportMutants(report, total: 129, ignored: 59, survived: 5, killed: 10, timeout: 2, nocoverage: 45);
- CheckReportTestCounts(report, total: 30);
+ CheckReportTestCounts(report, total: 35);
}
private void CheckMutationKindsValidity(JsonReport report)
From 5ed4a7f01000de9078a32b7c9a76fd0c088d0787 Mon Sep 17 00:00:00 2001
From: Dmitrij <3024338+iamdmitrij@users.noreply.github.com>
Date: Wed, 22 May 2024 10:17:06 +0300
Subject: [PATCH 11/14] Update ValidateStrykerResults.cs
---
integrationtest/ValidationProject/ValidateStrykerResults.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/integrationtest/ValidationProject/ValidateStrykerResults.cs b/integrationtest/ValidationProject/ValidateStrykerResults.cs
index f891dc020f..4ea4d038d5 100644
--- a/integrationtest/ValidationProject/ValidateStrykerResults.cs
+++ b/integrationtest/ValidationProject/ValidateStrykerResults.cs
@@ -121,7 +121,7 @@ public void NetCoreWithTwoTestProjects()
var report = JsonConvert.DeserializeObject(strykerRunOutput);
- CheckReportMutants(report, total: 114, ignored: 27, survived: 8, killed: 8, timeout: 2, nocoverage: 67);
+ CheckReportMutants(report, total: 129, ignored: 31, survived: 9, killed: 12, timeout: 2, nocoverage: 67);
CheckReportTestCounts(report, total: 35);
}
From 6d7678d1523e042d7a42b6f57931a1bbfa7e56e8 Mon Sep 17 00:00:00 2001
From: Dmitrij <3024338+iamdmitrij@users.noreply.github.com>
Date: Wed, 22 May 2024 10:57:05 +0300
Subject: [PATCH 12/14] Update
src/Stryker.Core/Stryker.Core/Mutators/StringMutator.cs
---
src/Stryker.Core/Stryker.Core/Mutators/StringMutator.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Stryker.Core/Stryker.Core/Mutators/StringMutator.cs b/src/Stryker.Core/Stryker.Core/Mutators/StringMutator.cs
index cf0dc94026..0043e42f73 100644
--- a/src/Stryker.Core/Stryker.Core/Mutators/StringMutator.cs
+++ b/src/Stryker.Core/Stryker.Core/Mutators/StringMutator.cs
@@ -33,7 +33,7 @@ public override IEnumerable ApplyMutations(LiteralExpressionSyntax nod
syntaxNode = SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression,
SyntaxFactory.Literal(replacementValue));
}
- else if(IsUtf8StringLiteral(node))
+ else if (IsUtf8StringLiteral(node))
{
currentValue = (string)node.Token.Value;
replacementValue = currentValue == "" ? "Stryker was here!" : "";
From d7d764bc6d827720710c3555bcf41bc5635bb520 Mon Sep 17 00:00:00 2001
From: Dmitrij <3024338+iamdmitrij@users.noreply.github.com>
Date: Tue, 11 Jun 2024 15:51:44 +0300
Subject: [PATCH 13/14] Update
src/Stryker.Core/Stryker.Core.UnitTest/Mutators/StringMutatorTests.cs
Co-authored-by: Richard Werkman
---
.../Stryker.Core.UnitTest/Mutators/StringMutatorTests.cs | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Mutators/StringMutatorTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Mutators/StringMutatorTests.cs
index 17262e8552..f90ab119bb 100644
--- a/src/Stryker.Core/Stryker.Core.UnitTest/Mutators/StringMutatorTests.cs
+++ b/src/Stryker.Core/Stryker.Core.UnitTest/Mutators/StringMutatorTests.cs
@@ -17,12 +17,8 @@ public void ShouldBeMutationLevelStandard()
}
[Theory]
- [InlineData("", """
- "Stryker was here!"u8
- """)]
- [InlineData("foo", """
- ""u8
- """)]
+ [InlineData(@"""""u8", @"""Stryker was here!""u8")]
+ [InlineData(@"""foo""u8", @"""""u8")]
public void ShouldMutateUtf8StringLiteral(string original, string expected)
{
var syntaxTree = CSharpSyntaxTree.ParseText($"""var test = "{original}"u8;""");
From a9fe1a7ac9d0b56d410bd649604e86930a63e832 Mon Sep 17 00:00:00 2001
From: Dmitrij <3024338+iamdmitrij@users.noreply.github.com>
Date: Tue, 11 Jun 2024 15:51:52 +0300
Subject: [PATCH 14/14] Update
src/Stryker.Core/Stryker.Core.UnitTest/Mutators/StringMutatorTests.cs
Co-authored-by: Richard Werkman
---
.../Stryker.Core.UnitTest/Mutators/StringMutatorTests.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Mutators/StringMutatorTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Mutators/StringMutatorTests.cs
index f90ab119bb..77b400095c 100644
--- a/src/Stryker.Core/Stryker.Core.UnitTest/Mutators/StringMutatorTests.cs
+++ b/src/Stryker.Core/Stryker.Core.UnitTest/Mutators/StringMutatorTests.cs
@@ -21,7 +21,7 @@ public void ShouldBeMutationLevelStandard()
[InlineData(@"""foo""u8", @"""""u8")]
public void ShouldMutateUtf8StringLiteral(string original, string expected)
{
- var syntaxTree = CSharpSyntaxTree.ParseText($"""var test = "{original}"u8;""");
+ var syntaxTree = CSharpSyntaxTree.ParseText($"var test = {original};");
var literalExpression = syntaxTree.GetRoot().DescendantNodes().OfType().First();
var mutator = new StringMutator();