mirror of
https://github.com/zeux/pugixml.git
synced 2024-12-26 21:04:25 +08:00
tests: More XPath coverage
git-svn-id: http://pugixml.googlecode.com/svn/trunk@226 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
parent
0cac815b63
commit
eefd73bc4e
@ -688,6 +688,9 @@ TEST(xpath_function_arguments)
|
||||
|
||||
// whitespace after function name
|
||||
CHECK_XPATH_BOOLEAN(c, "true ()", true);
|
||||
|
||||
// too many arguments
|
||||
CHECK_XPATH_FAIL("round(1, 2, 3, 4, 5, 6)");
|
||||
}
|
||||
|
||||
TEST_XML_FLAGS(xpath_string_value, "<node><c1>pcdata</c1><c2><child/></c2><c3 attr='avalue'/><c4><?target pivalue?></c4><c5><!--comment--></c5><c6><![CDATA[cdata]]></c6></node>", parse_default | parse_pi | parse_comments)
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user