Skip to content

Commit d7510ca

Browse files
Update tests to allow .NET 10.0 (#7439)
* Update tests to allow .NET 10.0 * Add a way to handle preview for LangVersion * Update ProjectLangVersion.cs * Add the .NET 10.0-windows target * Turn the dictionary to <int, string> * Turn the dictionary into just a constant. * Better name for the constant and pin it to 13 * Tweaks --------- Co-authored-by: Brandon Ording <[email protected]>
1 parent 1c332e4 commit d7510ca

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

tests/IntegrityTests/ProjectFrameworks.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public void TargetFrameworkElementShouldAgreeWithFrameworkCount()
3636
});
3737
}
3838

39-
public static readonly string[] sdkProjectAllowedTfmList = ["net9.0", "net9.0-windows", "net8.0", "net8.0-windows", "net48", "netstandard2.0"];
39+
public static readonly string[] sdkProjectAllowedTfmList = ["net10.0", "net10.0-windows", "net9.0", "net9.0-windows", "net8.0", "net8.0-windows", "net48", "netstandard2.0"];
4040
static readonly string[] nonSdkProjectAllowedFrameworkList = ["v4.8"];
4141

4242
[Test]

tests/IntegrityTests/ProjectLangVersion.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ public void SamplesShouldUseCorrectLangVersion()
8383

8484
solutionLangVersion ??= fallbackLangVersion;
8585

86-
var solutionLangVersionString = solutionLangVersion.Value.ToString("N1");
86+
var solutionLangVersionString = solutionLangVersion > latestReleasedLangVersion ? "preview" : solutionLangVersion.Value.ToString("N1");
87+
8788
bool valid = true;
8889

8990
foreach (var projectFile in projectFiles)
@@ -162,6 +163,11 @@ public void ShouldHaveLangVersionMappingForEachAllowedTargetFramework()
162163
{ "net8.0-windows", 12 },
163164
{ "net9.0", 13 },
164165
{ "net9.0-windows", 13 },
166+
{ "net10.0", 14 },
167+
{ "net10.0-windows", 14 }
165168
};
169+
170+
// This needs to be kept up to date with the latest released version of C#
171+
private const int latestReleasedLangVersion = 13;
166172
}
167173
}

0 commit comments

Comments
 (0)