diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2017-02-05 21:34:54 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-05 21:34:54 -0800 |
commit | a9fe2bb62e0976ab74fdb5266cc3725250eca075 (patch) | |
tree | 85c96e92afb2e3437b0eb20c805227b91e5e69f2 /tests/test_dom_traverse.cpp | |
parent | d3b9e4e1e85d0aca562d0e6b62533e68e5a4a749 (diff) | |
parent | 10676b6b8548ddbf9458993062e6a27c2c233d48 (diff) |
Merge pull request #131 from zeux/xpath-noeh
XPath: Remove exceptional control flow
Diffstat (limited to 'tests/test_dom_traverse.cpp')
-rw-r--r-- | tests/test_dom_traverse.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test_dom_traverse.cpp b/tests/test_dom_traverse.cpp index f977e15..3d30a82 100644 --- a/tests/test_dom_traverse.cpp +++ b/tests/test_dom_traverse.cpp @@ -137,6 +137,10 @@ TEST_XML(dom_attr_as_integer_space, "<node attr1=' \t1234' attr2='\t 0x123' attr CHECK(node.attribute(STR("attr2")).as_int() == 291); CHECK(node.attribute(STR("attr3")).as_int() == 0); CHECK(node.attribute(STR("attr4")).as_int() == 0); + +#ifdef PUGIXML_HAS_LONG_LONG + CHECK(node.attribute(STR("attr1")).as_llong() == 1234); +#endif } TEST_XML(dom_attr_as_float, "<node attr1='0' attr2='1' attr3='0.12' attr4='-5.1' attr5='3e-4' attr6='3.14159265358979323846'/>") @@ -736,6 +740,9 @@ TEST_XML(dom_node_path, "<node><child1>text<child2/></child1></node>") CHECK(doc.child(STR("node")).child(STR("child1")).first_child().path() == STR("/node/child1/")); CHECK(doc.child(STR("node")).child(STR("child1")).path('\\') == STR("\\node\\child1")); + + doc.append_child(node_element); + CHECK(doc.last_child().path() == STR("/")); } #endif @@ -1274,3 +1281,17 @@ TEST_XML(dom_as_int_plus, "<node attr1='+1' attr2='+0xa' />") CHECK(node.attribute(STR("attr2")).as_ullong() == 10); #endif } + +TEST(dom_node_anonymous) +{ + xml_document doc; + doc.append_child(node_element); + doc.append_child(node_element); + doc.append_child(node_pcdata); + + CHECK(doc.child(STR("node")) == xml_node()); + CHECK(doc.first_child().next_sibling(STR("node")) == xml_node()); + CHECK(doc.last_child().previous_sibling(STR("node")) == xml_node()); + CHECK_STRING(doc.child_value(), STR("")); + CHECK_STRING(doc.last_child().child_value(), STR("")); +} |