Skip to content

Commit

Permalink
vaev-markup: further xhtml tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pauloamed committed Jan 8, 2025
1 parent ecd1c5a commit 8b3ce58
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/web/vaev-markup/tests/test-xhtml-parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,33 @@ test$("parse-doctype") {
return Ok();
}

test$("parse-title") {
auto s = Io::SScan("<title>the title</title>");
XmlParser p{};
auto dom = makeStrong<Markup::Document>(Mime::Url());
try$(p.parse(s, Vaev::HTML, *dom));
expect$(dom->title() == "the title");
return Ok();
}

test$("parse-comment-with-gt-symb") {
auto s = Io::SScan(
"<title>im a title!</title>"
"<!-- a b <meta> c d -->"
);
XmlParser p{};
auto dom = makeStrong<Markup::Document>(Mime::Url());
try$(p.parse(s, Vaev::HTML, *dom));

expect$(dom->hasChildren());
auto title = dom->firstChild();
expect$(title->nodeType() == NodeType::ELEMENT);

auto comment = title->nextSibling();
expect$(comment->nodeType() == NodeType::COMMENT);
expect$(try$(comment.cast<Comment>())->data == " a b <meta> c d ");

return Ok();
}

} // namespace Vaev::Markup::Tests

0 comments on commit 8b3ce58

Please sign in to comment.