-
Notifications
You must be signed in to change notification settings - Fork 983
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
Issue with Discovery of Included Mocks In Test Runner Generator #689
Comments
This behavior exists because some embedded compilers enforce the usage of Are you using Make sense? |
I understand. However, with that logic, why even pass the "system" include files to the It is confusing because it currently sort of works to use |
That's an excellent question. It does seem we have a mismatch in features here. Also, as we're talking this out, I'm realizing that IF the compiler actually does have a problem with it, it'll complain on its own without the test runner generator needing to enforce it... so the script should just support whichever the user wants to do and assume they know what they're doing. Thanks for bringing this up, and for being willing to talk it out. :) |
It appears that the issue lies in the behavior of the find_includes function in auto/generate_test_runner.rb, which wraps all system include files in < and >. This causes a problem because the regular expression used to identify mock files (Mock*.h) doesn't match files included with <>. The suggested solution is to remove the wrapping of system include files, which would allow the regular expression to match both local and system include files correctly. However, there's a concern about the necessity of passing system include files to the find_mocks function if they will never match the mock file pattern. One member suggests that the usage of <> for system files is enforced by some compilers, while others argue that by the time mocks are created, they are no longer system files and should be included with "" instead. The conclusion drawn from the discussion is that the script should support whichever include style the user prefers and assume they know what they're doing. Additionally, there seems to be agreement that passing system include files to find_mocks when they cannot match the mock file pattern is a mismatch in features that should be addressed. Overall, the solution involves updating the script to support both "" and <> include styles and revisiting the logic for passing system include files to find_mocks. |
The
find_includes
function inauto/generate_test_runner.rb
scans the source code to find #include directives in the input file, enumerating the "local", "system" and "linkonly" include files. For a reason that I cannot fathom, it then wraps all system include files in "<" and ">". So, if the source code contains,then the list of "local" include files will contain
MockFoo.h
, and the list of "system" include files will contain<MockBar.h>
.The code then passes both the "local" and the "system" include files to the
find_mocks
function. For each include file, it tests if the file name begins with the mock prefix, e.g., "Mock" and ends with ".h". But, because of the<>
, this regular expression never matches for any of the "system" includes.Therefore, for mocks included with
<>
, the corresponding Mock Init, Verify and Destroy functions will never be called.Removing the
.map { |inc| "<#{inc}>" }
from line 199 fixes this issue for me with no perceived side effects.The text was updated successfully, but these errors were encountered: