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

Add a test for keyword highlighting #18430

Merged
merged 7 commits into from
Apr 6, 2017

Conversation

rchande
Copy link
Contributor

@rchande rchande commented Apr 4, 2017

Tag @dotnet/roslyn-ide for review

@Pilchie Pilchie self-requested a review April 4, 2017 19:32
{
}

[Fact, Trait(Traits.Feature, Traits.Features.Classification)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Traits.Features.KeywordHighlighting?

}
}");

Verify("foreach", 3);
Copy link
Contributor

Choose a reason for hiding this comment

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

VerifyHighlightCount?

Copy link
Contributor

Choose a reason for hiding this comment

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

These tests are strange. I'd expect something with markup indicating which spans are highlighted and checking that.


Verify("To", 3);
VisualStudio.ExecuteCommand("Edit.NextHighlightedReference");
Assert.Equal(VisualStudio.Editor.GetCaretPosition(), 112);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use SetUpEditor and then get the position from the $$ in that markup? I really dislike these large numbers that represent positions in code.

Assert.Equal(VisualStudio.Editor.GetCaretPosition(), 112);
}

private void Verify(string marker, int expectedCount)
Copy link
Contributor

Choose a reason for hiding this comment

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

Duplicate code.

@@ -0,0 +1,254 @@
<?xml version="1.0" encoding="utf-8"?>
Copy link
Contributor

Choose a reason for hiding this comment

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

Uhh. This needs to be deleted.

@@ -147,6 +142,9 @@ public bool IsSignatureHelpActive()
public string[] GetErrorTags()
=> GetTags<IErrorTag>();

public int GetHighlightTagCount()
=> GetTags<ITextMarkerTag>(tag => tag.Type == KeywordHighlightTag.TagId).Length;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just return the tag spans themselves and check them?

@rchande rchande merged commit 3a4f6af into dotnet:master Apr 6, 2017
@rchande rchande deleted the keywordhighlightingtest branch April 6, 2017 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants