Skip to content

Make generation of "missing" _Expect methods for functions with return values optional #507

@rstahn

Description

@rstahn

I am just updating my unit test environment from CMock v2.5.3 to the latest v2.6.1. While testing the new release I notice that with #462 CMock is now generating dummy "Expect()" mappings for functions returning a value. Although I fully understand the reasoning from #462 I do not like the new behavior for two reasons:

  1. Formerly using "Expect()" for a function returning a value caused an error during compile time (usually a linker error). New the project can be build without issues but the test case will fail.
    IMHO this is slowing down the "notice error and correct the issue" process.
  2. When using a modern editor with code completion you could start typing "<function_name>_exp" and then ask the editor to complete it. There used to be only a single matching choice for code completion -- either "_Expect()" for functions without return value or "_ExpectAndReturn()" for functions with a return value. Now both variants will be offered and the developer needs to check, which one is correct.
    IMHO this is introducing additional potential for errors.

For these reasons I would prefer to revert back to the old behavior. Would it be possible to make the new behavior optional?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions