The fakeit mocking framework doesn’t seem to work with PlatformIO unity.
In FakeIt, you can mock SomeClass by doing this:
Mock mock;
When(Method(mock, some_function_in_SomeClass)).Return(0) // makes some_function_in_SomeClass return 0 when its called.
inside the test folder, if you call some_function_in_SomeClass, unity will say that the test failed:
// inside test.cpp in the test folder:
void setUp(void) {
Mock mock;
When(Method(mock, some_function_in_SomeClass)).Return(0);
}
void some_test_function_that_has_nothing_in_it() {
TEST_ASSERT_TRUE(true);
}
int main(int argc, char **argv) {
UNITY_BEGIN();
RUN_TEST(some_test_function_that_has_nothing_in_it);
UNITY_END();
}
output: test failed!