From 48f9343c05eabf9f2b0b5529005ce43b2b5bceeb Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine@gmail.com" Date: Sat, 17 Nov 2012 22:50:05 +0000 Subject: XPath: Add unit test for unary minus and union precedences git-svn-id: http://pugixml.googlecode.com/svn/trunk@929 99668b35-9821-0410-8761-19e4c4f06640 --- tests/test_xpath_operators.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_xpath_operators.cpp b/tests/test_xpath_operators.cpp index c7fe165..c028224 100644 --- a/tests/test_xpath_operators.cpp +++ b/tests/test_xpath_operators.cpp @@ -435,6 +435,17 @@ TEST(xpath_operators_union_error) CHECK_XPATH_FAIL(STR("count(.) | .")); } +TEST_XML(xpath_operators_union_minus, "34") +{ + CHECK_XPATH_FAIL(STR("(-node1) | node2")); + CHECK_XPATH_FAIL(STR("node1 | -node2")); + CHECK_XPATH_NUMBER(doc, STR("-(node1 | node2)"), -3); + CHECK_XPATH_NUMBER(doc, STR("-node1 | node2"), -3); + CHECK_XPATH_NUMBER(doc, STR("--node1 | node2"), 3); + CHECK_XPATH_NUMBER(doc, STR("-(-node1 | node2)"), 3); + CHECK_XPATH_NUMBER(doc, STR("--(-node1 | node2)"), -3); +} + TEST(xpath_operators_associativity_boolean) { xml_node c; -- cgit v1.2.3