aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRadon Rosborough <radon@intuitiveexplanations.com>2024-09-25 19:28:33 -0700
committerGitHub <noreply@github.com>2024-09-25 19:28:33 -0700
commit302a41c86c5ffe1e8f50cbe156e0f7b21835c02c (patch)
tree3288feb6701e069e967148b079ad0a5a5369d71d /test
parent9343b86f7c6c51866bb9e682dbc9c3233748aecc (diff)
Use --stdin-filename conditionally for mix-format (#322)
Closes #319 because this does the same thing but it transparently works for all versions of mix-format.
Diffstat (limited to 'test')
-rwxr-xr-xtest/formatters/apheleia-ft.el14
1 files changed, 11 insertions, 3 deletions
diff --git a/test/formatters/apheleia-ft.el b/test/formatters/apheleia-ft.el
index 0409606..b10fe87 100755
--- a/test/formatters/apheleia-ft.el
+++ b/test/formatters/apheleia-ft.el
@@ -323,6 +323,12 @@ returned context."
(interactive
(unless (or current-prefix-arg noninteractive)
(list (completing-read "Formatter: " (apheleia-ft--get-formatters)))))
+ ;; Yeah this code is super duplicative and really we should just
+ ;; refactor the original `apheleia--run-formatter-process' to be
+ ;; testable and run that instead. It would better ensure that
+ ;; behavior is the same between the test suite and the actual
+ ;; runtime. That is a future project. Or it could be a now project
+ ;; if you, dear reader, are feeling up to it.
(dolist (formatter (or formatters (apheleia-ft--get-formatters)))
(dolist (in-file (apheleia-ft--input-files formatter))
(let* ((extension (file-name-extension in-file))
@@ -337,15 +343,17 @@ returned context."
(exit-status nil)
(out-file (replace-regexp-in-string
"/in\\([^/]+\\)" "/out\\1" in-file 'fixedcase))
- (exec-path
- (append `(,(expand-file-name
+ (script-dir (expand-file-name
"scripts/formatters"
(file-name-directory
(file-truename
;; Borrowed with love from Magit
(let ((load-suffixes '(".el")))
(locate-library "apheleia"))))))
- exec-path))
+ (exec-path (cons script-dir exec-path))
+ (process-environment
+ (cons (concat "PATH=" script-dir ":" (getenv "PATH"))
+ process-environment))
(display-fname
(replace-regexp-in-string
(concat "^" (regexp-quote