Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix an off by one in our test code #569

Merged
merged 2 commits into from
Mar 27, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void Foo()
await this.VerifyCSharpFixAsync(test, fixedTest, cancellationToken: CancellationToken.None);

test = string.Format(testFormat, this.Sign + " 3");
DiagnosticResult expected = this.CSharpDiagnostic().WithArguments(" not", "followed").WithLocation(8, 17);
DiagnosticResult expected = this.CSharpDiagnostic().WithArguments(" not", "followed").WithLocation(8, 1);

await this.VerifyCSharpDiagnosticAsync(test, expected, CancellationToken.None);
await this.VerifyCSharpFixAsync(test, fixedTest, cancellationToken: CancellationToken.None);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ join @a in b on x.A equals a.B

await this.TestKeywordStatement(statementWithSpace, EmptyDiagnosticResults, statementWithSpace);

DiagnosticResult expected = this.CSharpDiagnostic().WithArguments("join", string.Empty, "followed").WithLocation(8, 16);
DiagnosticResult expected = this.CSharpDiagnostic().WithArguments("join", string.Empty, "followed").WithLocation(8, 1);

await this.TestKeywordStatement(statementWithoutSpace, expected, statementWithSpace);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ private static void VerifyDiagnosticLocation(DiagnosticAnalyzer analyzer, Diagno

var actualLinePosition = actualSpan.StartLinePosition;

// Only check line position if there is an actual line in the real diagnostic
if (actualLinePosition.Line > 0)
// Only check line position if it matters
if (expected.Line > 0)
{
if (actualLinePosition.Line + 1 != expected.Line)
{
Expand All @@ -206,8 +206,8 @@ private static void VerifyDiagnosticLocation(DiagnosticAnalyzer analyzer, Diagno
}
}

// Only check column position if there is an actual column position in the real diagnostic
if (actualLinePosition.Character > 0)
// Only check column position if it matters
if (expected.Column > 0)
{
if (actualLinePosition.Character + 1 != expected.Column)
{
Expand Down