Skip to content

Commit

Permalink
Add regression test for DotNetAnalyzers#1313
Browse files Browse the repository at this point in the history
  • Loading branch information
pdelvo committed Aug 29, 2015
1 parent e97bc5e commit 8c6f3ea
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,31 @@ public async Task NoTrailingWhitespaceAfterBlockCommentAsync()
await this.VerifyCSharpDiagnosticAsync(testCode, EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}

[Fact]
public async Task TrailingWhitespaceAfterTextTokenAsync()
{
string testCode = new StringBuilder()
.AppendLine("/// <summary>")
.AppendLine("/// &amp; ")
.AppendLine("/// </summary>")
.ToString();

string fixedCode = new StringBuilder()
.AppendLine("/// <summary>")
.AppendLine("/// &amp;")
.AppendLine("/// </summary>")
.ToString();

DiagnosticResult[] expected =
{
this.CSharpDiagnostic().WithLocation(2, 10),
};

await this.VerifyCSharpDiagnosticAsync(testCode, expected, CancellationToken.None).ConfigureAwait(false);
await this.VerifyCSharpDiagnosticAsync(fixedCode, EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
await this.VerifyCSharpFixAsync(testCode, fixedCode, cancellationToken: CancellationToken.None).ConfigureAwait(false);
}

protected override IEnumerable<DiagnosticAnalyzer> GetCSharpDiagnosticAnalyzers()
{
yield return new SA1028CodeMustNotContainTrailingWhitespace();
Expand Down

0 comments on commit 8c6f3ea

Please sign in to comment.