Skip to content

Commit 12d4505

Browse files
committed
Update SA1110 for static anonymous functions
1 parent c421d6c commit 12d4505

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,41 @@ public async Task TestPrimaryConstructorBaseListWithoutParametersAsync(string ty
130130
await VerifyCSharpFixAsync(testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
131131
}
132132

133+
[Fact]
134+
[WorkItem(3973, "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3973")]
135+
public async Task TestStaticAnonymousMethodOpeningParenthesisOnNextLineAsync()
136+
{
137+
var testCode = @"using System;
138+
139+
public class TestClass
140+
{
141+
public void TestMethod()
142+
{
143+
Action<int> action = static delegate
144+
{|#0:(|}int value)
145+
{
146+
};
147+
}
148+
}
149+
";
150+
151+
var fixedCode = @"using System;
152+
153+
public class TestClass
154+
{
155+
public void TestMethod()
156+
{
157+
Action<int> action = static delegate(
158+
int value)
159+
{
160+
};
161+
}
162+
}
163+
";
164+
165+
await VerifyCSharpFixAsync(testCode, Diagnostic().WithLocation(0), fixedCode, CancellationToken.None).ConfigureAwait(false);
166+
}
167+
133168
protected virtual DiagnosticResult[] GetExpectedResultTestPrimaryConstructor()
134169
{
135170
return new[]

0 commit comments

Comments
 (0)