Drive the untested commands through specs - #2173
Merged
Merged
Conversation
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
force-pushed
the
test/cover-commands
branch
from
August 25, 2026 04:56
1dc2ed7 to
4978da1
Compare
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.
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 everydefun, 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.