Skip to content

Add test-specific mock include directives macros#830

Open
JannisRln wants to merge 1 commit intoThrowTheSwitch:masterfrom
JannisRln:feature/jr_add-mock-include-directives
Open

Add test-specific mock include directives macros#830
JannisRln wants to merge 1 commit intoThrowTheSwitch:masterfrom
JannisRln:feature/jr_add-mock-include-directives

Conversation

@JannisRln
Copy link
Copy Markdown

@JannisRln JannisRln commented Apr 24, 2026

Adds new no-op configuration macros for Unity/CMock test executables to allow tests to declare additional headers that should be included in generated mocks.

The new TEST_MOCK_INCLUDE(mock, header) macro provides a simple way to associate an extra header with a generated mock, for example:

TEST_MOCK_INCLUDE("mock_driver.h", "test_driver_types.h")

This also adds location-specific variants for finer include placement control:

TEST_MOCK_INCLUDE_H_PRE_ORIG_HEADER(mock, header)
TEST_MOCK_INCLUDE_H_POST_ORIG_HEADER(mock, header)
TEST_MOCK_INCLUDE_C_PRE_HEADER(mock, header)
TEST_MOCK_INCLUDE_C_POST_HEADER(mock, header)

Motivation

Some generated mocks require additional type or dependency headers to be included in a specific location. Providing explicit macros for this allows test executables to declare those requirements without modifying generated files manually.

I preparing a Pull Request in Ceedling to support this feature. Ceedling PR 1139

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

Successfully merging this pull request may close these issues.

1 participant