-
Notifications
You must be signed in to change notification settings - Fork 77
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
Issues/0111 ctlrender pickup module_name function (#111) #112
Conversation
* fix module main function finding on Windows * add improved error handling when correct function name cannot be found
Can you try adding a test for this so it could be run with Ctest ? I think you just need to add something like this to \CTL\unittest\ctlrender\CMakeLists.txt
and then add the CTL file |
@ThomasWilshaw you could also try allowing changes on your pull request so I could try to collaborate with you on the code and tests. I think you would need to follow these instructions https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork |
Allow Edits by Maintainers is already checked on the PR so you should be good to do any edits you need. Thanks, I wasn't sure how best to add this test so I'll give that a try. |
@ThomasWilshaw I just tried running Ctest with your func_name branch, I think the current ctlrender tests may actually already be testing the function-name-is-filename feature that you fixed for windows, since test.sh uses the
|
It seems your fix works for when calling ctlrender from windows command prompt and windows powershell, like this
And this makes sense since both windows command prompt and windows powershell use normal windows paths like C:\temp with a backslash character \ But it doesn't seem to work with git bash in windows or wsl that use paths with forward slash character / like this:
|
Does it make sense to check for both \ and / and use which ever is found ?
|
…name_is_filename.ctl
That seems reasonable, I can't imagine a path having both forward and back slashes. Is it worth adding a test that deliberately fails as well? I.e. to make sure we properly handle an inccorect function name? |
If it were possible, this would pick the largest value (closest to the end of the string).
|
yeah, i think we should test a CTL file that doesn't include either the filename-as-functionname or main() and it should fail. I've never used |
The |
…hes to exist in the same filename string
* add a test that checks ctlrender fails when a ctl module does not contain a function name that is either main or the same as the module name * add incorrect_function_name.ctl
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.
looks good - thanks for the contribution!
fix module main function finding on Windows
add improved error handling when correct function name cannot be found
Fixes #111