Skip to content

Commit

Permalink
Add back a proper integration test for DotNetAnalyzers#255 and DotNet…
Browse files Browse the repository at this point in the history
  • Loading branch information
sharwell committed Jun 15, 2017
1 parent a77cb7e commit b8d237b
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,25 @@ public async Task TestLambdaExpressionWithNoSpaceAfterClosingParenthesisAsync()
await this.TestWhitespaceInStatementOrDeclAsync(invalidStatement, validStatement, expected).ConfigureAwait(false);
}

/// <summary>
/// This is a regression test for DotNetAnalyzers/StyleCopAnalyzers#255 and
/// DotNetAnalyzers/StyleCopAnalyzers#256.
/// </summary>
/// <param name="operatorToken">The operator to test.</param>
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
[Theory]
[InlineData("+")]
[InlineData("-")]
public async Task TestNotReportedWhenFollowedByUnaryPlusOrMinusAsync(string operatorToken)
{
// This will be reported as SA1021 or SA1022
var ignoredStatement = $"var i = (int) {operatorToken}2;";
var correctStatement = $"var i = (int){operatorToken}2;";

await this.TestWhitespaceInStatementOrDeclAsync(ignoredStatement, string.Empty, EmptyDiagnosticResults).ConfigureAwait(false);
await this.TestWhitespaceInStatementOrDeclAsync(correctStatement, string.Empty, EmptyDiagnosticResults).ConfigureAwait(false);
}

[Fact]
public async Task TestSpaceBeforeParenthisInIncrementingForLoopAsync()
{
Expand Down

0 comments on commit b8d237b

Please sign in to comment.