News for hackers. Stuff that matters.
Re:REPL Driven Design by Jtsummers on Thursday May 28, 2020 @01:02PM (#23339647)
Same 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.

There are no comments on this comment yet.