Skip to content

Text method fails to handle invalid start tags, resulting in incorrect output. #3

Description

@testmigrator

The text() method is not handling invalid start tags correctly, resulting in incorrect text output

TEST(test, handlesInvalidStartTags) {
    std::string html("<html><div>Hello < There <&amp;></div></html>");
    HtmlParser parser;
    shared_ptr<HtmlDocument> doc = parser.Parse(html);
    std::vector<shared_ptr<HtmlElement>> els = doc->SelectElement("//div");
    
    ASSERT_EQ(1, els.size());

    // ASSERT_EQ("Hello < There <&>", els[0]->text());
    ASSERT_EQ("Hello ", els[0]->text());
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions