Skip to content

Commit 9b237ac

Browse files
committed
Update SA1112 for static anonymous functions
1 parent 925683d commit 9b237ac

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,36 @@
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.StyleCopCodeFixVerifier<
12+
StyleCop.Analyzers.ReadabilityRules.SA1112ClosingParenthesisMustBeOnLineOfOpeningParenthesis,
13+
StyleCop.Analyzers.SpacingRules.TokenSpacingCodeFixProvider>;
714

815
public partial class SA1112CSharp9UnitTests : SA1112CSharp8UnitTests
916
{
17+
[Fact]
18+
[WorkItem(3973, "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3973")]
19+
public async Task TestStaticAnonymousMethodClosingParenthesisOnNextLineAsync()
20+
{
21+
var testCode = @"using System;
22+
23+
public class TestClass
24+
{
25+
public void TestMethod()
26+
{
27+
Action action = static delegate(
28+
{|#0:)|}
29+
{
30+
};
31+
}
32+
}
33+
";
34+
35+
await VerifyCSharpDiagnosticAsync(testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
36+
}
1037
}
1138
}

0 commit comments

Comments
 (0)