Usually it's a matter of renaming "comment" to "deftest", and move some things around. Not sure how/why it would be different when using a LLM compared to doing it manually.
Usually it's a matter of renaming "comment" to "deftest", and move some things around. Not sure how/why it would be different when using a LLM compared to doing it manually.
This is all in the file as saved to your version control:
(defn greet [name]
(-> (str "Hello, " name "!")
println))
(comment
(greet "worldsayshi"))
It's 90% of the way to being a test already, just from the typical workflow.That's exactly the kind of misunderstanding parent was talking about :)
Why start somewhere else than your editor, if it's already hooked up to the REPL? When I launch my REPL, I don't think it even accepts stdin, because there is no reason it has to.
It is easy to start creating objects in the repl (say if you are testing an API) and work with those created objects in the repl, one step at a time. You are able to observe the behaviour of the objects every step of the way. This gives you a much better idea when you are writing the functions (usually copy-pasting from repl) in the editor.
I am sure it can be done from the editor itself. (say using the 'comment' block in clojure). It is just matter of preference.
When testing against an LLM you probably want to mock its responses for tests. Which is quite doable by copy-pasting its responses. I'm just curious what the "best" workflow is.
1. Write a function that returns a LLM response
2. Play around with this function in a `comment` block, highlighting what I'm testing
3. If I find a response I'd like to "cement"/save and use for testing, Conjure (what I use to connect to the REPL) has a command that is basically "evaluate what's highlighted in the editor with whatever that returns when evaluated", so that basically copy-pastes the return value into the editor
4. Move it into a test somewhere
Not sure there is a better or faster workflow, from deciding "Hmm I want to test against this in the future" to "make test checks this" takes something like 2 minutes with a workflow like this.