-
Notifications
You must be signed in to change notification settings - Fork 604
Auto-generate stub files for unit tests #2361
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
base: master
Are you sure you want to change the base?
Conversation
|
For simplicity in the script, and flexibility with stub macro used - header files should be marked up with the stub detail (eg. Script supports pre-compiler Stubbed function/methods also need to be defined without parameter names to avoid "unused parameter" errors when compiling the stub. For this |
|
nice idea! |
rousskov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generating stubs may be a good idea, but we should not pollute primary code with STUB parts and use AWK to process them.
Well, you are welcome to roll your own custom C++ parser to generate stubs if you really want to. Seems like a lot of unnecessary work though. |
|
One other thing I have been wondering about is making the markup look like this: ... which is a bit more self-documenting than what we have now. |
also looks good! How about using [[maybe_unused]] in the generated stubs? https://en.cppreference.com/w/cpp/language/attributes/maybe_unused.html |
There are much better alternatives than the one proposed in this PR and the one proposed in the above comment. |
All the approaches I am aware of for stub generation come down to parsing the C/C++, or some form of new markup. If you have something else, please provide some actionable response. |
Yes, that attribute could be used when naming is needed. |
I would expect the attribute to be needed in the definition, not in the declaration. |
No description provided.