0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-27 13:33:17 +08:00

Add test for xml_text::set with size argument

This commit is contained in:
Ferenc Géczi 2022-09-29 00:00:00 +00:00
parent f327371219
commit 09e7cc9b1c

View File

@ -249,6 +249,26 @@ TEST_XML(dom_text_set, "<node/>")
CHECK_NODE(node, STR("<node>foobarfoobar</node>")); CHECK_NODE(node, STR("<node>foobarfoobar</node>"));
} }
TEST_XML(dom_text_set_with_size, "<node/>")
{
xml_node node = doc.child(STR("node"));
xml_text t = node.text();
t.set(STR(""), 0);
CHECK(node.first_child().type() == node_pcdata);
CHECK_NODE(node, STR("<node></node>"));
t.set(STR("boo"), 3);
CHECK(node.first_child().type() == node_pcdata);
CHECK(node.first_child() == node.last_child());
CHECK_NODE(node, STR("<node>boo</node>"));
t.set(STR("foobarfoobar"), 12);
CHECK(node.first_child().type() == node_pcdata);
CHECK(node.first_child() == node.last_child());
CHECK_NODE(node, STR("<node>foobarfoobar</node>"));
}
TEST_XML(dom_text_assign, "<node/>") TEST_XML(dom_text_assign, "<node/>")
{ {
xml_node node = doc.child(STR("node")); xml_node node = doc.child(STR("node"));