ThrowTheSwitch / CMock

CMock - Mock/stub generator for C
http://throwtheswitch.org
MIT License
652 stars 269 forks source link

Docs don't specify to quote the config file for the -o argument #470

Closed declancm closed 3 months ago

declancm commented 3 months ago

The CMock documentation gives one example for using a config.yml file:

image

This wasn't working and after looking into the cmock.rb file it seems like you need to surround the path with quotes.

image

mvandervoord commented 3 months ago

Interesting. The quotes are not required and I often don't use them myself.

I can't reproduce your issue here. Can you tell me more about your system? It appears to be Windows of some flavor. What version? Are you running something like MinGW or cygwin? It appears, particularly because of the incorrect syntax highlighting, that your command line shell, whatever it is, is screwing up the arguments before passing them to CMock.

declancm commented 3 months ago

Oh that's weird!

I'm running PowerShell (not the Windows version) in Windows Terminal

mvandervoord commented 3 months ago

Thanks. I'll give that a try and see if I can get it to fail too. :)

declancm commented 3 months ago

I'm able to recreate the issue with PowerShell and Windows PowerShell with and without Windows Terminal

mvandervoord commented 3 months ago

@declancm -- thanks! I also see the problem when I issue it in PowerShell. I'll dig into it a bit and see if this is something that can just be resolved, or if I should instead update the docs. Either way, thanks for the help!

declancm commented 3 months ago

Thanks for looking into it!

mvandervoord commented 3 months ago

Ok. I see what PowerShell does differently than others. It's noticing that USUALLY commands with a single dash flag only take a single character, so it's splitting this into two arguments. A -oblah.yml becomes ['-o','blah.yml']. The parser wasn't expecting this.

The fix is fairly simple, and it has the bonus of also accepting a more common cmock.rb -o blah.yml if desired (note the space).

I've pushed the change to the cmock_2_6_rc (release candidate) branch. If you'd like, you can pull the latest and verify it works for you too. :)

declancm commented 3 months ago

Great thank you!!

I tested out the fix and the only thing is that I need to use a relative path when there isn't a space in the command

image