Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 16, 2025

Fixes #45893

Problem

The AssertTaggedText method in AbstractSemanticQuickInfoSourceTests was ignoring its expectedClassifications parameter. Tests calling methods like Documentation(), MainDescription(), etc. with ExpectedClassifications() were only validating the concatenated text, not the actual classification tags of each TaggedText element.

For example, this test was only checking that the text equals "This example shows how to specify the GenericClass<T> cref." but not verifying that "GenericClass" has the Class classification tag:

Documentation("This example shows how to specify the GenericClass<T> cref.",
    ExpectedClassifications(
        Text("This example shows how to specify the"),
        WhiteSpace(" "),
        Class("GenericClass"),
        Punctuation.OpenAngle,
        TypeParameter("T"),
        Punctuation.CloseAngle,
        WhiteSpace(" "),
        Text("cref.")));

Solution

Modified AssertTaggedText to use the existing ClassificationTestHelper.VerifyTextAndClassifications method when expectedClassifications is provided. This helper properly validates both:

  1. The concatenated text matches the expected text
  2. Each TaggedText element has the correct classification tag (e.g., Class, TypeParameter, Punctuation)

When expectedClassifications is null, the method continues to use the original simple text comparison, maintaining full backward compatibility.

Testing

  • Verified builds succeed for both C# and VB EditorFeatures test projects
  • Tests that pass ExpectedClassifications will now properly validate classification tags
  • Tests without ExpectedClassifications continue to work unchanged

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>AbstractSemanticQuickInfoSourceTests.AssertTaggedText ignores 'expectedClassifications' input parameter</issue_title>
<issue_description>See 6e0b677#diff-e26a1fae499ea2c247aca446606e7c4bR62

Some tests seem to be passing non-default value. We should either remove or respect this parameter.</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #45893


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits October 16, 2025 22:18
The AssertTaggedText method now uses ClassificationTestHelper.VerifyTextAndClassifications when expectedClassifications is provided, properly validating both text and classification tags.

Co-authored-by: CyrusNajmabadi <[email protected]>
Copilot AI changed the title [WIP] Fix AssertTaggedText to respect expectedClassifications parameter Fix AbstractSemanticQuickInfoSourceTests.AssertTaggedText to respect expectedClassifications parameter Oct 16, 2025
Copilot finished work on behalf of CyrusNajmabadi October 16, 2025 22:33
Copilot AI requested a review from CyrusNajmabadi October 16, 2025 22:33
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.

AbstractSemanticQuickInfoSourceTests.AssertTaggedText ignores 'expectedClassifications' input parameter

2 participants