From 546997683a9edc1b77b60ac96776668d3f57adad Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Fri, 24 Oct 2014 01:17:57 +0000 Subject: 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 --- tests/test_xpath_variables.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests/test_xpath_variables.cpp') 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, "") { xpath_variable_set set; -- cgit v1.2.3