|
3 | 3 |
|
4 | 4 | namespace StyleCop.Analyzers.Test.CSharp9.SpacingRules |
5 | 5 | { |
| 6 | + using System.Threading; |
| 7 | + using System.Threading.Tasks; |
6 | 8 | using StyleCop.Analyzers.Test.CSharp8.SpacingRules; |
| 9 | + using Xunit; |
| 10 | + |
| 11 | + using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier< |
| 12 | + StyleCop.Analyzers.SpacingRules.SA1001CommasMustBeSpacedCorrectly, |
| 13 | + StyleCop.Analyzers.SpacingRules.TokenSpacingCodeFixProvider>; |
7 | 14 |
|
8 | 15 | public partial class SA1001CSharp9UnitTests : SA1001CSharp8UnitTests |
9 | 16 | { |
| 17 | + [Fact] |
| 18 | + [WorkItem(3970, "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3970")] |
| 19 | + public async Task TestFunctionPointerParameterSpacingAsync() |
| 20 | + { |
| 21 | + var testCode = @"public class TestClass |
| 22 | +{ |
| 23 | + private unsafe delegate*<int{|#0:,|}int, void> field1; |
| 24 | + private unsafe delegate*<int {|#1:,|}int, void> field2; |
| 25 | +} |
| 26 | +"; |
| 27 | + |
| 28 | + var fixedCode = @"public class TestClass |
| 29 | +{ |
| 30 | + private unsafe delegate*<int, int, void> field1; |
| 31 | + private unsafe delegate*<int, int, void> field2; |
| 32 | +} |
| 33 | +"; |
| 34 | + |
| 35 | + var expected = new[] |
| 36 | + { |
| 37 | + Diagnostic().WithLocation(0).WithArguments(string.Empty, "followed"), |
| 38 | + Diagnostic().WithLocation(1).WithArguments(" not", "preceded"), |
| 39 | + Diagnostic().WithLocation(1).WithArguments(string.Empty, "followed"), |
| 40 | + }; |
| 41 | + |
| 42 | + await VerifyCSharpFixAsync(testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false); |
| 43 | + } |
10 | 44 | } |
11 | 45 | } |
0 commit comments