Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class BenchmarkClass
await Task.Delay(100);
}
}
""";
""".ReplaceLineEndings();

var fixedCode = /* lang=c#-test */ """
using BenchmarkDotNet.Attributes;
Expand All @@ -42,7 +42,7 @@ public async Task AsyncBenchmark()
await Task.Delay(100);
}
}
""";
""".ReplaceLineEndings();

TestCode = testCode;
FixedCode = fixedCode;
Expand All @@ -67,7 +67,7 @@ public class BenchmarkClass
await Task.Delay(100);
}
}
""";
""".ReplaceLineEndings();

var fixedCode = /* lang=c#-test */ """
using BenchmarkDotNet.Attributes;
Expand All @@ -85,7 +85,7 @@ public async Task AsyncBenchmark()
await Task.Delay(100);
}
}
""";
""".ReplaceLineEndings();

TestCode = testCode;
FixedCode = fixedCode;
Expand Down Expand Up @@ -113,7 +113,7 @@ public class BenchmarkClass
await Task.Delay(Size);
}
}
""";
""".ReplaceLineEndings();

var fixedCode = /* lang=c#-test */ """
using BenchmarkDotNet.Attributes;
Expand All @@ -134,7 +134,7 @@ public async Task AsyncBenchmark()
await Task.Delay(Size);
}
}
""";
""".ReplaceLineEndings();

TestCode = testCode;
FixedCode = fixedCode;
Expand Down Expand Up @@ -165,7 +165,7 @@ public async Task AsyncBenchmark2()
await Task.Delay(200);
}
}
""";
""".ReplaceLineEndings();

var fixedCode = /* lang=c#-test */ """
using BenchmarkDotNet.Attributes;
Expand All @@ -189,7 +189,7 @@ public async Task AsyncBenchmark2()
await Task.Delay(200);
}
}
""";
""".ReplaceLineEndings();

TestCode = testCode;
FixedCode = fixedCode;
Expand Down
19 changes: 19 additions & 0 deletions tests/BenchmarkDotNet.Analyzers.Tests/StringExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#if NETFRAMEWORK
namespace BenchmarkDotNet.Analyzers.Tests;

internal static class StringExtensions
{
public static string ReplaceLineEndings(this string input)
=> ReplaceLineEndings(input, Environment.NewLine);

private static string ReplaceLineEndings(this string text, string replacementText)
{
text = text.Replace("\r\n", "\n");

if (replacementText != "\n")
text = text.Replace("\n", replacementText);

return text;
}
}
#endif