Skip to content

Commit a846e62

Browse files
committed
Update compilation context tests to expect correct language version
1 parent 9433083 commit a846e62

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPreserveCompilationContext.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ public void It_publishes_the_project_with_a_refs_folder_and_correct_deps_file(st
7070
testAsset.Restore(Log, "TestApp");
7171

7272
var appProjectDirectory = Path.Combine(testAsset.TestRoot, "TestApp");
73+
74+
var getValuesCommand = new GetValuesCommand(Log, appProjectDirectory, testProject.TargetFrameworks, "LangVersion");
75+
getValuesCommand.Execute().Should().Pass();
76+
77+
var langVersion = getValuesCommand.GetValues().FirstOrDefault() ?? string.Empty;
78+
7379
var publishCommand = new PublishCommand(Log, appProjectDirectory);
7480

7581
publishCommand
@@ -114,7 +120,7 @@ public void It_publishes_the_project_with_a_refs_folder_and_correct_deps_file(st
114120
}
115121

116122
dependencyContext.CompilationOptions.Defines.Should().BeEquivalentTo(expectedDefines);
117-
dependencyContext.CompilationOptions.LanguageVersion.Should().BeOneOf("", "preview");
123+
dependencyContext.CompilationOptions.LanguageVersion.Should().Be(langVersion);
118124
dependencyContext.CompilationOptions.Platform.Should().Be("x86");
119125
dependencyContext.CompilationOptions.Optimize.Should().Be(false);
120126
dependencyContext.CompilationOptions.KeyFile.Should().Be("");

0 commit comments

Comments
 (0)