If I don't have a REPL, I often write a lot of little throwaway tests to deal with intermediate bits of the code. They end up being redundant with the real tests. They're often really bad tests, in that they're tightly coupled to implementation details. I should delete them. And I often forget to. Which creates extra maintenance burden for myself and my teammates.
If I do have a REPL, I do all of that extra intermediate verification junk in the REPL. It's often more effective, it's usually less effort, and it always reduces the volume of unnecessary brittle tests in the codebase.
As an idea, maybe we could do... both? Explore at the REPL, and then commit to tests and clean up once you've solidified your approach (i.e. how most Clojurists likely operate).
(some-expression 1 1) ;; => expected result
(some-expression 2 1) ;; => expected result
Then I use a `let` to make changing the variable part easier: (let ((x 1))
(some-expression x 1)) ;; => expected result
(let ((x 2))
(some-expression x 1)) ;; => expected result
;; repeat
Then I turn it into a function: (defun my-fun (x)
(some-expression x 1))
And copy all my REPL experiments into the test suite: (test my-fun-tests
(is (= ?? (my-fun 1)))
(is (= ?? (my-fun 2)))
;; repeat
)
Since I actually tend to use org mode for writing lisp code, most of the first two sections are actually inside a block like: #+BEGIN_SRC: lisp
...
#+END_SRC
So I just have to edit this and turn it into the relevant test suite.