11// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
22// Licensed under the MIT License. See LICENSE in the project root for license information.
33
4- #nullable disable
5-
64namespace StyleCop . Analyzers . Test . CSharp9 . SpacingRules
75{
6+ using System . Threading ;
87 using System . Threading . Tasks ;
98 using Microsoft . CodeAnalysis . Testing ;
109 using StyleCop . Analyzers . Test . CSharp8 . SpacingRules ;
@@ -16,6 +15,33 @@ namespace StyleCop.Analyzers.Test.CSharp9.SpacingRules
1615
1716 public partial class SA1000CSharp9UnitTests : SA1000CSharp8UnitTests
1817 {
18+ [ Fact ]
19+ [ WorkItem ( 3970 , "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3970" ) ]
20+ public async Task TestFunctionPointerKeywordSpacingAsync ( )
21+ {
22+ var testCode = @"public class TestClass
23+ {
24+ private unsafe {|#0:delegate|} *<int, void> pointer1;
25+ private unsafe delegate* {|#1:unmanaged|} [Cdecl]<int, void> pointer2;
26+ }
27+ " ;
28+
29+ var fixedCode = @"public class TestClass
30+ {
31+ private unsafe delegate*<int, void> pointer1;
32+ private unsafe delegate* unmanaged[Cdecl]<int, void> pointer2;
33+ }
34+ " ;
35+
36+ var expected = new [ ]
37+ {
38+ Diagnostic ( ) . WithArguments ( "delegate" , " not" ) . WithLocation ( 0 ) ,
39+ Diagnostic ( ) . WithArguments ( "unmanaged" , " not" ) . WithLocation ( 1 ) ,
40+ } ;
41+
42+ await VerifyCSharpFixAsync ( testCode , expected , fixedCode , CancellationToken . None ) . ConfigureAwait ( false ) ;
43+ }
44+
1945 [ Fact ]
2046 public async Task TestTargetTypedNewAsync ( )
2147 {
0 commit comments