Skip to content

Commit 2617b8e

Browse files
committed
.
1 parent 10d4b3e commit 2617b8e

File tree

5 files changed

+4
-61
lines changed

5 files changed

+4
-61
lines changed

src/ApiBuilderTests/AssemblySizeTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ static List<SizeResult> ConvertToSizeResults(Dictionary<string, Dictionary<strin
243243

244244
foreach (var framework in TargetFrameworks)
245245
{
246-
results.Add(new SizeResult
246+
results.Add(new()
247247
{
248248
TargetFramework = framework,
249249
SizeWithoutPolyfill = allSizes["without"].GetValueOrDefault(framework, -1),
@@ -264,7 +264,7 @@ static List<SizeResult> ConvertToSizeResultsWithEmbed(Dictionary<string, Diction
264264

265265
foreach (var framework in TargetFrameworks)
266266
{
267-
results.Add(new SizeResult
267+
results.Add(new()
268268
{
269269
TargetFramework = framework,
270270
SizeWithoutPolyfill = allSizes["without"].GetValueOrDefault(framework, -1) + sourceSizes["without"].GetValueOrDefault(framework, 0),

src/ApiBuilderTests/SplitterTests.cs

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -969,57 +969,4 @@ public async Task WindowsUwp()
969969
await Assert.That(resultUwp).Contains("netstandard_code");
970970
await Assert.That(resultUwp).DoesNotContain("#if");
971971
}
972-
973-
static void AssertNoFrameworkMonikers(string content, string filePath, string targetFramework)
974-
{
975-
// Check for specific framework version symbols
976-
var monikerPatterns = new[]
977-
{
978-
@"\bNET\d+_\d+\b",
979-
@"\bNET\d+_\d+_OR_GREATER\b",
980-
@"\bNETCOREAPP\d+_\d+\b",
981-
@"\bNETCOREAPP\d+_\d+_OR_GREATER\b",
982-
@"\bNETSTANDARD\d+_\d+\b",
983-
@"\bNETSTANDARD\d+_\d+_OR_GREATER\b",
984-
@"\bNETCOREAPP\d+X\b",
985-
@"\bNET\d+X\b",
986-
@"\bNETCOREAPPX\b",
987-
@"\bNETFRAMEWORK\b",
988-
@"\bNETSTANDARD\b(?!_)",
989-
@"\bNETCOREAPP\b(?!_)",
990-
@"\bWINDOWS_UWP\b"
991-
};
992-
993-
foreach (var pattern in monikerPatterns)
994-
{
995-
var matches = Regex.Matches(content, pattern);
996-
foreach (Match match in matches)
997-
{
998-
// Check if it's inside a string literal or comment (which is OK)
999-
var lineStart = content.LastIndexOf('\n', match.Index) + 1;
1000-
var lineEnd = content.IndexOf('\n', match.Index);
1001-
if (lineEnd == -1) lineEnd = content.Length;
1002-
var line = content.Substring(lineStart, lineEnd - lineStart);
1003-
1004-
// Skip if it's in a comment
1005-
if (line.TrimStart().StartsWith("//") || line.Contains("/*"))
1006-
{
1007-
continue;
1008-
}
1009-
1010-
// Skip if it's in a string literal (basic check)
1011-
var posInLine = match.Index - lineStart;
1012-
var quotesBeforeMatch = line.Substring(0, posInLine).Count(c => c == '"');
1013-
if (quotesBeforeMatch % 2 == 1)
1014-
{
1015-
continue;
1016-
}
1017-
1018-
// This is a framework moniker in a preprocessor directive - fail
1019-
throw new(
1020-
$"Framework moniker '{match.Value}' found in {filePath} for target framework {targetFramework}:\n" +
1021-
$"Line: {line.Trim()}");
1022-
}
1023-
}
1024-
}
1025972
}

src/Tests/EnsureTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class EnsureTests
2626
static string[] emptyArray = [];
2727
static string[] nonEmptyArray = ["value"];
2828
static List<string> nonEmptyList = ["value"];
29-
static IEnumerable<string> nonEmptyEnumerable = nonEmptyList.Select(x => x);
29+
static IEnumerable<string> nonEmptyEnumerable = nonEmptyList.Select(_ => _);
3030

3131
[Test]
3232
public async Task NotNull()

src/Tests/FilePolyfillTests.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using System.Runtime.InteropServices;
2-
using System.Runtime.Versioning;
3-
using static TUnit.Core.HookType;
1+
using System.Runtime.Versioning;
42
// ReSharper disable MethodHasAsyncOverload
53

64
[NotInParallel]

src/Tests/SanityChecks.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using ProjectFilesGenerator;
2-
31
#pragma warning disable IL2026
42

53
public class SanityChecks

0 commit comments

Comments
 (0)