summaryrefslogtreecommitdiff
path: root/tests/test_xpath_functions.cpp
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-10-23 07:41:07 +0000
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-10-23 07:41:07 +0000
commit903db8682a5f14b52adec996584c70ea072619ea (patch)
treeb65c4c8bb68d7d0d77a204ca850c2d85bf7a5a6e /tests/test_xpath_functions.cpp
parentbbd75fda4618dcbef272c8e5432153992c392588 (diff)
tests: Add more tests for better coverage
More tests for out-of-memory and other edge conditions git-svn-id: https://pugixml.googlecode.com/svn/trunk@1075 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_xpath_functions.cpp')
-rw-r--r--tests/test_xpath_functions.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/test_xpath_functions.cpp b/tests/test_xpath_functions.cpp
index da820ef..678bc2e 100644
--- a/tests/test_xpath_functions.cpp
+++ b/tests/test_xpath_functions.cpp
@@ -216,7 +216,7 @@ TEST(xpath_boolean_false)
CHECK_XPATH_FAIL(STR("false(1)"));
}
-TEST_XML(xpath_boolean_lang, "<node xml:lang='en'><child xml:lang='zh-UK'><subchild/></child></node><foo><bar/></foo>")
+TEST_XML(xpath_boolean_lang, "<node xml:lang='en'><child xml:lang='zh-UK'><subchild attr=''/></child></node><foo><bar/></foo>")
{
xml_node c;
@@ -244,6 +244,9 @@ TEST_XML(xpath_boolean_lang, "<node xml:lang='en'><child xml:lang='zh-UK'><subch
CHECK_XPATH_BOOLEAN(doc.child(STR("node")).child(STR("child")), STR("lang('r')"), false);
CHECK_XPATH_BOOLEAN(doc.child(STR("node")).child(STR("child")).child(STR("subchild")), STR("lang('en')"), false);
+ // lang with 1 attribute argument
+ CHECK_XPATH_NODESET(doc, STR("//@*[lang('en')]"));
+
// lang with 2 arguments
CHECK_XPATH_FAIL(STR("lang(1, 2)"));
}
@@ -773,6 +776,16 @@ TEST_XML_FLAGS(xpath_string_value, "<node><c1>pcdata</c1><c2><child/></c2><c3 at
CHECK_XPATH_STRING(n, STR("string(c6/node())"), STR("cdata"));
}
+TEST(xpath_string_value_empty)
+{
+ xml_document doc;
+ doc.append_child(node_pcdata).set_value(STR("head"));
+ doc.append_child(node_pcdata);
+ doc.append_child(node_pcdata).set_value(STR("tail"));
+
+ CHECK_XPATH_STRING(doc, STR("string()"), STR("headtail"));
+}
+
TEST_XML(xpath_string_concat_translate, "<node>foobar</node>")
{
CHECK_XPATH_STRING(doc, STR("concat('a', 'b', 'c', translate(node, 'o', 'a'), 'd')"), STR("abcfaabard"));