Skip to content

Commit 4588377

Browse files
committed
Added multi-line comment XML documentation test for SA1004
1 parent 7d97301 commit 4588377

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

StyleCop.Analyzers/StyleCop.Analyzers.Test/SpacingRules/SA1004UnitTests.cs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,53 @@ private void Method3()
166166
await this.VerifyCSharpDiagnosticAsync(testCode, EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
167167
}
168168

169+
/// <summary>
170+
/// Verifies that a multi-line documentation comment without leading spaces is handled correctly.
171+
/// </summary>
172+
/// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
173+
[Fact]
174+
public async Task TestMultilineDocumentationCommentWithoutLeadingSpacesAsync()
175+
{
176+
string testCode = @"
177+
public class TypeName
178+
{
179+
/**
180+
*<summary>
181+
*The summary text.
182+
*</summary>
183+
*/
184+
private void Method1()
185+
{
186+
}
187+
}
188+
";
189+
190+
string fixedCode = @"
191+
public class TypeName
192+
{
193+
/**
194+
* <summary>
195+
* The summary text.
196+
* </summary>
197+
*/
198+
private void Method1()
199+
{
200+
}
201+
}
202+
";
203+
204+
DiagnosticResult[] expected =
205+
{
206+
this.CSharpDiagnostic().WithLocation(5, 7),
207+
this.CSharpDiagnostic().WithLocation(6, 7),
208+
this.CSharpDiagnostic().WithLocation(7, 7)
209+
};
210+
211+
await this.VerifyCSharpDiagnosticAsync(testCode, expected, CancellationToken.None).ConfigureAwait(false);
212+
await this.VerifyCSharpDiagnosticAsync(fixedCode, EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
213+
await this.VerifyCSharpFixAsync(testCode, fixedCode).ConfigureAwait(false);
214+
}
215+
169216
/// <inheritdoc/>
170217
protected override IEnumerable<DiagnosticAnalyzer> GetCSharpDiagnosticAnalyzers()
171218
{

0 commit comments

Comments
 (0)