Created
June 12, 2017 09:19
FakeIt segmentation fault
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "tpunit++.hpp" | |
#include "fakeit.hpp" | |
using namespace fakeit; | |
struct MyTests : tpunit::TestFixture { | |
struct Wrapper { | |
virtual void open_file(const std::string &filename) const = 0; | |
}; | |
static Mock<Wrapper> wrapper_mock; | |
static Wrapper &wrapper; | |
class Configuration { | |
public: | |
Configuration() { | |
wrapper.open_file("path/to/config_file"); | |
} | |
}; | |
MyTests() : | |
TestFixture(TEST(MyTests::failure)) {} | |
void failure() { | |
When(Method(wrapper_mock, open_file)).Do([=](const std::string &) -> void { | |
return; | |
}); | |
Configuration configuration; | |
Verify(Method(wrapper_mock, open_file).Using("path/to/config_file")); | |
} | |
} __MyTests; | |
Mock<MyTests::Wrapper> MyTests::wrapper_mock; | |
MyTests::Wrapper &MyTests::wrapper = MyTests::wrapper_mock.get(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment