diff options
Diffstat (limited to 'tests/test.cpp')
-rw-r--r-- | tests/test.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/test.cpp b/tests/test.cpp index c60619a..96a81e4 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -58,7 +58,16 @@ bool test_xpath_string(const pugi::xml_node& node, const pugi::char_t* query, co { pugi::xpath_query q(query); - return q.evaluate_string(node) == expected; + const size_t capacity = 64; + pugi::char_t result[capacity]; + + size_t size = q.evaluate_string(result, capacity, node); + + if (size <= capacity) return test_string_equal(result, expected); + + std::basic_string<pugi::char_t> buffer(size, ' '); + + return q.evaluate_string(&buffer[0], size, node) == size && test_string_equal(buffer.c_str(), expected); } bool test_xpath_boolean(const pugi::xml_node& node, const pugi::char_t* query, bool expected) |