Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing defined tests in Clojure REPL

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

like image 222
Havvy Avatar asked Apr 17 '11 00:04

Havvy


People also ask

How do I clear my 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.

What is Clojure REPL?

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.

How do I run a test in REPL?

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.


1 Answers

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

like image 99
Stuart Dabbs Halloway Avatar answered Oct 03 '22 16:10

Stuart Dabbs Halloway