anonimitoraf / exercism.el

Emacs integration for https://exercism.org
GNU General Public License v3.0
32 stars 2 forks source link

Change the run tests function to use the compile command #9

Closed leafarbelm closed 3 months ago

leafarbelm commented 3 months ago

Could you consider modifying the code of exercism-run-tests to use the compile command to make the output more readable?

(async-defun exercism-run-tests ()
  "Runs the tests for the currently selected exercise"
  (interactive)
  (let* ((version (await (exercism--cli-version)))
         (min-version "3.2.0")
         (track-dir (expand-file-name exercism--current-track exercism-directory))
         (exercise-dir (expand-file-name exercism--current-exercise track-dir))
         ;; TODO Maybe use a macro that sets the dir? e.g. (with-current-track ...)
         (default-directory exercise-dir)
         (tests-buffer (get-buffer-create "*exercism-test*")))
    (if (exercism--compare-semvers version #'< min-version)
        (message "[exercism] error: running tests is only supported for CLI version %s and above. You are on %s"
                 min-version version)
      (compile (concat (shell-quote-argument exercism-executable) " test")))))

image

anonimitoraf commented 3 months ago

Oh nice! Wanna make a PR for it? Thanks

leafarbelm commented 3 months ago

Sure, what should we do about the exercism-display-tests-after-run flag, Do you want to keep it? or can we remove it since the compilation buffer always pops up after being called?

anonimitoraf commented 3 months ago

Oh right, yeah we can remove it

leafarbelm commented 3 months ago

Agree, I believe this provides a better user experience. I've just pushed the PR. #10