@@ -223,6 +223,80 @@ public async Task TestTypeDeclarationConstraintClausesAsync(string typeKind)
223223 await this . VerifyCSharpFixAsync ( testCode , fixedCode , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
224224 }
225225
226+ [ Fact ]
227+ public async Task TestEnumDeclarationAsync ( )
228+ {
229+ string testCode = @"
230+ using System;
231+ enum Enum1
232+ {
233+ [My]
234+ Element1,
235+
236+ Element2,
237+ }
238+
239+ enum Enum2
240+ {
241+ [My]
242+ Element1,
243+
244+ Element2,
245+ }
246+
247+ enum Enum3
248+ {
249+ [My] Element1,
250+
251+ Element2,
252+ }
253+
254+ [AttributeUsage(AttributeTargets.All, AllowMultiple = true)]
255+ class MyAttribute : Attribute { }
256+ " ;
257+ string fixedCode = @"
258+ using System;
259+ enum Enum1
260+ {
261+ [My]
262+ Element1,
263+
264+ Element2,
265+ }
266+
267+ enum Enum2
268+ {
269+ [My]
270+ Element1,
271+
272+ Element2,
273+ }
274+
275+ enum Enum3
276+ {
277+ [My] Element1,
278+
279+ Element2,
280+ }
281+
282+ [AttributeUsage(AttributeTargets.All, AllowMultiple = true)]
283+ class MyAttribute : Attribute { }
284+ " ;
285+
286+ DiagnosticResult [ ] expected =
287+ {
288+ this . CSharpDiagnostic ( ) . WithLocation ( 5 , 1 ) ,
289+ this . CSharpDiagnostic ( ) . WithLocation ( 8 , 1 ) ,
290+ this . CSharpDiagnostic ( ) . WithLocation ( 13 , 1 ) ,
291+ this . CSharpDiagnostic ( ) . WithLocation ( 16 , 1 ) ,
292+ this . CSharpDiagnostic ( ) . WithLocation ( 21 , 1 ) ,
293+ } ;
294+
295+ await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
296+ await this . VerifyCSharpDiagnosticAsync ( fixedCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
297+ await this . VerifyCSharpFixAsync ( testCode , fixedCode , cancellationToken : CancellationToken . None ) . ConfigureAwait ( false ) ;
298+ }
299+
226300 [ Theory ]
227301 [ InlineData ( "class" , " { }" ) ]
228302 [ InlineData ( "void" , "() { }" ) ]
0 commit comments