diff --git a/src/Workspaces/CSharpTest/Formatting/FormattingTriviaTests.cs b/src/Workspaces/CSharpTest/Formatting/FormattingTriviaTests.cs index 6ffd7576860628b1bd9a123ef7359321f47df46d..a62c881dee0e15cf8938e10f506fc7dd4d8f2dfb 100644 --- a/src/Workspaces/CSharpTest/Formatting/FormattingTriviaTests.cs +++ b/src/Workspaces/CSharpTest/Formatting/FormattingTriviaTests.cs @@ -11,6 +11,34 @@ namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Formatting { public class FormattingEngineTriviaTests : CSharpFormattingTestBase { + [Fact, Trait(Traits.Feature, Traits.Features.Formatting)] + [WorkItem(31130, "https://github.com/dotnet/roslyn/issues/31130")] + public async Task PreprocessorNullable() + { + var content = @" + #nullable +class C +{ + #nullable enable + void Method() + { + #nullable disable + } +}"; + + var expected = @" +#nullable +class C +{ +#nullable enable + void Method() + { +#nullable disable + } +}"; + await AssertFormatAsync(expected, content); + } + [Fact, Trait(Traits.Feature, Traits.Features.Formatting)] public async Task PreprocessorInEmptyFile() {