summaryrefslogtreecommitdiff
path: root/tests/test_xpath_functions.cpp
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-10-02 03:06:59 +0000
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-10-02 03:06:59 +0000
commit3fcc530b341709000b7acf4e8b85ad11cac0927d (patch)
tree6e7a82456a3f496fb79c9597fd12908b6c291242 /tests/test_xpath_functions.cpp
parent00e1219bec0bd56536fcd8cba7930b426c9601db (diff)
tests: Add missing tests to increase code coverage
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1038 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_xpath_functions.cpp')
-rw-r--r--tests/test_xpath_functions.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_xpath_functions.cpp b/tests/test_xpath_functions.cpp
index 7245bee..30ba218 100644
--- a/tests/test_xpath_functions.cpp
+++ b/tests/test_xpath_functions.cpp
@@ -414,6 +414,13 @@ TEST(xpath_string_substring_after)
CHECK_XPATH_FAIL(STR("substring-after('a', 'b', 'c')"));
}
+TEST_XML(xpath_string_substring_after_heap, "<node>foo<child/>bar</node>")
+{
+ CHECK_XPATH_STRING(doc, STR("substring-after(node, 'fo')"), STR("obar"));
+ CHECK_XPATH_STRING(doc, STR("substring-after(node, 'fooba')"), STR("r"));
+ CHECK_XPATH_STRING(doc, STR("substring-after(node, 'foobar')"), STR(""));
+}
+
TEST(xpath_string_substring)
{
xml_node c;
@@ -474,6 +481,13 @@ TEST(xpath_string_substring)
CHECK_XPATH_FAIL(STR("substring('', 1, 2, 3)"));
}
+TEST_XML(xpath_string_substring_heap, "<node>foo<child/>bar</node>")
+{
+ CHECK_XPATH_STRING(doc, STR("substring(node, 3)"), STR("obar"));
+ CHECK_XPATH_STRING(doc, STR("substring(node, 6)"), STR("r"));
+ CHECK_XPATH_STRING(doc, STR("substring(node, 7)"), STR(""));
+}
+
TEST_XML(xpath_string_string_length, "<node>123</node>")
{
xml_node c;