In Clojure, I have decided to move from writing :test
metadata elements to using deftest
. To see that I have written the deftest
correctly, I try reloading and running the tests with a reload in the REPL.
While I don't care about duplicate tests per se, when I remove a test from the source, I would like it removed when I reload the source. Clearing the REPL doesn't remove the tests.
So, How many I remove tests defined via deftest
from the Clojure REPL
If you are running the repl through a terminal window (eg: Terminal. app on MacOS or xterm/aterm/urxvt etc on linux) then you can type Control-L and it should clear the terminal window and give you a new repl prompt.
A Clojure REPL (standing for Read-Eval-Print Loop) is a programming environment which enables the programmer to interact with a running Clojure program and modify it, by evaluating one code expression at a time.
You can run the tests by starting a REPL and then using Tools→REPL→Run Tests in Current NS in REPL - you can assign a shortcut to this action, of course. This will load the namespace containing the tests and any of its dependent namespaces (see here) in the REPL and then execute the tests from that namespace.
clojure.test finds test vars by reflecting on namespaces, so you can use ns-unmap. For full details, see my earlier answer to a similar question
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With