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 @@ -57,6 +57,34 @@ class Foo
5757 await this . VerifyCSharpFixAsync ( testCode , fixedCode ) . ConfigureAwait ( false ) ;
5858 }
5959
60+ [ Fact ]
61+ public async Task TestInvalidDeclarationWithTrailingTriviaAsync ( )
62+ {
63+ const string testCode = @"
64+ class Foo
65+ {
66+ public const int a = 1, // foo
67+ b = 2,
68+ c = 3, // bar
69+ d = 4,
70+ e = 5; /* spam */
71+ }" ;
72+ const string fixedCode = @"
73+ class Foo
74+ {
75+ public const int a = 1; // foo
76+ public const int b = 2;
77+ public const int c = 3; // bar
78+ public const int d = 4;
79+ public const int e = 5; /* spam */
80+ }" ;
81+
82+ DiagnosticResult expected = this . CSharpDiagnostic ( ) . WithLocation ( 4 , 5 ) ;
83+ await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
84+ await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
85+ await this . VerifyCSharpFixAsync ( testCode , fixedCode ) . ConfigureAwait ( false ) ;
86+ }
87+
6088 [ Fact ]
6189 public async Task TestInvalidFieldDeclarationWithAttributesAsync ( )
6290 {
You can’t perform that action at this time.
0 commit comments