vendredi 2 octobre 2015

Trying to use WithArg in GMock code; error says it doesn't exist

I am trying to use WithArg in some test code. The code that I am trying to compile looks like this:

using ::testing::_;
using ::testing::Invoke;
using ::testing::WithArg;

EXPECT_CALL(myMock, MockMethodThatTakesAString(_))
                   .WithArg<0>(Invoke(this, &TestClass::FunctionThatTakesAString))
                   .Times(4);

When I try to compile this, I get the error

error: ‘class testing::internal::TypedExpectation<void(const std::basic_string<char>&)>’ has no member named ‘WithArg’

What am I doing wrong here?

Aucun commentaire:

Enregistrer un commentaire