@@ -112,32 +112,24 @@ class Foo
112112 await this . VerifyCSharpFixAsync ( testCode , fixedCode ) . ConfigureAwait ( false ) ;
113113 }
114114
115- [ Fact ]
116- public async Task TestDeclarationWithMissingTokensAndNodesAsync ( )
115+ [ Theory ]
116+ [ InlineData ( "CS1001" , 19 , "Identifier expected" , "private int a,, b;" ) ]
117+ [ InlineData ( "CS1001" , 20 , "Identifier expected" , "private int e, = 3;" ) ]
118+ [ InlineData ( "CS1002" , 21 , "; expected" , "private int c, d" ) ]
119+ public async Task TestDeclarationWithMissingTokensAndNodesAsync ( string id , int column , string message , string declaration )
117120 {
118- const string testCode = @"
121+ string testCode = $ @ "
119122class Foo
120- {
121- private int a,, b;
122- private int c, d
123- }" ;
123+ {{
124+ { declaration }
125+ }}" ;
124126
125- DiagnosticResult [ ] expected =
127+ DiagnosticResult expected = new DiagnosticResult
126128 {
127- new DiagnosticResult
128- {
129- Id = "CS1001" ,
130- Severity = DiagnosticSeverity . Error ,
131- Locations = new [ ] { new DiagnosticResultLocation ( "Test0.cs" , 4 , 19 ) } ,
132- Message = "Identifier expected"
133- } ,
134- new DiagnosticResult
135- {
136- Id = "CS1002" ,
137- Severity = DiagnosticSeverity . Error ,
138- Locations = new [ ] { new DiagnosticResultLocation ( "Test0.cs" , 5 , 21 ) } ,
139- Message = "; expected"
140- }
129+ Id = id ,
130+ Severity = DiagnosticSeverity . Error ,
131+ Locations = new [ ] { new DiagnosticResultLocation ( "Test0.cs" , 4 , column ) } ,
132+ Message = message
141133 } ;
142134
143135 await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
0 commit comments