summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/pugixml.cpp1
-rw-r--r--tests/test_xpath_paths.cpp6
2 files changed, 7 insertions, 0 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index 7db62d0..484f34b 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -9621,6 +9621,7 @@ PUGI__NS_BEGIN
switch (_type)
{
case ast_func_position:
+ case ast_func_last:
return false;
case ast_string_constant:
diff --git a/tests/test_xpath_paths.cpp b/tests/test_xpath_paths.cpp
index c18acd2..43096bc 100644
--- a/tests/test_xpath_paths.cpp
+++ b/tests/test_xpath_paths.cpp
@@ -531,6 +531,12 @@ TEST_XML(xpath_paths_descendant_optimize, "<node><para><para/><para/><para><para
CHECK_XPATH_NODESET(doc, STR("/descendant-or-self::node()[3]/child::para")) % 4 % 5 % 6;
}
+TEST_XML(xpath_paths_descendant_optimize_last, "<node><para><para/><para/><para><para/></para></para><para/></node>")
+{
+ CHECK_XPATH_NODESET(doc, STR("//para[last()]")) % 6 % 7 % 8;
+ CHECK_XPATH_NODESET(doc, STR("//para[last() = 1]")) % 7;
+}
+
TEST_XML(xpath_paths_precision, "<node><para/><para/><para/><para/><para/></node>")
{
CHECK_XPATH_NODESET(doc, STR("//para[1]")) % 3;