← Back to context

Comment by gleenn

9 hours ago

In general, it's a dream to test and refactor Clojure IMHO. Working with mostly static top-level functions, immutability by default, and mocking when necessary with the use of "with-redefs" makes writing tests easy. Also, the immutability makes it hard to break shared copies of memory which seemed to plague my earlier tangos with large Java code bases and standard OOP practices.

most people I know eschew the use of with-redefs for testing because it's hard to verify that the testing environment is configured correctly as the codebase changes (but otherwise I second the points about immutability by default, and static/pure functions!)

  • Agreed - concretely with-redefs forces single threaded test execution. So eg you can’t use the eftest multithreaded mode.

    Explicit dynamic bindings are better if you need something like this since those are thread local.