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
#include<stdio.h>#include"fakeit.hpp"usingnamespacefakeit;
SCENARIO("example", "[]")
{
GIVEN("example")
{
classSomeClass {
public:
virtualintfunc1(intarg) {
returnarg;
}
virtualintfunc2(intarg) {
returnarg;
}
};
SomeClassobj;
Mock<SomeClass>spy(obj);
When(Method(spy, func1)).AlwaysReturn(10); // Override to return 10Spy(Method(spy, func2)); // Spying func2 without changing any behaviorSomeClass&i=spy.get();
std::cout << i.func1(1) << std::endl; // will print 10.std::cout << i.func2(1) << std::endl; // func2 is not stubbed.
}
}
That's exactly the example from the quickstart document.
When compiled with mingw gcc (v.10.2.0) the output is
10
25163300
Shouldn't the func2 call output 1?
When compiled with mingw clang (v.10.0.0) the output is
10
So the executable crashes.
It seem to crash in class RecordedMethodBody::handleMethodInvocation but I don't get a usable exeption/error message and am not good enough at C++ to fully understand what the problem could be.
We are using fakeit v2.3.2
The text was updated successfully, but these errors were encountered:
I've tried with clang 14.0.6 and gcc 12.2.0 on Linux and the examples work. The library isn't tested with mingw, maybe it's not compatible with it. I don't have a mingw setup right now so I can't really test, but I'll try to when I can.
That's exactly the example from the quickstart document.
When compiled with mingw gcc (v.10.2.0) the output is
Shouldn't the func2 call output 1?
When compiled with mingw clang (v.10.0.0) the output is
So the executable crashes.
It seem to crash in
class RecordedMethodBody::handleMethodInvocation
but I don't get a usable exeption/error message and am not good enough at C++ to fully understand what the problem could be.We are using fakeit v2.3.2
The text was updated successfully, but these errors were encountered: