Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to have different mocks in different tests #135

Open
brendan-simon-indt opened this issue Sep 16, 2024 · 1 comment
Open

How to have different mocks in different tests #135

brendan-simon-indt opened this issue Sep 16, 2024 · 1 comment

Comments

@brendan-simon-indt
Copy link

Does FFF support having different mocks for a function in different tests (in the same test file)?

I tried mocking a function with various return values and it works great.
I added another test which added a custom fake (as output values are returned via argument pointers), but then the original tests failed.
I think I also got multiple definition errors, so I had to modify the code under test to have the weak attribute.

Just wondering if FFF can support multiple fakes per test and not have to modify the original source code under test.

Thanks, Brendan :)

@owbear
Copy link

owbear commented Oct 10, 2024

Declare your mocks once and specify the behaviour in each test. RESET_FAKE() in between resets to the default behaviour

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants