#include "ReturnMatcher.hpp"
bool ReturnMatcher::match(const memcached_return_t &arg) const {
- return arg == expected;
+ if (arg != expected) {
+ if (expected == MEMCACHED_SUCCESS && arg == MEMCACHED_BUFFERED && memc) {
+ return memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS);
+ }
+ return false;
+ }
+ return true;
}
ReturnMatcher ReturnMatcher::success() {
}
string ReturnMatcher::describe() const {
- return "is " + to_string(expected)
- + "\n actual: " + memcached_last_error_message(memc);
+ return "// but '" + to_string(expected) + "' was expected\n"
+ + "last error: " + memcached_last_error_message(memc);
}