When I run the following code, I would expect the test to pass:
#include <iostream>
#include <string>
#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "fakeit.hpp"
class SomeClass {
public:
virtual ~SomeClass() {}
virtual void do_something(int a, std::string b) {
std::cout << "Called with: " << a << ", " << b << "\n";
}
};
TEST_CASE("Spy on strings") {
SomeClass test;
fakeit::Mock<SomeClass> testSpy(test);
fakeit::Spy(Method(testSpy, do_something));
testSpy.get().do_something(2, "some_string");
fakeit::Verify(Method(testSpy, do_something).Using(2, "some_string"));
}
What I get instead is the following error:
Called with: 2, some_string
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.out is a Catch v2.10.2 host application.
Run with -? for options
-------------------------------------------------------------------------------
Spy on strings
-------------------------------------------------------------------------------
test_case.cpp:18
...............................................................................
test_case.cpp:28: FAILED:
Verify( testSpy.do_something(2, some_string) )
with message:
test_case.cpp:28: Verification error
Expected pattern: testSpy.do_something(2, some_string)
Expected matches: at least 1
Actual matches : 0
Actual sequence : total of 1 actual invocations:
testSpy.do_something(2, )
===============================================================================
test cases: 1 | 1 failed
assertions: 1 | 1 failed
When I run the following code, I would expect the test to pass:
What I get instead is the following error: