diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-09 15:22:20 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-09 15:22:20 -0500 |
| commit | cdda0a01decb7dc61c71d830823a2ba36207306d (patch) | |
| tree | eb15d55362d5f2c273f9cc29d8156aa35c663753 /modules/user-constants.el | |
| parent | 7ad613f96380319c037f367a1b6b1beda03846ca (diff) | |
| download | dotemacs-cdda0a01decb7dc61c71d830823a2ba36207306d.tar.gz dotemacs-cdda0a01decb7dc61c71d830823a2ba36207306d.zip | |
refactor(tests): extract shared buffer-cleanup and fake-vterm helpers
Eight test files across the ai-vterm and vterm-toggle suites each shipped a small variant of the same cleanup loop: walk `buffer-list`, kill any buffer whose name starts with a given prefix. Each file also re-implemented the `(string-prefix-p ...)` check inline. One file additionally had its own fake-vterm-mode-buffer constructor for tests that needed `cj/--vterm-toggle-buffer-p` to fire.
I pulled the shared logic into `tests/testutil-vterm-buffers.el`:
- `cj/test--kill-buffers-matching-prefix` is the primitive.
- `cj/test--kill-claude-buffers` and `cj/test--kill-test-vterm-buffers` are thin wrappers for the two prefixes that actually appear.
- `cj/test--make-fake-vterm-buffer` constructs a buffer with `major-mode` set to `vterm-mode` without launching a real vterm process.
Each affected test file now `(require 'testutil-vterm-buffers)` and calls the shared helpers directly. `test-vterm-toggle--buffer-filter.el` keeps a 3-line wrapper that calls both kill helpers in sequence (the only place that needs both prefixes). Net diff: -116 / +72 across 8 test files, plus ~30 lines in the new testutil. Roughly -45 lines after the abstraction is paid for.
No behavior change. 80 ai-vterm tests, 15 vterm-toggle tests, 15 cj-window-geometry tests all pass. Full make test green.
Diffstat (limited to 'modules/user-constants.el')
0 files changed, 0 insertions, 0 deletions
