summaryrefslogtreecommitdiff
path: root/tests/test_xpath_paths.cpp
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-09-23 04:39:51 +0000
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-09-23 04:39:51 +0000
commit89fc7c241ca8766ffd327e985d26ee8fcce17b52 (patch)
tree9e821bbc255c9b33890bcfe02c037869691d92f5 /tests/test_xpath_paths.cpp
parentbb6eaa756588df7ed270a4f32a43922f7e006bba (diff)
tests: More XPath tests
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1020 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_xpath_paths.cpp')
-rw-r--r--tests/test_xpath_paths.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_xpath_paths.cpp b/tests/test_xpath_paths.cpp
index b6d7a4f..1f81d62 100644
--- a/tests/test_xpath_paths.cpp
+++ b/tests/test_xpath_paths.cpp
@@ -503,4 +503,23 @@ TEST_XML(xpath_paths_needs_sorting, "<node><child/><child/><child><subchild/><su
CHECK_XPATH_NODESET(doc, STR("(node/child/subchild)[2]")) % 7;
}
+TEST_XML(xpath_paths_descendant_filters, "<node><para><para/><para/><para><para/></para></para><para/></node>")
+{
+ CHECK_XPATH_NODESET(doc, STR("//para[1]")) % 3 % 4 % 7;
+ CHECK_XPATH_NODESET(doc, STR("/descendant::para[1]")) % 3;
+ CHECK_XPATH_NODESET(doc, STR("//para[true()][1]")) % 3 % 4 % 7;
+ CHECK_XPATH_NODESET(doc, STR("/descendant::para[true()][1]")) % 3;
+ CHECK_XPATH_NODESET(doc, STR("//para[1][true()]")) % 3 % 4 % 7;
+ CHECK_XPATH_NODESET(doc, STR("/descendant::para[1][true()]")) % 3;
+ CHECK_XPATH_NODESET(doc, STR("//para[1][2]"));
+ CHECK_XPATH_NODESET(doc, STR("/descendant::para[1][2]"));
+ CHECK_XPATH_NODESET(doc, STR("//para[true()]")) % 3 % 4 % 5 % 6 % 7 % 8;
+ CHECK_XPATH_NODESET(doc, STR("/descendant::para[true()]")) % 3 % 4 % 5 % 6 % 7 % 8;
+ CHECK_XPATH_NODESET(doc, STR("//para[position()=1][true()]")) % 3 % 4 % 7;
+ CHECK_XPATH_NODESET(doc, STR("/descendant::para[position()=1][true()]")) % 3;
+ CHECK_XPATH_NODESET(doc, STR("//para[true()][position()=1]")) % 3 % 4 % 7;
+ CHECK_XPATH_NODESET(doc, STR("/descendant::para[true()][position()=1]")) % 3;
+ CHECK_XPATH_NODESET(doc, STR("//node()[self::para]")) % 3 % 4 % 5 % 6 % 7 % 8;
+}
+
#endif