|
3 | 3 |
|
4 | 4 | namespace StyleCop.Analyzers.Test.CSharp9.ReadabilityRules |
5 | 5 | { |
| 6 | + using System.Threading; |
| 7 | + using System.Threading.Tasks; |
| 8 | + using Microsoft.CodeAnalysis.Testing; |
6 | 9 | using StyleCop.Analyzers.Test.CSharp8.ReadabilityRules; |
| 10 | + using Xunit; |
| 11 | + using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier< |
| 12 | + StyleCop.Analyzers.ReadabilityRules.SA1113CommaMustBeOnSameLineAsPreviousParameter, |
| 13 | + StyleCop.Analyzers.SpacingRules.TokenSpacingCodeFixProvider>; |
7 | 14 |
|
8 | 15 | public partial class SA1113CSharp9UnitTests : SA1113CSharp8UnitTests |
9 | 16 | { |
| 17 | + [Fact] |
| 18 | + [WorkItem(3973, "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3973")] |
| 19 | + public async Task TestStaticAnonymousFunctionCommaOnNextLineAsync() |
| 20 | + { |
| 21 | + var testCode = @"using System; |
| 22 | +
|
| 23 | +public class TestClass |
| 24 | +{ |
| 25 | + public void TestMethod() |
| 26 | + { |
| 27 | + Func<int, int, int> func = static (int first |
| 28 | + {|#0:,|} int second) => first + second; |
| 29 | + } |
| 30 | +} |
| 31 | +"; |
| 32 | + |
| 33 | + var fixedCode = @"using System; |
| 34 | +
|
| 35 | +public class TestClass |
| 36 | +{ |
| 37 | + public void TestMethod() |
| 38 | + { |
| 39 | + Func<int, int, int> func = static (int first, |
| 40 | + int second) => first + second; |
| 41 | + } |
| 42 | +} |
| 43 | +"; |
| 44 | + |
| 45 | + DiagnosticResult expected = Diagnostic().WithLocation(0); |
| 46 | + await VerifyCSharpFixAsync(testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false); |
| 47 | + } |
10 | 48 | } |
11 | 49 | } |
0 commit comments