Repository navigation
Conversation
A test mocking two headers that share a basename, each named by its directory, is the traditional-mock counterpart of the pending Partial example. It stays pending until CMock and Unity can name a mock by the folder its #include names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CMock and Unity's runner generator name a mock's include guard and lifecycle functions by its filename alone, so two same-named mocks in one test collide. With :cmock -> :mock_name_include_folder both tools fold the directory a test's #include names into that identity instead. Ceedling enables the option by default and mirrors it into :test_runner. Each mock records its #include as written, and stage_generate_mocks hands that directory to CMock as its folder. The mock keeps its mirrored location whenever the folder ends it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both pins point at unmerged upstream PR commits. They move to the merged upstream commits before this branch merges. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 8, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Blocked on ThrowTheSwitch/Unity#854 and ThrowTheSwitch/CMock#540. This branch's submodules pin those unmerged PR commits. They move to the merged upstream commits before this PR leaves draft. Builds on #1325.
A test can name two same-named headers by directory but cannot mock both. CMock and Unity's runner name a mock by filename alone, so the two mocks share an include guard and lifecycle symbols. This affects traditional mocks and
MOCK_PARTIAL_PUBLIC_MODULE_ATPartials alike. The upstream PRs add:mock_name_include_folderto both tools. This PR enables it and hands CMock the folder each mock's#includenames.Behavior
The new
:cmock↳:mock_name_include_foldersetting defaults totruein Ceedling and is mirrored into:test_runner, like:mock_prefixand:mock_suffix. A mock included asdrivers/uart/mock_config.hgets the guard and lifecycle functionsdrivers_uart_mock_config. The runner calls those same names. A bare#include "mock_config.h"keeps its current name.The folder is the
#includeas written, not the mock's mirrored location. The runner sees only the#include, so CMock must name from the same source. The two differ for a bare include of a header in a subdirectory, whichheader_include_path_validation_spec.rbcovers.Mock placement is unchanged when the folder ends the mirrored location. That holds for every Partial and for any
#includethat spells part of the real header's path. An#includespelling more path than the mirror holds places its mock below the per-test mock root at the written path, which the root search path still reaches. With the option set tofalse, CMock receives no folder and behaves exactly as before.Changes
lib/ceedling/test_invoker/test_invoker_types.rb,test_build_planner.rb:MockDetailsgainsinclude_path, the#includeas the test wrote it.lib/ceedling/test_invoker/test_build_executor.rb:mock_folder_and_pathderives CMock's folder and the mock's directory.stage_generate_mockspasses both togenerate_mock.lib/ceedling/generators/generator.rb:generate_mockacceptsfolder:. It derives CMock's:mock_pathby removing the folder fromoutput_pathand passes the folder tosetup_mocks. Plugin hooks still receive the mock's own directory as:output_path.lib/ceedling/defaults.rb,lib/ceedling/config/configurator.rb: the default and its mirroring into:test_runner.MockDetailsfield. The Partial and traditional same-named mock examples are no longer pending.vendor/cmock,vendor/unity: pinned to the upstream PR commits.