summaryrefslogtreecommitdiff
path: root/tests/test_write.cpp
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-10-20 20:25:35 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-10-20 20:25:35 +0000
commitc026597234aa371a106409271885f0cdb3c7bae3 (patch)
tree3b5e6dc79a7b1faeb57bfd4a91bb34b529dc00c6 /tests/test_write.cpp
parenta2249c1304564c96ddd1c052043f8d5ef53e2112 (diff)
tests: Added more tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@162 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_write.cpp')
-rw-r--r--tests/test_write.cpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/tests/test_write.cpp b/tests/test_write.cpp
index 78516b2..81e945c 100644
--- a/tests/test_write.cpp
+++ b/tests/test_write.cpp
@@ -9,37 +9,41 @@ TEST_XML(write_simple, "<node attr='1'><child>text</child></node>")
TEST_XML(write_raw, "<node attr='1'><child>text</child></node>")
{
- CHECK_NODE_EX(doc, "<node attr=\"1\"><child>text</child></node>", "", pugi::format_raw);
+ CHECK_NODE_EX(doc, "<node attr=\"1\"><child>text</child></node>", "", format_raw);
}
TEST_XML(write_indent, "<node attr='1'><child><sub>text</sub></child></node>")
{
- CHECK_NODE_EX(doc, "<node attr=\"1\">\n\t<child>\n\t\t<sub>text</sub>\n\t</child>\n</node>\n", "\t", pugi::format_indent);
+ CHECK_NODE_EX(doc, "<node attr=\"1\">\n\t<child>\n\t\t<sub>text</sub>\n\t</child>\n</node>\n", "\t", format_indent);
}
TEST_XML(write_pcdata, "<node attr='1'><child><sub/>text</child></node>")
{
- CHECK_NODE_EX(doc, "<node attr=\"1\">\n\t<child>\n\t\t<sub />\n\t\ttext\n\t</child>\n</node>\n", "\t", pugi::format_indent);
+ CHECK_NODE_EX(doc, "<node attr=\"1\">\n\t<child>\n\t\t<sub />\n\t\ttext\n\t</child>\n</node>\n", "\t", format_indent);
}
TEST_XML(write_cdata, "<![CDATA[value]]>")
{
CHECK_NODE(doc, "<![CDATA[value]]>");
+ CHECK_NODE_EX(doc, "<![CDATA[value]]>\n", "", 0);
}
-TEST_XML_FLAGS(write_comment, "<!--text-->", pugi::parse_default | pugi::parse_comments)
+TEST_XML_FLAGS(write_comment, "<!--text-->", parse_default | parse_comments)
{
CHECK_NODE(doc, "<!--text-->");
+ CHECK_NODE_EX(doc, "<!--text-->\n", "", 0);
}
-TEST_XML_FLAGS(write_pi, "<?name value?>", pugi::parse_default | pugi::parse_pi)
+TEST_XML_FLAGS(write_pi, "<?name value?>", parse_default | parse_pi)
{
CHECK_NODE(doc, "<?name value?>");
+ CHECK_NODE_EX(doc, "<?name value?>\n", "", 0);
}
-TEST_XML_FLAGS(write_declaration, "<?xml version='2.0'?>", pugi::parse_default | pugi::parse_declaration)
+TEST_XML_FLAGS(write_declaration, "<?xml version='2.0'?>", parse_default | parse_declaration)
{
CHECK_NODE(doc, "<?xml version=\"2.0\"?>");
+ CHECK_NODE_EX(doc, "<?xml version=\"2.0\"?>\n", "", 0);
}
TEST_XML(write_escape, "<node attr=''>text</node>")
@@ -75,3 +79,14 @@ TEST_XML(write_print_stream, "<node/>")
CHECK(oss.str() == "<node />\n");
}
+
+TEST_XML(write_huge_chunk, "<node/>")
+{
+ std::string name(10000, 'n');
+ doc.child("node").set_name(name.c_str());
+
+ std::ostringstream oss;
+ doc.print(oss);
+
+ CHECK(oss.str() == "<" + name + " />\n");
+}