Skip to content

Commit a314164

Browse files
committed
Update SA1114 for static anonymous functions
1 parent 20f9d77 commit a314164

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp9/ReadabilityRules/SA1114CSharp9UnitTests.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,34 @@
33

44
namespace StyleCop.Analyzers.Test.CSharp9.ReadabilityRules
55
{
6+
using System.Threading;
7+
using System.Threading.Tasks;
8+
using Microsoft.CodeAnalysis.Testing;
69
using StyleCop.Analyzers.Test.CSharp8.ReadabilityRules;
10+
using Xunit;
11+
using static StyleCop.Analyzers.Test.Verifiers.StyleCopDiagnosticVerifier<StyleCop.Analyzers.ReadabilityRules.SA1114ParameterListMustFollowDeclaration>;
712

813
public partial class SA1114CSharp9UnitTests : SA1114CSharp8UnitTests
914
{
15+
[Fact]
16+
[WorkItem(3973, "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3973")]
17+
public async Task TestStaticAnonymousFunctionParameterListAfterBlankLineAsync()
18+
{
19+
var testCode = @"using System;
20+
21+
public class TestClass
22+
{
23+
public void TestMethod()
24+
{
25+
Action<int> action = static (
26+
27+
{|#0:int value|}) => value++;
28+
}
29+
}
30+
";
31+
32+
var expected = Diagnostic().WithLocation(0);
33+
await VerifyCSharpDiagnosticAsync(testCode, expected, CancellationToken.None).ConfigureAwait(false);
34+
}
1035
}
1136
}

0 commit comments

Comments
 (0)