summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-08-02 20:16:53 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-08-02 20:16:53 +0000
commit4f6ecee14cbbf72009ef1c7c27007773c9efa385 (patch)
treeab93fe1d69ab4150c4ab9d486441dc11c8574f26
parent958ee27e7fafb0bc5702ac3959cebaf18dce68e0 (diff)
tests: More miscellaneous tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@619 99668b35-9821-0410-8761-19e4c4f06640
-rw-r--r--tests/test_dom_modify.cpp1
-rw-r--r--tests/test_dom_traverse.cpp3
-rw-r--r--tests/test_write.cpp20
-rw-r--r--tests/test_xpath.cpp5
-rw-r--r--tests/test_xpath_api.cpp1
5 files changed, 29 insertions, 1 deletions
diff --git a/tests/test_dom_modify.cpp b/tests/test_dom_modify.cpp
index 38cc89e..5a5d3ff 100644
--- a/tests/test_dom_modify.cpp
+++ b/tests/test_dom_modify.cpp
@@ -163,6 +163,7 @@ TEST_XML(dom_node_append_copy_attribute, "<node a1='v1'><child a2='v2'/><child/>
CHECK(xml_node().append_copy(xml_attribute()) == xml_attribute());
CHECK(xml_node().append_copy(doc.child(STR("node")).attribute(STR("a1"))) == xml_attribute());
CHECK(doc.append_copy(doc.child(STR("node")).attribute(STR("a1"))) == xml_attribute());
+ CHECK(doc.child(STR("node")).append_copy(xml_attribute()) == xml_attribute());
xml_node node = doc.child(STR("node"));
xml_node child = node.child(STR("child"));
diff --git a/tests/test_dom_traverse.cpp b/tests/test_dom_traverse.cpp
index 8075dc3..fa6c6ef 100644
--- a/tests/test_dom_traverse.cpp
+++ b/tests/test_dom_traverse.cpp
@@ -577,6 +577,7 @@ TEST_XML(dom_node_path, "<node><child1>text<child2/></child1></node>")
TEST_XML(dom_node_first_element_by_path, "<node><child1>text<child2/></child1></node>")
{
CHECK(xml_node().first_element_by_path(STR("/")) == xml_node());
+ CHECK(xml_node().first_element_by_path(STR("a")) == xml_node());
CHECK(doc.first_element_by_path(STR("")) == doc);
CHECK(doc.first_element_by_path(STR("/")) == doc);
@@ -603,6 +604,8 @@ TEST_XML(dom_node_first_element_by_path, "<node><child1>text<child2/></child1></
CHECK(doc.child(STR("node")).first_element_by_path(STR("child1/")) == doc.child(STR("node")).child(STR("child1")));
CHECK(doc.child(STR("node")).first_element_by_path(STR("child")) == xml_node());
CHECK(doc.child(STR("node")).first_element_by_path(STR("child11")) == xml_node());
+
+ CHECK(doc.first_element_by_path(STR("//node")) == doc.child(STR("node")));
}
struct test_walker: xml_tree_walker
diff --git a/tests/test_write.cpp b/tests/test_write.cpp
index c549a82..4237739 100644
--- a/tests/test_write.cpp
+++ b/tests/test_write.cpp
@@ -366,3 +366,23 @@ TEST(write_no_name_attribute)
CHECK_NODE(doc, STR("<root :anonymous=\"\" />"));
}
+
+TEST(write_print_empty)
+{
+ test_writer writer;
+ xml_node().print(writer);
+}
+
+#ifndef PUGIXML_NO_STL
+TEST(write_print_stream_empty)
+{
+ std::ostringstream oss;
+ xml_node().print(oss);
+}
+
+TEST(write_print_stream_empty_wide)
+{
+ std::basic_ostringstream<wchar_t> oss;
+ xml_node().print(oss);
+}
+#endif
diff --git a/tests/test_xpath.cpp b/tests/test_xpath.cpp
index fe0a25f..29e7244 100644
--- a/tests/test_xpath.cpp
+++ b/tests/test_xpath.cpp
@@ -267,4 +267,9 @@ TEST(xpath_miscellaneous)
CHECK_XPATH_NODESET(xml_node(), STR("foo/@FOO/@bar"));
}
+TEST(xpath_document_order)
+{
+ CHECK(xml_attribute().document_order() == 0);
+ CHECK(xml_node().document_order() == 0);
+}
#endif
diff --git a/tests/test_xpath_api.cpp b/tests/test_xpath_api.cpp
index f7fc868..bf35b62 100644
--- a/tests/test_xpath_api.cpp
+++ b/tests/test_xpath_api.cpp
@@ -146,5 +146,4 @@ TEST(xpath_api_return_type)
CHECK(xpath_query(STR("'s'")).return_type() == xpath_type_string);
CHECK(xpath_query(STR("true()")).return_type() == xpath_type_boolean);
}
-
#endif