FabioBatSilva / ArduinoFake

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

Struggle creating Serial1 mock #14

Closed TomasAllegrini closed 2 years ago

TomasAllegrini commented 4 years ago

Hi, i've trying to create another serial port with the framework, but could't make it work, i need to mock Serial1. Is there any tutorial on how to make this mocks for this framework? Thanks

FabioBatSilva commented 4 years ago

That is not supported yet..

If you are interested in contributing check out : https://github.com/FabioBatSilva/ArduinoFake/blob/master/CONTRIBUTING.md

I think that is the same as the Serial implementation just a different variable..

TomasAllegrini commented 4 years ago

okey, i am still having trouble understanding how to make these mocks, if i can make another Serial, i will create a branch and upload it here. Any help is welcome What i cant' understand, is the relationship with SerialFake, Serial and _Serial, _Serial seems to be the implementation that Serial have to call when invoked, but _Serial and SerialFake should't be the same class?

FabioBatSilva commented 4 years ago

The _Serial header comes from arduino.. SerialFake is a mockable version that is compatible with FakeIt

There is no concrete implementation for SerialFake only mocks.. and the implementation of _Serial provided by ArduinoFake acts like a proxy that just invokes the mock.