<feed xmlns='http://www.w3.org/2005/Atom'>
<title>dotemacs/tests/test-coverage-core--command.el, branch main</title>
<subtitle>My Emacs configuration
</subtitle>
<id>https://git.cjennings.net/dotemacs/atom?h=main</id>
<link rel='self' href='https://git.cjennings.net/dotemacs/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://git.cjennings.net/dotemacs/'/>
<updated>2026-05-04T01:11:49+00:00</updated>
<entry>
<title>refactor: invoke git via argv in coverage diff helpers</title>
<updated>2026-05-04T01:11:49+00:00</updated>
<author>
<name>Craig Jennings</name>
<email>c@cjennings.net</email>
</author>
<published>2026-05-04T01:11:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.cjennings.net/dotemacs/commit/?id=570b91b74ac981d392f1724d6011d0558b7150c2'/>
<id>urn:sha1:570b91b74ac981d392f1724d6011d0558b7150c2</id>
<content type='text'>
`coverage-core.el` was running git through `shell-command-to-string`, which has two practical problems for central tooling: shell parsing surfaces (especially the `$(git merge-base ...)` substitution), and silent failure modes when git exits non-zero (the bad output just becomes empty parse results).

I extracted three small helpers. `cj/--coverage-git-string` runs git via `process-file` against a temp buffer and signals `user-error` on non-zero exit, with the argv, status, and trimmed output included. `cj/--coverage-git-merge-base` does its own `git merge-base HEAD &lt;base&gt;` invocation. `cj/--coverage-git-diff` is the diff wrapper that always appends `--unified=0`.

`cj/--coverage-changed-lines` now uses `pcase` over the scope symbol and composes the helpers. Branch-vs-main and branch-vs-parent compute the merge-base in a separate call before running `git diff &lt;merge-base&gt;..HEAD`, with no shell substitution involved.

One behavior change is worth flagging. A git failure used to disappear into an empty hash table. It now signals a `user-error` with the failing command, exit status, and git's stderr output.

Tests: I added two argv-boundary cases (working-tree and branch-vs-parent both assert the exact argv list seen) plus a non-zero-exit case that asserts the user-error path. The existing `test-coverage-core--command.el` smoke test gets its `shell-command-to-string` stub upgraded to a `process-file` stub.
</content>
</entry>
<entry>
<title>feat(coverage): add cj/coverage-report command and F7 binding</title>
<updated>2026-04-23T06:11:54+00:00</updated>
<author>
<name>Craig Jennings</name>
<email>c@cjennings.net</email>
</author>
<published>2026-04-23T06:11:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.cjennings.net/dotemacs/commit/?id=fe142a8d9268c36b6b8fd363e60cb587dded1602'/>
<id>urn:sha1:fe142a8d9268c36b6b8fd363e60cb587dded1602</id>
<content type='text'>
Completes the coverage v1 user-facing path. cj/coverage-report is the interactive entry point:

1. Resolves the backend for the current project (honoring cj/coverage-backend from .dir-locals.el).
2. Prompts for a git-diff scope via completing-read (Working tree, Staged, Branch vs parent, Branch vs main).
3. Reads the cached simplecov report, intersects with the diff, renders records into a *Coverage Report* buffer.
4. If the report doesn't exist, prompts to run coverage first. With a prefix argument, re-runs regardless.

The report buffer uses cj/coverage-report-mode, a compilation-mode derivative. Uncovered-line entries are formatted as path:line: uncovered so the standard gnu compilation-error-regexp-alist picks them up for next-error navigation. That means M-g n, M-g p, and C-x backtick walk through uncovered lines from any buffer without switching focus.

F7 is bound to the command globally, matching the F-key layout ticket's design (F4 compile+run, F5 debug, F6 test, F7 coverage).

Added to init.el: (require 'coverage-core) + (require 'coverage-elisp).

Tests cover the pure scope-label helpers (label to symbol, symbol to label, roundtrip) plus a smoke test that exercises the full command with stubbed backend, stubbed completing-read, stubbed shell-command-to-string, and a prepared simplecov fixture.

Coverage v1 is now functionally complete: make coverage produces the report, F7 drives the interactive flow.
</content>
</entry>
</feed>
