5 ms·
That works in Lisp, too though, but it's easier and faster to run the tests in the REPL, so you get the best of both worlds. When I write Lisp I usually start
by jlarocco 5y ago
That works in Lisp, too though, but it's easier and faster to run the tests in the REPL, so you get the best of both worlds.
When I write Lisp I usually start testing in the REPL, iterate until the test code gets to be a few lines long, and then copy it over to the package's unit tests. Then I can keep iterating on both the test code and the code being tested.
I'll do something like this in the REPL:
(ql:quickload :mylibrary.test) (mylibrary.test:my-test-function)
"mylibrary.test" will depend on "mylibrary", so quickload will load both packages when they've been changed, and I can re-run the test quickly using Alt-P to call up the previous REPL input.
And the REPL is also really great for "what if" testing that you may not want to keep forever, like, "What happens if I call this function with an invalid parameter?" Hopefully there's a test for that, but it's often a lot faster to just call the function and see what happens rather than go dig through the test code and lose your focus.