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 @@ -165,6 +165,68 @@ public void TestMethod()
165165 await this . VerifyCSharpFixAsync ( testCode , fixedTestCode ) . ConfigureAwait ( false ) ;
166166 }
167167
168+ /// <summary>
169+ /// Repro test for https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/1878.
170+ /// </summary>
171+ /// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
172+ [ Fact ]
173+ public async Task ReproFor1878Async ( )
174+ {
175+ var testCode = @"namespace Stylecop_rc1_bug_repro
176+ {
177+ using System;
178+
179+ internal class Program
180+ {
181+ [Foo, Bar]
182+ private static void Main(string[] args)
183+ {
184+ }
185+ }
186+
187+ internal class FooAttribute : Attribute
188+ {
189+ }
190+
191+ internal class BarAttribute : Attribute
192+ {
193+ }
194+ }
195+ " ;
196+
197+ var fixedTestCode = @"namespace Stylecop_rc1_bug_repro
198+ {
199+ using System;
200+
201+ internal class Program
202+ {
203+ [Foo]
204+ [Bar]
205+ private static void Main(string[] args)
206+ {
207+ }
208+ }
209+
210+ internal class FooAttribute : Attribute
211+ {
212+ }
213+
214+ internal class BarAttribute : Attribute
215+ {
216+ }
217+ }
218+ " ;
219+
220+ DiagnosticResult [ ] expected =
221+ {
222+ this . CSharpDiagnostic ( ) . WithLocation ( 7 , 15 )
223+ } ;
224+
225+ await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
226+ await this . VerifyCSharpDiagnosticAsync ( fixedTestCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
227+ await this . VerifyCSharpFixAsync ( testCode , fixedTestCode ) . ConfigureAwait ( false ) ;
228+ }
229+
168230 /// <inheritdoc/>
169231 protected override CodeFixProvider GetCSharpCodeFixProvider ( )
170232 {
You can’t perform that action at this time.
0 commit comments