MCPcopy Create free account
hub / github.com/apache/arrow / MatchAndExplain

Method MatchAndExplain

cpp/src/arrow/testing/matchers.h:251–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249 }
250
251 bool MatchAndExplain(const Res& maybe_value,
252 testing::MatchResultListener* listener) const override {
253 const Status& status = ToStatus(maybe_value);
254 testing::StringMatchResultListener value_listener;
255
256 bool match = status.code() == code_;
257 if (message_matcher_) {
258 match = match &&
259 message_matcher_->MatchAndExplain(status.message(), &value_listener);
260 }
261
262 if (match) {
263 *listener << "whose error matches";
264 } else if (status.ok()) {
265 *listener << "whose non-error doesn't match";
266 } else {
267 *listener << "whose error doesn't match";
268 }
269
270 testing::internal::PrintIfNotEmpty(value_listener.str(), listener->stream());
271 return match;
272 }
273
274 const StatusCode code_;
275 const std::optional<testing::Matcher<std::string>> message_matcher_;

Callers

nothing calls this directly

Calls 5

ToStatusFunction · 0.85
strMethod · 0.80
codeMethod · 0.45
MatchAndExplainMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected