diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-03 17:58:42 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-03 17:58:42 -0500 |
| commit | dbce94b38f3267e59b015880d34ff31104126e47 (patch) | |
| tree | 83129465a65f221aca882cdffe36384fd1ff1aa3 /tests/test-dev-fkeys--f6-test-runner.el | |
| parent | 2a60405ac28c12ec63fac2032b8f87599ebfc6b6 (diff) | |
| download | dotemacs-dbce94b38f3267e59b015880d34ff31104126e47.tar.gz dotemacs-dbce94b38f3267e59b015880d34ff31104126e47.zip | |
feat(dev-fkeys): propagate prefix-arg to projectile through F4 / F6
I had four call sites passing literal nil to `projectile-compile-project' / `projectile-run-project' / `projectile-test-project'. The literal nil ignored whatever prefix arg the user gave. So `C-u F4 → Compile' or `C-u F6 → All tests' didn't actually force projectile's re-prompt — the prefix arg got swallowed at our wrapper layer.
Switched all four to `current-prefix-arg':
- `cj/--f4-dispatch' — `compile-only' and `run-only' actions.
- `cj/f4-compile-only' — the C-F4 fast path's compiled-project branch.
- `cj/f6-test-runner' — the "All tests" menu entry.
Use case: when projectile's cached cmd is wrong (typo, stale, or whatever), `C-u' on any of these forces projectile to re-prompt instead of replaying the bad cmd silently. The compile-and-run and clean-rebuild paths still pass nil to their chained projectile calls because those run inside an async `compilation-finish-functions' hook, where `current-prefix-arg' has already reverted to nil. Refining those would need to capture the prefix at entry and thread it through; left for later.
TDD: 4 new tests (one per call site) bind `current-prefix-arg' to t and verify projectile receives t. Each test failed against the literal-nil version and passes against `current-prefix-arg'.
Diffstat (limited to 'tests/test-dev-fkeys--f6-test-runner.el')
| -rw-r--r-- | tests/test-dev-fkeys--f6-test-runner.el | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test-dev-fkeys--f6-test-runner.el b/tests/test-dev-fkeys--f6-test-runner.el index 23129539..eb9cec5e 100644 --- a/tests/test-dev-fkeys--f6-test-runner.el +++ b/tests/test-dev-fkeys--f6-test-runner.el @@ -49,6 +49,21 @@ (cj/f6-test-runner) (should (= calls 1))))) +(ert-deftest test-dev-fkeys-f6-test-runner-all-tests-propagates-prefix-arg () + "Normal: choosing 'All tests' forwards `current-prefix-arg' to +projectile-test-project so `C-u F6 → All tests' forces a re-prompt." + (let ((seen-arg 'unset) + (current-prefix-arg t)) + (cl-letf (((symbol-function 'completing-read) + (lambda (&rest _) "All tests")) + ((symbol-function 'projectile-test-project) + (lambda (arg) (setq seen-arg arg))) + ((symbol-function 'cj/--f4-project-root) (lambda () "/p/")) + ((symbol-function 'cj/--f6-current-file-tests-impl) + (lambda (_f _r) nil))) + (cj/f6-test-runner) + (should (eq seen-arg t))))) + (ert-deftest test-dev-fkeys-f6-test-runner-current-file-routes-to-impl () "Normal: choosing 'Current file's tests' invokes the orchestrator with the buffer file and projectile root. |
