From 09e7cc9b1cee85e0d9ef8b6d91c9b1efbc735c5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferenc=20G=C3=A9czi?= Date: Thu, 29 Sep 2022 00:00:00 +0000 Subject: [PATCH] Add test for xml_text::set with size argument --- tests/test_dom_text.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/test_dom_text.cpp b/tests/test_dom_text.cpp index c71e54e..6146f55 100644 --- a/tests/test_dom_text.cpp +++ b/tests/test_dom_text.cpp @@ -249,6 +249,26 @@ TEST_XML(dom_text_set, "") CHECK_NODE(node, STR("foobarfoobar")); } +TEST_XML(dom_text_set_with_size, "") +{ + 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("")); + + t.set(STR("boo"), 3); + CHECK(node.first_child().type() == node_pcdata); + CHECK(node.first_child() == node.last_child()); + CHECK_NODE(node, STR("boo")); + + t.set(STR("foobarfoobar"), 12); + CHECK(node.first_child().type() == node_pcdata); + CHECK(node.first_child() == node.last_child()); + CHECK_NODE(node, STR("foobarfoobar")); +} + TEST_XML(dom_text_assign, "") { xml_node node = doc.child(STR("node"));