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

Mocking static methods of the class #128

Open
jkrajniak opened this issue Sep 19, 2023 · 3 comments
Open

Mocking static methods of the class #128

jkrajniak opened this issue Sep 19, 2023 · 3 comments

Comments

@jkrajniak
Copy link

Hi,

Is there any way to mock static methods of the class. I've tried but it fails. Basically

FAKE_VOID_FUNC(BaselineCalib::setModel)

where setModel is a static method of BaselineCalib class. Now it returns with the error

tests/fff.h:154:36: error: qualified name does not name a class before '{' token
  154 |     typedef struct FUNCNAME##_Fake { \
@jkrajniak jkrajniak changed the title Mocking static methods of the classes Mocking static methods of the class Sep 19, 2023
@jakub-dudarewicz
Copy link
Contributor

Hi, just passing by. FFF is supposed to be used for C, not C++. For C++ better use GoogleTest, CppUTest, etc.

@jkrajniak
Copy link
Author

True, although I have a project that mixes C and C++ (with extern C) and then the standard mocking is almost impossible...

@jakub-dudarewicz
Copy link
Contributor

I haven't yet been in that situation, I guess using FFF for C and Google Mock for C++ is out of the question?

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