summaryrefslogtreecommitdiff
path: root/tests/test_xpath.cpp
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-08-04 14:15:46 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-08-04 14:15:46 +0000
commitdeb9e8bc74e67ec14a39dd977afbfe345d5586f6 (patch)
tree674cc4fc5a9efb332b6728d256bb42fa0666ac50 /tests/test_xpath.cpp
parent6df3609007d59dfa5f6cc218902da49ff258befc (diff)
tests: Added more XPath tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@628 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_xpath.cpp')
-rw-r--r--tests/test_xpath.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_xpath.cpp b/tests/test_xpath.cpp
index 29e7244..bfa4fed 100644
--- a/tests/test_xpath.cpp
+++ b/tests/test_xpath.cpp
@@ -272,4 +272,26 @@ TEST(xpath_document_order)
CHECK(xml_attribute().document_order() == 0);
CHECK(xml_node().document_order() == 0);
}
+
+TEST_XML(xpath_context_node, "<node>5</node>")
+{
+ CHECK_XPATH_NODESET(doc, STR("node")) % 2;
+ CHECK_XPATH_BOOLEAN(doc, STR("node"), true);
+ CHECK_XPATH_NUMBER(doc, STR("node"), 5);
+ CHECK_XPATH_STRING(doc, STR("node"), STR("5"));
+}
+
+TEST_XML(xpath_context_position, "<node>5</node>")
+{
+ CHECK_XPATH_NODESET(doc, STR("id(position() + last())"));
+ CHECK_XPATH_BOOLEAN(doc, STR("position() + last() = 2"), true);
+ CHECK_XPATH_NUMBER(doc, STR("position() + last()"), 2);
+ CHECK_XPATH_STRING(doc, STR("position() + last()"), STR("2"));
+}
+
+TEST(xpath_lexer_unknown_lexeme)
+{
+ CHECK_XPATH_FAIL(STR("(^3))"));
+ CHECK_XPATH_FAIL(STR("(!3))"));
+}
#endif