4 ms·
My REPL sessions tend to evolve into tests.
by whateveracct 6y ago
My REPL sessions tend to evolve into tests.
- Jtsummers 6y agoSame here. I start with something like: (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.