-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run test at point #5
Comments
This makes sense. For me, usually I use FiveAM, and before a coding session I set up a Slite run with something like But I think it makes sense to have a run-test-at-point. I wonder how we could make this work on both parachute and fiveam? Maybe make a reasonable guess looking up the tests from both fiveam and parachute? |
I forgot to explain the use case: when the test suite is slow and you are working on the tests iteratively. You don't want to run the full suite every time because it takes too long. About framework detection, maybe we could infer the suite based on the top-level first expression? Untested: (defun slite-run-at-point (&optional raw-prefix-arg)
"See `sly-compile-defun' for RAW-PREFIX-ARG."
(interactive "P")
(call-interactively 'sly-compile-defun)
(slite-run
(cl-flet ((top-level-first-sexp
()
(ignore-errors
(save-excursion
(goto-char (car (sly-region-for-defun-at-point)))
(down-list 1)
(car (last (sly-parse-context (read (current-buffer)))))))))
(prin1-to-string
`(,(cond
((let ((case-fold-search t))
(string-match-p "define-test$" (symbol-name (top-level-first-sexp)) ))
'parachute:test)
(t
'fiveam:run))
,(let ((name (sly-parse-toplevel-form)))
(if (symbolp name)
`',(intern (sly-qualify-cl-symbol-name name))
name))))))) |
A feature I miss with Parachute (I haven't tried FiveAM) is the ability to easily run the single test I'm writing (or "the test at point"). Unless I'm missing something, the quickest way is to switch to a repl and run
But if you do this a lot the back and forth switching quickly gets tiring...
Enters Slite with its convenient interface. Turns out that what I want fits in this very short function:
Now place the point on any test form and call
slite-run-at-point
.What do you think?
The text was updated successfully, but these errors were encountered: