summaryrefslogtreecommitdiff
path: root/tests/test_write.cpp
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-03-10 20:44:06 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-03-10 20:44:06 -0700
commitf81d7cc0184b1586270ecf41386d98942df3cf99 (patch)
tree8d3e5a7d5880d02c6af2fdaa8f97e23035ad66e7 /tests/test_write.cpp
parente5ecbd63ce75de0a8f1473cbe0c1f9eea657dd02 (diff)
parent604861e520d2d6579674a1c2bd5e59cb10f7ecd2 (diff)
Merge branch 'master' into compact
Diffstat (limited to 'tests/test_write.cpp')
-rw-r--r--tests/test_write.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/test_write.cpp b/tests/test_write.cpp
index ca230c3..59cdb3e 100644
--- a/tests/test_write.cpp
+++ b/tests/test_write.cpp
@@ -115,6 +115,25 @@ TEST(write_pi_null)
CHECK_NODE(doc, STR("<?:anonymous value?>"));
}
+TEST(write_pi_invalid)
+{
+ xml_document doc;
+ xml_node node = doc.append_child(node_pi);
+
+ node.set_name(STR("test"));
+ node.set_value(STR("?"));
+
+ CHECK_NODE(doc, STR("<?test ?" "?>"));
+
+ node.set_value(STR("?>"));
+
+ CHECK_NODE(doc, STR("<?test ? >?>"));
+
+ node.set_value(STR("<?foo?>"));
+
+ CHECK_NODE(doc, STR("<?test <?foo? >?>"));
+}
+
TEST_XML_FLAGS(write_declaration, "<?xml version='2.0'?>", parse_declaration | parse_fragment)
{
CHECK_NODE(doc, STR("<?xml version=\"2.0\"?>"));
@@ -171,7 +190,7 @@ struct test_writer: xml_writer
virtual void write(const void* data, size_t size)
{
CHECK(size % sizeof(pugi::char_t) == 0);
- contents += std::basic_string<pugi::char_t>(static_cast<const pugi::char_t*>(data), static_cast<const pugi::char_t*>(data) + size / sizeof(pugi::char_t));
+ contents.append(static_cast<const pugi::char_t*>(data), size / sizeof(pugi::char_t));
}
};