Skip to content

Drive the untested commands through specs - #2173

Merged
bbatsov merged 4 commits into
masterfrom
test/cover-commands
Aug 25, 2026
Merged

Drive the untested commands through specs#2173
bbatsov merged 4 commits into
masterfrom
test/cover-commands

Conversation

@bbatsov

@bbatsov bbatsov commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Stacked on #2172 - merge that one first.

The suite covers the machinery under the commands exhaustively and the commands themselves almost not at all: 42 of the 98 functions it never entered were interactive, including projectile-find-file. Both bugs found this week were wiring bugs in exactly that layer, with every layer beneath them already covered.

Fourteen commands now have a spec asking only whether they reach their destination - the find-file family, kill-buffers, next-project-buffer, switch-open-project, and the seven keys the reviewable replace buffer is actually driven with.

Also commits the measurement itself as dev/function-coverage.el, so this is repeatable rather than a number I quote once. It advises every defun, runs the suite, and writes a HIT/MISS list; the useful property is that the MISS list shrinks, not the percentage.

88.3% -> 90.0%, 98 never entered -> 84.

@bbatsov
bbatsov changed the base branch from test/cover-recent-additions to master August 25, 2026 04:55
There was no way to answer "what does the suite never touch", so the
question kept being answered by grepping for names, which over-reports.
This advises every defun in projectile.el, runs the suite, and reports
what was never entered.

No external dependency and nothing to install; it is a `-S' form away
from an ordinary test run.  The report is what matters rather than the
percentage: a MISS means nothing exercises that code at all, and the
useful property is that the list shrinks.
The suite covered the machinery under the commands exhaustively and the
commands themselves almost not at all - 42 of the 98 functions it never
entered were interactive, `projectile-find-file' among them.  That is not
a theoretical gap: both bugs found this week were wiring bugs in exactly
that layer, with everything beneath them already covered.

Fourteen commands now have one, asking only whether each reaches its
destination: the find-file family, kill-buffers and next-project-buffer,
switch-open-project, and the seven keys the reviewable replace buffer is
actually driven with (toggle, toggle-file, the file/match navigation,
set-replacement, quit).

Function coverage 88.3% -> 90.0%, 98 functions never entered -> 84.
CI failed on Emacs 30.2 where the same commit passed locally, in a spec I
had not touched: `projectile-default-compilation-command' asserts on
`(point)', so it depends on whatever buffer happens to be current, and my
`projectile-next-project-buffer' spec called `set-buffer' outside
`save-current-buffer'.

Whether that bites is decided by spec order and by which buffers the
sandbox cleanup kills, which is exactly why it showed on one Emacs and
not another.  Two more of the same came from the render-throttling specs
seeding the results buffer in `before-each'.

dev/buffer-leaks.el is the scanner that found them; it reported eleven
specs before this change and eight after.  The rest are the session and
tab-bar tests, which genuinely rearrange windows and want separate care.
Buttercup is a test-time dependency, not a build one, so `dev/' failed
`compile --warnings-as-errors' on an unknown function.
@bbatsov
bbatsov force-pushed the test/cover-commands branch from 1dc2ed7 to 4978da1 Compare August 25, 2026 04:56
@bbatsov
bbatsov merged commit b533e1f into master Aug 25, 2026
10 checks passed
@bbatsov
bbatsov deleted the test/cover-commands branch August 25, 2026 08:07
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