aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test-dev-fkeys--f4-compile-only.el12
-rw-r--r--tests/test-dev-fkeys--f4-dispatch.el20
-rw-r--r--tests/test-dev-fkeys--f6-test-runner.el15
3 files changed, 47 insertions, 0 deletions
diff --git a/tests/test-dev-fkeys--f4-compile-only.el b/tests/test-dev-fkeys--f4-compile-only.el
index b0eec367..815aa097 100644
--- a/tests/test-dev-fkeys--f4-compile-only.el
+++ b/tests/test-dev-fkeys--f4-compile-only.el
@@ -36,6 +36,18 @@
(cj/f4-compile-only)
(should (= calls 1))))))
+(ert-deftest test-dev-fkeys-f4-compile-only-propagates-prefix-arg ()
+ "Normal: on a compiled project, `current-prefix-arg' is forwarded to
+projectile-compile-project so `C-u C-F4' forces a re-prompt."
+ (test-dev-fkeys-co--with-project '("go.mod")
+ (let ((seen-arg 'unset)
+ (current-prefix-arg t))
+ (cl-letf (((symbol-function 'cj/--f4-project-root) (lambda () root))
+ ((symbol-function 'projectile-compile-project)
+ (lambda (arg) (setq seen-arg arg))))
+ (cj/f4-compile-only)
+ (should (eq seen-arg t))))))
+
(ert-deftest test-dev-fkeys-f4-compile-only-interpreted-project-skips-compile ()
"Normal: on an interpreted project, projectile-compile-project does not run."
(test-dev-fkeys-co--with-project '("pyproject.toml")
diff --git a/tests/test-dev-fkeys--f4-dispatch.el b/tests/test-dev-fkeys--f4-dispatch.el
index 774daebf..0bf667a7 100644
--- a/tests/test-dev-fkeys--f4-dispatch.el
+++ b/tests/test-dev-fkeys--f4-dispatch.el
@@ -23,6 +23,26 @@
(cj/--f4-dispatch 'compile-only)
(should (= calls 1)))))
+(ert-deftest test-dev-fkeys-dispatch-compile-only-propagates-prefix-arg ()
+ "Normal: 'compile-only forwards `current-prefix-arg' to
+projectile-compile-project so `C-u F4 → Compile' forces a re-prompt."
+ (let ((seen-arg 'unset)
+ (current-prefix-arg t))
+ (cl-letf (((symbol-function 'projectile-compile-project)
+ (lambda (arg) (setq seen-arg arg))))
+ (cj/--f4-dispatch 'compile-only)
+ (should (eq seen-arg t)))))
+
+(ert-deftest test-dev-fkeys-dispatch-run-only-propagates-prefix-arg ()
+ "Normal: 'run-only forwards `current-prefix-arg' to
+projectile-run-project."
+ (let ((seen-arg 'unset)
+ (current-prefix-arg t))
+ (cl-letf (((symbol-function 'projectile-run-project)
+ (lambda (arg) (setq seen-arg arg))))
+ (cj/--f4-dispatch 'run-only)
+ (should (eq seen-arg t)))))
+
(ert-deftest test-dev-fkeys-dispatch-run-only-calls-projectile-run ()
"Normal: 'run-only routes to projectile-run-project."
(let ((calls 0))
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.