aboutsummaryrefslogtreecommitdiff
path: root/tests/test-prog-shell--make-script-executable.el
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-prog-shell--make-script-executable.el')
-rw-r--r--tests/test-prog-shell--make-script-executable.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test-prog-shell--make-script-executable.el b/tests/test-prog-shell--make-script-executable.el
index e2bb0e6de..0f220b19b 100644
--- a/tests/test-prog-shell--make-script-executable.el
+++ b/tests/test-prog-shell--make-script-executable.el
@@ -106,6 +106,20 @@
(kill-buffer))
(delete-file temp-file))))
+(ert-deftest test-make-script-executable-non-prog-mode-skipped ()
+ "Boundary: a shebang file visited in a non-prog-mode buffer (a script being
+read, quoted, or reviewed) is NOT silently made executable. The auto-exec hook
+runs on every save globally, so it must only act on actual script buffers."
+ (let ((temp-file (test--create-temp-script "#!/bin/bash\necho hello")))
+ (unwind-protect
+ (with-current-buffer (find-file-noselect temp-file)
+ (text-mode)
+ (should-not (test--file-executable-p temp-file))
+ (cj/make-script-executable)
+ (should-not (test--file-executable-p temp-file))
+ (kill-buffer))
+ (delete-file temp-file))))
+
;;; Edge Cases
(ert-deftest test-make-script-executable-edge-no-buffer-file ()