You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems I am hitting this situation: #709
And the solution is in googletest itself, however they still need to do a release of their current master as 1.8.1 which I hope is very soon.
The workaround suggested in #709 is not working for me unfortunately.
Initially the workaround in #709 worked for me, but some time later it seemed to stop working. I wasn't able to find out why but I suspect it was related to the problem discussed in google/googletest#1149
Eventually I fixed it by adding overloads for my other types that are based off nlohmann::basic_json<>, e.g.
I am trying to use the library with google test/google mock. It seems gtest is not able to print the json value out with its universal printer.
Example that fails:
I am using 3.1.2 of nlohmann and 1.8.0 of google test/mock. I am compiling and running on macOS.
I also tried to use it with gmock, but it also fails. The myCall function is defined as:
So this is in gmock:
And then in the test I set an expectation, like this:
EXPECT_CALL(*myMock, myCall(_, test1));
but every time gtest tries to print, in this case the "test1" object, then it crashes.
So what could causing this? Gtest is normally able to use a custom PrintTo function but I could not get that to work. Any pointers on how to solve it?
I have a "workaround" but it goes against the "json as first-class citizen" philosophy :)
Workaround for EXPECT_THAT:
EXPECT_THAT(test1.dump(), Eq(test2.dump()));
That is more or less acceptable, but not really.
And then for gmock it is really too much :) see:
But of course it should be as easy as:
EXPECT_CALL(*myMock, myCall(_, test));
The text was updated successfully, but these errors were encountered: