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