Commit 1b940536 authored by Igor Sugak's avatar Igor Sugak Committed by Facebook GitHub Bot

make JsonMockUtil.h compatible with latest googletest

Reviewed By: andrewjcg

Differential Revision: D22743063

fbshipit-source-id: 1da870027c92b11509056769626ed1f442d1b426
parent c84aa29a
...@@ -24,13 +24,21 @@ namespace folly { ...@@ -24,13 +24,21 @@ namespace folly {
namespace detail { namespace detail {
template <typename T> template <typename T>
class JsonEqMatcher : public ::testing::MatcherInterface<T> { class JsonEqMatcher : public ::testing::MatcherInterface<T> {
private:
#if defined(MOCK_METHOD)
using Arg = T;
#else
// TODO(sugak): T69712535 remove deprecated googletest API.
using Arg = T const&;
#endif
public: public:
explicit JsonEqMatcher(std::string expected, std::string prefixBeforeJson) explicit JsonEqMatcher(std::string expected, std::string prefixBeforeJson)
: expected_(std::move(expected)), : expected_(std::move(expected)),
prefixBeforeJson_(std::move(prefixBeforeJson)) {} prefixBeforeJson_(std::move(prefixBeforeJson)) {}
virtual bool MatchAndExplain( virtual bool MatchAndExplain(
T const& actual, Arg actual,
::testing::MatchResultListener* /*listener*/) const override { ::testing::MatchResultListener* /*listener*/) const override {
StringPiece sp{actual}; StringPiece sp{actual};
if (!sp.startsWith(prefixBeforeJson_)) { if (!sp.startsWith(prefixBeforeJson_)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment