FabioBatSilva / ArduinoFake

Arduino mocking made easy
https://platformio.org/lib/show/1689/ArduinoFake
MIT License
102 stars 47 forks source link

Failing to 'fakeit::UnexpectedMethodCallException' #58

Open graial opened 5 months ago

graial commented 5 months ago

In my attempt to incorporate ArduinoFake into an example project using CppUTest: https://github.com/graial/ArduinoFake-cpputest

I'm now failing to target the source file under test.

Within your wiring-blink example, you manage to mock out the Arduino system calls with ArduinoFake, and then call loop() and setup() from the source file.

This is currently failing for me, probably because of something wrong in CmakeLists.txt

a call to loop() triggers fakeit::UnexpectedMethodCallException rather than the loop() in blink.cpp.

Alternatively, if I try to just link the object, I get a redefinition error.

Do you have any idea how to get cmake to look for loop() in the source file? rather than in ArduinoFake?

Or is there some way to flag the loop() function so that it doesn't get passed to ArduinoFake?

Cheers