diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2015-03-10 20:44:06 -0700 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2015-03-10 20:44:06 -0700 |
commit | f81d7cc0184b1586270ecf41386d98942df3cf99 (patch) | |
tree | 8d3e5a7d5880d02c6af2fdaa8f97e23035ad66e7 /tests/test.cpp | |
parent | e5ecbd63ce75de0a8f1473cbe0c1f9eea657dd02 (diff) | |
parent | 604861e520d2d6579674a1c2bd5e59cb10f7ecd2 (diff) |
Merge branch 'master' into compact
Diffstat (limited to 'tests/test.cpp')
-rw-r--r-- | tests/test.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/test.cpp b/tests/test.cpp index eb901db..6347984 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -71,6 +71,15 @@ bool test_double_nan(double value) } #ifndef PUGIXML_NO_XPATH +static size_t strlength(const pugi::char_t* s) +{ +#ifdef PUGIXML_WCHAR_MODE + return wcslen(s); +#else + return strlen(s); +#endif +} + bool test_xpath_string(const pugi::xpath_node& node, const pugi::char_t* query, pugi::xpath_variable_set* variables, const pugi::char_t* expected) { pugi::xpath_query q(query, variables); @@ -81,7 +90,11 @@ bool test_xpath_string(const pugi::xpath_node& node, const pugi::char_t* query, size_t size = q.evaluate_string(result, capacity, node); - if (size <= capacity) return test_string_equal(result, expected); + if (size != strlength(expected) + 1) + return false; + + if (size <= capacity) + return test_string_equal(result, expected); std::basic_string<pugi::char_t> buffer(size, ' '); |