summaryrefslogtreecommitdiff
path: root/tests/test_xpath_parse.cpp
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-11-08 15:30:49 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-11-08 15:30:49 +0000
commiteefd73bc4e51184021cc84bd9adf3f600438d958 (patch)
tree6df208fc81af42390479b08beb3f96e1bcf290e1 /tests/test_xpath_parse.cpp
parent0cac815b6398d60171e992a4333ab16ad542aebc (diff)
tests: More XPath coverage
git-svn-id: http://pugixml.googlecode.com/svn/trunk@226 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_xpath_parse.cpp')
-rw-r--r--tests/test_xpath_parse.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/test_xpath_parse.cpp b/tests/test_xpath_parse.cpp
index cce3085..38032ea 100644
--- a/tests/test_xpath_parse.cpp
+++ b/tests/test_xpath_parse.cpp
@@ -37,6 +37,7 @@ TEST(xpath_number_error)
TEST(xpath_variables)
{
CHECK_XPATH_FAIL("$var"); // not implemented
+ CHECK_XPATH_FAIL("$1");
}
TEST(xpath_empty_expression)
@@ -49,4 +50,36 @@ TEST(xpath_lexer_error)
CHECK_XPATH_FAIL("!");
}
+TEST(xpath_unmatched_braces)
+{
+ CHECK_XPATH_FAIL("node[");
+ CHECK_XPATH_FAIL("node[1");
+ CHECK_XPATH_FAIL("node[]]");
+ CHECK_XPATH_FAIL("node(");
+ CHECK_XPATH_FAIL("node(()");
+ CHECK_XPATH_FAIL("(node)[1");
+ CHECK_XPATH_FAIL("(1");
+}
+
+TEST(xpath_incorrect_step)
+{
+ CHECK_XPATH_FAIL("child::1");
+ CHECK_XPATH_FAIL("something::*");
+}
+
+TEST(xpath_semantics_error)
+{
+ CHECK_XPATH_FAIL("1[1]");
+ CHECK_XPATH_FAIL("1 | 1");
+}
+
+TEST(xpath_semantics_posinv) // coverage for contains()
+{
+ xpath_query("(node)[substring(1, 2, 3)]");
+ xpath_query("(node)[concat(1, 2, 3, 4)]");
+ xpath_query("(node)[count(foo)]");
+ xpath_query("(node)[local-name()]");
+ xpath_query("(node)[(node)[1]]");
+}
+
#endif