aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLaura Viglioni <viglionigr@gmail.com>2021-06-29 02:28:41 -0300
committerGitHub <noreply@github.com>2021-06-29 08:28:41 +0300
commite8a3f11df57583ad089a4f00d652c80566ffeb09 (patch)
treea15c8556e9acb7ea27cfd036829f8f8ae4d4ade6 /test
parent7817f2093d8610a8fccf91b141c3535de08a4cc0 (diff)
Add opt params to projectile-run-(async)-shell-cmd (#1675)
Diffstat (limited to 'test')
-rw-r--r--test/projectile-test.el46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/projectile-test.el b/test/projectile-test.el
index 51dd644..eb582d0 100644
--- a/test/projectile-test.el
+++ b/test/projectile-test.el
@@ -1803,6 +1803,52 @@ projectile-process-current-project-buffers-current to have similar behaviour"
(projectile-project-types mock-projectile-project-types))
(expect (projectile--impl-to-test-dir "/bar/src/bar") :to-throw))))
+(describe "projectile-run-shell-command-in-root"
+ (describe "when called directly in elisp"
+ (before-each (spy-on 'shell-command))
+ (describe "when called with all three paramters"
+ (it "expects to call shell-command with the same parameters"
+ (projectile-run-shell-command-in-root "cmd" "output-buffer" "error-buffer")
+ (expect 'shell-command :to-have-been-called-with "cmd" "output-buffer" "error-buffer")))
+ (describe "when called with only one optional paramter"
+ (it "expects to call shell-command with the same parameters"
+ (projectile-run-shell-command-in-root "cmd" "output-buffer")
+ (expect 'shell-command :to-have-been-called-with "cmd" "output-buffer" nil)))
+ (describe "when called with no optional paramters"
+ (it "expects to call shell-command with the same parameters"
+ (projectile-run-shell-command-in-root "cmd")
+ (expect 'shell-command :to-have-been-called-with "cmd" nil nil))))
+ (describe "when called interactively"
+ (before-each (spy-on 'shell-command))
+ (it "expects to be interactive"
+ (expect (interactive-form 'projectile-run-shell-command-in-root) :not :to-be nil))
+ (it "expects to call shell-command with the given command"
+ (funcall-interactively 'projectile-run-shell-command-in-root "cmd")
+ (expect 'shell-command :to-have-been-called-with "cmd" nil nil))))
+
+(describe "projectile-run-async-shell-command-in-root"
+ (describe "when called directly in elisp"
+ (before-each (spy-on 'async-shell-command))
+ (describe "when called with all three paramters"
+ (it "expects to call async-shell-command with the same parameters"
+ (projectile-run-async-shell-command-in-root "cmd" "output-buffer" "error-buffer")
+ (expect 'async-shell-command :to-have-been-called-with "cmd" "output-buffer" "error-buffer")))
+ (describe "when called with only one optional paramter"
+ (it "expects to call async-shell-command with the same parameters"
+ (projectile-run-async-shell-command-in-root "cmd" "output-buffer")
+ (expect 'async-shell-command :to-have-been-called-with "cmd" "output-buffer" nil)))
+ (describe "when called with no optional paramters"
+ (it "expects to call async-shell-command with the same parameters"
+ (projectile-run-async-shell-command-in-root "cmd")
+ (expect 'async-shell-command :to-have-been-called-with "cmd" nil nil))))
+ (describe "when called interactively"
+ (before-each (spy-on 'async-shell-command))
+ (it "expects to be interactive"
+ (expect (interactive-form 'projectile-run-async-shell-command-in-root) :not :to-be nil))
+ (it "expects to call async-shell-command with the given command"
+ (funcall-interactively 'projectile-run-async-shell-command-in-root "cmd")
+ (expect 'async-shell-command :to-have-been-called-with "cmd" nil nil))))
+
;; A bunch of tests that make sure Projectile commands handle
;; gracefully the case of being run outside of a project.
(assert-friendly-error-when-no-project projectile-project-info)