summaryrefslogtreecommitdiff
path: root/tests/test_xpath_variables.cpp
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-10-24 01:17:57 +0000
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-10-24 01:17:57 +0000
commit546997683a9edc1b77b60ac96776668d3f57adad (patch)
treefb2a3ee75cd05718e488d0a5ceda3bd4353bfa1e /tests/test_xpath_variables.cpp
parent903db8682a5f14b52adec996584c70ea072619ea (diff)
tests: Add even more coverage tests
Also fix MSVC6 compilation (make convertions to function pointers explicit). git-svn-id: https://pugixml.googlecode.com/svn/trunk@1076 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_xpath_variables.cpp')
-rw-r--r--tests/test_xpath_variables.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_xpath_variables.cpp b/tests/test_xpath_variables.cpp
index 39a4f05..728eaa9 100644
--- a/tests/test_xpath_variables.cpp
+++ b/tests/test_xpath_variables.cpp
@@ -276,6 +276,29 @@ TEST(xpath_variables_long_name)
CHECK_XPATH_BOOLEAN_VAR(xml_node(), STR("$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), &set, true);
}
+TEST(xpath_variables_long_name_out_of_memory)
+{
+ xpath_variable_set set;
+ set.set(STR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), true);
+
+ test_runner::_memory_fail_threshold = 4096 + 128;
+
+#ifdef PUGIXML_NO_EXCEPTIONS
+ xpath_query q(STR("$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), &set);
+ CHECK(!q);
+#else
+ try
+ {
+ xpath_query q(STR("$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), &set);
+
+ CHECK_FORCE_FAIL("Expected exception");
+ }
+ catch (const xpath_exception&)
+ {
+ }
+#endif
+}
+
TEST_XML(xpath_variables_select, "<node attr='1'/><node attr='2'/>")
{
xpath_variable_set set;