Skip to content

Commit 925683d

Browse files
committed
Update SA1111 for static anonymous functions
1 parent 12d4505 commit 925683d

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,40 @@ public async Task TestPrimaryConstructorBaseListWithoutArgumentsAsync(string typ
9595
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
9696
}
9797

98+
[Fact]
99+
[WorkItem(3973, "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3973")]
100+
public async Task TestStaticAnonymousMethodClosingParenthesisOnOwnLineAsync()
101+
{
102+
var testCode = @"using System;
103+
104+
public class TestClass
105+
{
106+
public void TestMethod()
107+
{
108+
Action<int> action = static delegate(int value
109+
{|#0:)|}
110+
{
111+
};
112+
}
113+
}
114+
";
115+
116+
var fixedCode = @"using System;
117+
118+
public class TestClass
119+
{
120+
public void TestMethod()
121+
{
122+
Action<int> action = static delegate(int value)
123+
{
124+
};
125+
}
126+
}
127+
";
128+
129+
await VerifyCSharpFixAsync(testCode, Diagnostic().WithLocation(0), fixedCode, CancellationToken.None).ConfigureAwait(false);
130+
}
131+
98132
protected virtual DiagnosticResult[] GetExpectedResultTestPrimaryConstructorWithParameter()
99133
{
100134
return new[]

0 commit comments

Comments
 (0)