When developing code, it is sometimes effective to focus on a single failing test, rather than running all tests in a namespace. This can be the case when running the tests takes some amount of time, or when running the tests produces a large volume of failures. The best option for running a single test with fixtures currently is `test-vars` ala:
However, this has the following issues:
No test reporting feedback such as you get with run-tests (on success, there is no output)
Need to specify var (not symbols) wrapped in a vector
Proposed: A new macro `run-test` that specifies a single symbol and does the same test reporting you get with `run-tests`. Usage:
Screened: Alex Miller
As far as I can tell, this is basically the same intent as CLJ-866 which was completed in Clojure 1.6. You can do this now with test-vars:
I think there is some advantage to being able to run the tests using is symbol, not its var. Further, the change I've suggested also returns the same kind of data that `run-tests` does.
Some changes needed on this patch before I will prescreen it:
Patch should be squashed to a single commit
Commit message in patch should start with "CLJ-1908"
Change run-test* to run-test-var
The docstring for run-test-var should be: "Run the test in Var v with fixtures and report." Kill the "called from" sentence".
The first sentence of the docstring for run-test should be: "Runs a single test in the current namespace." Remove "This is meant to be invoked interactively, from a REPL.". Last sentence is ok.
In run-test, replace (ns-resolve ns test-symbol) with the simpler (resolve test-symbol).
Thanks for the input; I'll have an updated patch shortly.
Updated patch, squashed and reflecting all of Alex's comments.