summaryrefslogtreecommitdiff
path: root/tests/test_xpath_operators.cpp
diff options
context:
space:
mode:
authorarseny.kapoulkine@gmail.com <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640>2012-11-17 22:50:05 +0000
committerarseny.kapoulkine@gmail.com <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640>2012-11-17 22:50:05 +0000
commit48f9343c05eabf9f2b0b5529005ce43b2b5bceeb (patch)
tree14bc7f639ff67b999cffc094ef22ed1bf19dc553 /tests/test_xpath_operators.cpp
parented30b95a4286b57c572e74200ce84d72d443bbfa (diff)
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
Diffstat (limited to 'tests/test_xpath_operators.cpp')
-rw-r--r--tests/test_xpath_operators.cpp11
1 files changed, 11 insertions, 0 deletions
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, "<node1>3</node1><node2>4</node2>")
+{
+ 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;