Skip to content
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

Plugin :ignore_arg not generating mocks #483

Open
vmpxc opened this issue Oct 11, 2024 · 1 comment
Open

Plugin :ignore_arg not generating mocks #483

vmpxc opened this issue Oct 11, 2024 · 1 comment

Comments

@vmpxc
Copy link

vmpxc commented Oct 11, 2024

Hello,

I tried using the IgnoreArg functionality of CMock, but it doesn't seem to work. The mocks for ignore_arg are not being generated.
The other plugins seem to work just fine for me.

My project.yaml includes the ignore_arg Plugin:

  :plugins:
    - :ignore
    - :ignore_arg
    - :callback
    - :expect_any_args
    - :return_thru_ptr 
    - :array

An example function that I want to mock:

uint16_t GetModuleNameString(uint8_t slot, char* strName)
{
    uint16_t Lenght = 0; 

    if(slot >=1 && slot <= 16) 
    {
        // copy data to strName ...
    }
    return Lenght; 
}

In my testing function I use the following sequence:

test_NameStrings(void)
{
    char testName[] = "Test123"; 

    GetModuleNameString_ExpectAndReturn(1, NULL, 20);    // when called, make sure slot is 1, but don't care about the string yet and return 20
    GetModuleNameString_IgnoreArg_strName();    // this mock is not generated (error: implicit declaration)
    GetModuleNameString_ReturnMemThruPtr_strName(testName, sizeof(testName)); 

    func_that_will_call_GetModuleNameString_somewhere(...); 
    TEST_ASSERTS_...

}

Here I get an error, that GetModuleNameString_IgnoreArg_strName() is declarated implicitly.

At the moment I use GetModuleNameString_ExpectAnyArgsAndReturn(20) instead and it works, but I would like to check the slot parameter too.

Thanks for this great tool so far. Any help would be appreciated!

@vmpxc
Copy link
Author

vmpxc commented Oct 11, 2024

I'm using:
Ceedling:: 0.31.1
CMock:: 2.5.4
Unity:: 2.5.4
CException:: 1.3.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant