summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_write.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_write.cpp b/tests/test_write.cpp
index b7d8412..c549a82 100644
--- a/tests/test_write.cpp
+++ b/tests/test_write.cpp
@@ -31,6 +31,20 @@ TEST_XML(write_cdata, "<![CDATA[value]]>")
CHECK_NODE_EX(doc, STR("<![CDATA[value]]>\n"), STR(""), 0);
}
+TEST_XML(write_cdata_empty, "<![CDATA[]]>")
+{
+ CHECK_NODE(doc, STR("<![CDATA[]]>"));
+ CHECK_NODE_EX(doc, STR("<![CDATA[]]>\n"), STR(""), 0);
+}
+
+TEST_XML(write_cdata_escape, "<![CDATA[value]]>")
+{
+ CHECK_NODE(doc, STR("<![CDATA[value]]>"));
+
+ doc.first_child().set_value(STR("1]]>2]]>3"));
+ CHECK_NODE(doc, STR("<![CDATA[1]]]]><![CDATA[>2]]]]><![CDATA[>3]]>"));
+}
+
TEST_XML_FLAGS(write_comment, "<!--text-->", parse_default | parse_comments)
{
CHECK_NODE(doc, STR("<!--text-->"));