ElectronVector / fake_function_framework

A plug-in for Ceedling to use the Fake Function Framework (fff) for mocking instead of Cmock.
MIT License
37 stars 13 forks source link

fff_mock_generator mishandles parameters of type '* const *' #11

Closed cormacc closed 6 years ago

cormacc commented 6 years ago

So mocking this function void Button_pollAll(Button * const *, size_t);

Was giving me this DECLARE_FAKE_VOID_FUNC2(Button_pollAll, const Button* const*, size_t);

I.e. prefixing the argument with an extra const

Looking at FffMockGenerator.write_function_macros, we see this...

      # Append each argument type.
      function[:args].each do |arg|
        output.print ", "
        if arg[:const?]
           output.print "const "
         end
        output.print "#{arg[:type]}"
      end

That [:const?] member is created by the CMockHeaderParser, and pretty sure it's being misinterpreted by FffMockGenerator (as CMock produces the expected mock prototypes) -- i.e. the const token is still present in the arg body, so think you can safely remove the if.

Works for me anyway -- if you're happy enough with this resolution I can raise a PR