summaryrefslogtreecommitdiff
path: root/tests/test_xpath_variables.cpp
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-06-22 22:11:43 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-06-22 22:11:43 -0700
commit3870217381529093b9e8752056ca6784b8d03bc6 (patch)
treefa0d485f37f6c039bab549fab47bc904dfce4070 /tests/test_xpath_variables.cpp
parent5867aff943f80f19649c7e6495765af0cb5719b2 (diff)
tests: Add more XPath out of memory tests
This fixes missing coverage in translate_table_generate and xpath_node_set_raw::append.
Diffstat (limited to 'tests/test_xpath_variables.cpp')
-rw-r--r--tests/test_xpath_variables.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_xpath_variables.cpp b/tests/test_xpath_variables.cpp
index d7d7276..0292e8b 100644
--- a/tests/test_xpath_variables.cpp
+++ b/tests/test_xpath_variables.cpp
@@ -624,4 +624,22 @@ TEST(xpath_variables_copy_big_value_out_of_memory)
CHECK(!copy.get(STR("x")));
}
+
+TEST_XML(xpath_variables_evaluate_node_set_out_of_memory, "<node />")
+{
+ for (size_t i = 0; i < 600; ++i)
+ doc.append_child(STR("node"));
+
+ xpath_node_set ns = doc.select_nodes(STR("node"));
+ CHECK(ns.size() == 601);
+
+ xpath_variable_set set;
+ set.set(STR("nodes"), ns);
+
+ xpath_query q("$nodes", &set);
+
+ test_runner::_memory_fail_threshold = 1;
+
+ CHECK_ALLOC_FAIL(q.evaluate_node_set(xml_node()).empty());
+}
#endif