diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-03 21:32:09 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-03 21:32:09 -0500 |
| commit | 250db085bd2a2860636bb96c215dcbaa5efe91e9 (patch) | |
| tree | 2d93e27ccd66b6048a1c21c88b87c3e114c20305 /tests/test-dev-fkeys--projectile-around-revert.el | |
| parent | 2f8d8989856073cbed5f9159d02089903bc5343e (diff) | |
| download | dotemacs-250db085bd2a2860636bb96c215dcbaa5efe91e9.tar.gz dotemacs-250db085bd2a2860636bb96c215dcbaa5efe91e9.zip | |
test: re-point projectile revert tests at the decision helper
The legacy `cj/--projectile-revert-on-fail` wrapper and `cj/--projectile-revert-state` global were removed when the closure-based revert refactor landed (commit 2f8d898). The corresponding tests in `test-dev-fkeys--projectile-revert-on-fail.el` and the around-revert / capture-cmd files still referenced the legacy symbols, so 7 tests had been failing on `main` since that commit.
I re-pointed each test at `cj/--projectile-revert-state-on-fail`, the pure decision helper that the closure-based hook delegates to. Each test now passes the captured `state` plist as an explicit argument instead of binding the old global. Test names updated to match the new target.
I dropped two tests that no longer have a target. `revert-on-fail-clears-state` was specific to the wrapper clearing the global on completion, and there is no global to clear now. `revert-on-fail-removes-itself` was specific to the wrapper removing itself from `compilation-finish-functions`. The closure-based hook removes itself differently and is covered by the buffer-local hook tests in `test-dev-fkeys--projectile-around-revert.el`.
The around-revert and capture-cmd tests also lost their `cj/--projectile-revert-state nil` let-bindings since that variable no longer exists.
21 projectile-related tests pass together.
Diffstat (limited to 'tests/test-dev-fkeys--projectile-around-revert.el')
| -rw-r--r-- | tests/test-dev-fkeys--projectile-around-revert.el | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/tests/test-dev-fkeys--projectile-around-revert.el b/tests/test-dev-fkeys--projectile-around-revert.el index 012c4258..229ff723 100644 --- a/tests/test-dev-fkeys--projectile-around-revert.el +++ b/tests/test-dev-fkeys--projectile-around-revert.el @@ -5,7 +5,7 @@ ;; to projectile cmd runners. The advice: ;; ;; 1. Captures the prior cached cmd via `cj/--projectile-capture-cmd'. -;; 2. Adds `cj/--projectile-revert-on-fail' to `compilation-finish-functions'. +;; 2. Adds a buffer-local revert hook to `compilation-finish-functions'. ;; 3. Calls ORIG-FN with ARGS so projectile's normal flow proceeds. ;;; Code: @@ -22,7 +22,6 @@ (ert-deftest test-dev-fkeys-projectile-around-revert-invokes-orig-fn () "Normal: advice calls the wrapped function with its args." (let ((calls nil) - (cj/--projectile-revert-state nil) (compilation-finish-functions nil) (projectile-compile-cmd-map (make-hash-table :test 'equal))) (cl-letf (((symbol-function 'cj/--f4-project-root) (lambda () "/p/"))) @@ -34,8 +33,7 @@ (ert-deftest test-dev-fkeys-projectile-around-revert-captures-prior () "Normal: advice captures the prior cmd into the buffer-local hook." - (let ((cj/--projectile-revert-state nil) - (compilation-finish-functions nil) + (let ((compilation-finish-functions nil) (projectile-compile-cmd-map (make-hash-table :test 'equal))) (puthash "/p/" "make build" projectile-compile-cmd-map) (cl-letf (((symbol-function 'cj/--f4-project-root) (lambda () "/p/"))) @@ -55,8 +53,7 @@ (ert-deftest test-dev-fkeys-projectile-around-revert-installs-finish-hook () "Normal: advice adds a buffer-local revert hook to the compilation buffer." - (let ((cj/--projectile-revert-state nil) - (compilation-finish-functions nil) + (let ((compilation-finish-functions nil) (projectile-compile-cmd-map (make-hash-table :test 'equal))) (puthash "/p/" "make build" projectile-compile-cmd-map) (cl-letf (((symbol-function 'cj/--f4-project-root) (lambda () "/p/"))) @@ -74,8 +71,7 @@ (ert-deftest test-dev-fkeys-projectile-around-revert-overlapping-compiles-use-own-state () "Regression: overlapping compiles finishing out of order use their own state." - (let ((cj/--projectile-revert-state nil) - (compilation-finish-functions nil) + (let ((compilation-finish-functions nil) (projectile-compile-cmd-map (make-hash-table :test 'equal)) (roots '("/one/" "/two/"))) (puthash "/one/" "make one" projectile-compile-cmd-map) @@ -115,14 +111,12 @@ "Boundary: no project root → capture is a no-op, orig-fn still runs. The state stays nil so the finish hook will be a no-op too." (let ((calls 0) - (cj/--projectile-revert-state nil) (compilation-finish-functions nil)) (cl-letf (((symbol-function 'cj/--f4-project-root) (lambda () nil))) (cj/--projectile-around-revert 'projectile-compile-cmd-map (lambda (&rest _) (cl-incf calls)))) (should (= calls 1)) - (should (null cj/--projectile-revert-state)) (should-not compilation-finish-functions))) (provide 'test-dev-fkeys--projectile-around-revert) |
