mirror of
https://github.com/zeux/pugixml.git
synced 2025-01-14 01:47:55 +08:00
tests: More miscellaneous tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@619 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
parent
958ee27e7f
commit
4f6ecee14c
@ -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"));
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user