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

Conversation

pdelvo
Copy link
Member

@pdelvo pdelvo commented Mar 27, 2015

Fixes #567.

@@ -196,7 +196,7 @@ 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)
if (actualLinePosition.Line >= 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❗ The bug is actually that actualLinePosition is used here. The original intent was for the user to be able to specify in the expected results that the line doesn't matter. The condition should be this:

if (expected.Line > 0)

💡 The documentation for DiagnosticResultLocation could be improved to more clearly state that the line and column numbers are 1-based, along with clarifying the meaning of 0.

@pdelvo
Copy link
Member Author

pdelvo commented Mar 27, 2015

I implemented the CR feedback and im creating a roslyn issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tests dont verify location if the actual location is at line start
2 participants