|
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 | + using static StyleCop.Analyzers.SpacingRules.SA1015ClosingGenericBracketsMustBeSpacedCorrectly; |
| 11 | + using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier< |
| 12 | + StyleCop.Analyzers.SpacingRules.SA1015ClosingGenericBracketsMustBeSpacedCorrectly, |
| 13 | + StyleCop.Analyzers.SpacingRules.TokenSpacingCodeFixProvider>; |
7 | 14 |
|
8 | 15 | public partial class SA1015CSharp9UnitTests : SA1015CSharp8UnitTests |
9 | 16 | { |
| 17 | + [Fact] |
| 18 | + [WorkItem(3970, "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3970")] |
| 19 | + public async Task TestFunctionPointerClosingBracketSpacingAsync() |
| 20 | + { |
| 21 | + var testCode = @"public class TestClass |
| 22 | +{ |
| 23 | + private unsafe delegate*<int, void {|#0:>|}field1; |
| 24 | + private unsafe delegate*<int, void {|#1:>|} field2; |
| 25 | +} |
| 26 | +"; |
| 27 | + |
| 28 | + var fixedCode = @"public class TestClass |
| 29 | +{ |
| 30 | + private unsafe delegate*<int, void> field1; |
| 31 | + private unsafe delegate*<int, void> field2; |
| 32 | +} |
| 33 | +"; |
| 34 | + |
| 35 | + var expected = new[] |
| 36 | + { |
| 37 | + Diagnostic(DescriptorNotPreceded).WithLocation(0), |
| 38 | + Diagnostic(DescriptorFollowed).WithLocation(0), |
| 39 | + Diagnostic(DescriptorNotPreceded).WithLocation(1), |
| 40 | + }; |
| 41 | + |
| 42 | + await VerifyCSharpFixAsync(testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false); |
| 43 | + } |
10 | 44 | } |
11 | 45 | } |
0 commit comments