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 @@ -5,10 +5,8 @@ namespace StyleCop.Analyzers.Test.ReadabilityRules
55{
66 using System . Threading ;
77 using System . Threading . Tasks ;
8- using Microsoft . CodeAnalysis ;
98 using Microsoft . CodeAnalysis . Testing ;
109 using StyleCop . Analyzers . ReadabilityRules ;
11- using TestHelper ;
1210 using Xunit ;
1311 using static StyleCop . Analyzers . Test . Verifiers . StyleCopCodeFixVerifier <
1412 StyleCop . Analyzers . ReadabilityRules . SA1107CodeMustNotContainMultipleStatementsOnOneLine ,
@@ -142,5 +140,31 @@ int i
142140 DiagnosticResult expected = DiagnosticResult . CompilerError ( "CS1002" ) . WithLocation ( 7 , 14 ) . WithMessage ( "; expected" ) ;
143141 await VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
144142 }
143+
144+ [ Fact ]
145+ [ WorkItem ( 2862 , "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/2862" ) ]
146+ public async Task TestEmptyStatementAfterBlockAsync ( )
147+ {
148+ string testCode = @"
149+ class Program
150+ {
151+ static void Main(string[] args)
152+ {
153+ {
154+ }[|;|]
155+ }
156+ }
157+ " ;
158+
159+ await new CSharpTest
160+ {
161+ TestCode = testCode ,
162+ FixedCode = testCode ,
163+
164+ // A code fix is offered even though no changes are applied by it
165+ NumberOfIncrementalIterations = 1 ,
166+ NumberOfFixAllIterations = 1 ,
167+ } . RunAsync ( CancellationToken . None ) . ConfigureAwait ( false ) ;
168+ }
145169 }
146170}
You can’t perform that action at this time.
0 commit comments