Skip to content

Give FFF fakes every :cmock include setting (#1377) - #1382

Merged
mkarlesky merged 8 commits into
masterfrom
fix/1.2.2-fff-cmock-includes
Oct 30, 2026
Merged

mkarlesky merged 8 commits into
masterfrom
fix/1.2.2-fff-cmock-includes

Conversation

@mkarlesky

Copy link
Copy Markdown
Member

Closes #1377.

Problem

The FFF plugin dropped :cmock include settings that CMock honors, so a fake could fail to compile where a mock of the same header compiles.

  • :includes_c_pre_header and :includes_c_post_header never reached a fake's .c file. The wrapper passed them under names that were never assigned, so they were always nil.
  • :includes_h_pre_orig_header was read only when :includes was unset. Ceedling always sets :includes (its default is [], which Ruby treats as true), so the setting was never read.

Changes

FffCMockWrapper in plugins/fff/lib/fff.rb:

  • Both .c lists now reach the generator.
  • The header's pre list merges :includes and :includes_h_pre_orig_header, removing duplicates, as CMock does.
  • One quoting helper replaces four copies of the same expression and keeps CMock's rule: a name holding < stays as it is, and any other is quoted.
  • A consequence of the fix: CMock adds a :unity_helper_path header to the .c include list. A fake's .c now includes the helper, as a mock's does.
  • The fake's directory is made with FileUtils instead of Rake's helpers, so the wrapper no longer depends on Ceedling having loaded Rake.

Console output follows CMock's verbosity scheme. Ceedling already passes the wrapper CMock's verbosity, through the same config it hands CMock.

  • The line naming each fake's files printed at every verbosity. It now prints only at level 3, CMock's verbose level, and names both files.
  • The announcement keeps CMock's level 2 (normal).
  • At Ceedling's normal verbosity, FFF prints nothing, like CMock. At debug, it prints both lines.

Lint. fff.rb goes from 5 Metrics offenses to 0 and leaves four to-do entries. The backlog drops from 759 offenses to 755.

Docs.

Verification

  • Specs: the new plugins/fff/spec/fff_cmock_wrapper_spec.rb drives the wrapper with Ceedling's :includes default.
    • Before the fix, 6 of its 8 include examples failed: each lost setting, the merge, the quoting, and the Unity helper. The other two are a control and a regression guard.
    • All three verbosity examples failed before the output change.
    • All FFF specs pass, 54 examples.
  • Example: the fff_example build passes, 11 of 11. At normal verbosity it prints no FFF lines; at debug it prints both lines for each fake.
  • Reproduction: the issue's YAML, built by hand and extended with a Unity helper and a fake included through a folder, passes 12 of 12. #include "extra_c.h" lands in both the .c and the .h, and the helper appears in each .c.
  • Repo specs: the unit and integration tiers pass, 5,875 examples with 0 failures.
  • RuboCop: clean.

Left alone

  • With CMock's :subdir set, FFF puts the subdirectory after the include folder, while CMock puts it before. Ceedling does nothing with :subdir itself.
  • FFF's progress lines keep raw puts, as CMock does. Routing them through Ceedling's logging waits for the plugin redesign.

🤖 Generated with Claude Code

mkarlesky and others added 8 commits October 29, 2026 17:55
The wrapper Ceedling swaps in for CMock had no specs. These drive it with
Ceedling's :includes default and read back the fake it writes, one example
per include setting, plus the merge, the quoting, and a Unity helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A fake's source never got :includes_c_pre_header or :includes_c_post_header,
which were passed under names never assigned. Its header never got
:includes_h_pre_orig_header, which was read only when :includes was unset,
and Ceedling always sets :includes. The lists now arrive, and the header's
pre list merges both settings as CMock does. A Unity helper is therefore
included in a fake's source, as in a mock's.

The fake's directory is made with FileUtils, so the wrapper no longer
leans on Rake's DSL mixed into Object.

Closes #1377.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
generate_mock splits its path and its file writes into two helpers, and
the include lists share one quoting helper, so the wrapper carries no
Metrics offenses. The fakes it writes are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fff.rb leaves four Metrics entries. The FFF wrapper spec joins
BlockLength beside the plugin's other specs. The backlog drops from 759
offenses to 755.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An include list entry is tested with match?, as before and as CMock does,
so an entry YAML reads as a symbol still passes through. The wrapper
spec keeps its repository path local rather than a top-level constant.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A fake prints nothing for errors only or warnings, announces itself at
normal verbosity as CMock announces a mock, and names its files only at
verbose. The examples no longer stub $stdout, so silence is checked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each fake's file line printed at every verbosity. It now prints only at
CMock's verbose level and names both files, and the announcement keeps
CMock's normal level, so a fake reports itself as a mock does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The FFF page's CMock example nested its settings under :mock_prefix and
left one list empty. It is corrected, and a table shows where each
include setting puts its headers in a fake.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mkarlesky mkarlesky added the bug label Oct 29, 2026
@github-actions

Copy link
Copy Markdown

CI summary · f4274f5 · ✅ 25/25 jobs passed · nearest baseline 4f6f1b6 (master)

⚠️ Windows 3.0 units: pending 1 → 2
⚠️ Windows 3.1 units: pending 1 → 2
⚠️ Windows 3.2 units: pending 1 → 2
⚠️ Windows 3.3 units: pending 1 → 2
⚠️ Windows 3.4 units: pending 1 → 2

Tests (Linux 3.3) Examples Failures Pending
units 5297 (+318) 0 0
integration 578 (+67) 0 19
system 406 (+26) 0 35
Coverage Lines Δ
units 90.56% ▲1.03
integration 51.55% ▲0.94
system 83.85% ▲0.16
combined 98.52% ▲0.11

Diff coverage: 100.00% (23/23 changed lines).

RuboCop to-do Count Δ
offenses 755 —
cops 10 —
All legs (examples / failures / pending)
Leg units integration system
Linux 3.0 5297 / 0 / 0 578 / 0 / 19 406 / 0 / 35
Linux 3.1 5297 / 0 / 0 578 / 0 / 19 406 / 0 / 35
Linux 3.2 5297 / 0 / 0 578 / 0 / 19 406 / 0 / 35
Linux 3.3 5297 / 0 / 0 578 / 0 / 19 406 / 0 / 35
Linux 3.4 5297 / 0 / 0 578 / 0 / 19 406 / 0 / 35
Linux 3.5 5297 / 0 / 0 578 / 0 / 19 406 / 0 / 35
Windows 3.0 5295 / 0 / 2 577 / 0 / 19 406 / 0 / 62
Windows 3.1 5295 / 0 / 2 577 / 0 / 19 406 / 0 / 62
Windows 3.2 5295 / 0 / 2 577 / 0 / 19 406 / 0 / 62
Windows 3.3 5295 / 0 / 2 577 / 0 / 19 406 / 0 / 62
Windows 3.4 5295 / 0 / 2 577 / 0 / 19 406 / 0 / 62
macOS 3.1 5297 / 0 / 0 578 / 0 / 19 406 / 0 / 51
macOS 3.2 5297 / 0 / 0 578 / 0 / 19 406 / 0 / 51
macOS 3.3 5297 / 0 / 0 578 / 0 / 19 406 / 0 / 51
macOS 3.4 5297 / 0 / 0 578 / 0 / 19 406 / 0 / 51
macOS 3.5 5297 / 0 / 0 578 / 0 / 19 406 / 0 / 51
Jobs

@mkarlesky
mkarlesky merged commit 64f33db into master Oct 30, 2026
26 checks passed
@mkarlesky
mkarlesky deleted the fix/1.2.2-fff-cmock-includes branch October 30, 2026 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FFF plugin drops :cmock include settings from generated fakes

1 participant