Fixed strequalrange so that it matches the description (this also fixes first_element_by_path prefix bug), added more first_element_by_path tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@570 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
parent
8ff8f86f10
commit
9adf67be3a
3 changed files with 9 additions and 4 deletions
|
@ -134,7 +134,7 @@ namespace pugi
|
|||
if (lhs[i] != rhs[i])
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return lhs[count] == 0;
|
||||
}
|
||||
|
||||
// Character set pattern match.
|
||||
|
|
|
@ -940,9 +940,7 @@ namespace pugi
|
|||
{
|
||||
size_t length = static_cast<size_t>(end - begin);
|
||||
|
||||
if (!impl::strequalrange(other, begin, length)) return false;
|
||||
|
||||
return other[length] == 0;
|
||||
return impl::strequalrange(other, begin, length);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -596,6 +596,13 @@ TEST_XML(dom_node_first_element_by_path, "<node><child1>text<child2/></child1></
|
|||
|
||||
CHECK(doc.child(STR("node")).first_element_by_path(STR("..")) == doc);
|
||||
CHECK(doc.child(STR("node")).first_element_by_path(STR(".")) == doc.child(STR("node")));
|
||||
|
||||
CHECK(doc.child(STR("node")).first_element_by_path(STR("../node/./child1/../.")) == doc.child(STR("node")));
|
||||
|
||||
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("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());
|
||||
}
|
||||
|
||||
struct test_walker: xml_tree_walker
|
||||
|
|
Loading…
Add table
Reference in a new issue