File tree Expand file tree Collapse file tree
StyleCop.Analyzers/StyleCop.Analyzers.Test/ReadabilityRules Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -386,6 +386,37 @@ public void TestMethod2()
386386 await this . VerifyCSharpFixAsync ( testCode , fixedCode ) . ConfigureAwait ( false ) ;
387387 }
388388
389+ /// <summary>
390+ /// Verifies that the code fix will not remove relevant trivia.
391+ /// </summary>
392+ /// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
393+ [ Fact ]
394+ public async Task VerifyCodeFixWillNotRemoveTriviaAsync ( )
395+ {
396+ var testCode = @"
397+ class TestClass
398+ {
399+ public void TestMethod()
400+ {
401+ /* do nothing */ ;
402+ }
403+ }" ;
404+ var fixedCode = @"
405+ class TestClass
406+ {
407+ public void TestMethod()
408+ {
409+ /* do nothing */
410+ }
411+ }" ;
412+
413+ var expected = this . CSharpDiagnostic ( ) . WithLocation ( 6 , 26 ) ;
414+
415+ await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
416+ await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
417+ await this . VerifyCSharpFixAsync ( testCode , fixedCode ) . ConfigureAwait ( false ) ;
418+ }
419+
389420 /// <inheritdoc/>
390421 protected override IEnumerable < DiagnosticAnalyzer > GetCSharpDiagnosticAnalyzers ( )
391422 {
You can’t perform that action at this time.
0 commit comments