Skip to content

fix(coverage): printf spy no longer breaks coverage collection#726

Merged
Chemaclass merged 3 commits into
mainfrom
fix/724-spying-printf-breaks-coverage
Jun 16, 2026
Merged

fix(coverage): printf spy no longer breaks coverage collection#726
Chemaclass merged 3 commits into
mainfrom
fix/724-spying-printf-breaks-coverage

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

Related #724

Spying or mocking the printf builtin in a test silently dropped all coverage data for that test, because coverage's buffer flush used a bare printf that the test double shadowed — the buffered write went to the spy instead of the coverage data file.

💡 Changes

  • Flush the coverage buffer with builtin printf so a user printf spy/mock cannot shadow the write
  • Add a regression test asserting flush_buffer still writes when printf is spied

…data

Spying or mocking the printf builtin in a test shadowed the bare printf
calls in coverage flush_buffer, redirecting the buffered coverage write
to the spy instead of the data file. All coverage for that test was
silently lost. Flush with `builtin printf` to bypass the shadow.

Closes #724
@Chemaclass Chemaclass added the bug Something isn't working label Jun 16, 2026
@Chemaclass Chemaclass self-assigned this Jun 16, 2026
@Chemaclass Chemaclass merged commit 7e6c886 into main Jun 16, 2026
31 checks passed
@Chemaclass Chemaclass deleted the fix/724-spying-printf-breaks-coverage branch June 16, 2026 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants