conjure

:neovim:+:clj: https://github.com/Olical/conjure - If you're enjoying Conjure and want to say thanks: https://github.com/users/Olical/sponsorship :smile: (alt https://conjure.fun/discord)
Matsu 2021-03-31T09:37:25.020600Z

I'm not quite sure if I'm doing something wrong here but after evaluating forms inside my namespace, after I change then and run <leader>ef to evaluate the whole file, I'm getting some stale outputs, which seem to be using some of the old code. e.g.

&gt;&gt; (out) Old println
&gt;&gt; (out) New println
When the code only has the new one

Olical 2021-03-31T10:46:23.020900Z

So &lt;prefix&gt;ef will eval the file from disk, not what's visible in your buffer. If you haven't saved yet you'll have some in memory state from your form evals but the ef will eval the old version from disk.

Olical 2021-03-31T10:46:35.021100Z

You may want &lt;prefix&gt;eb to eval the code in your buffer (not on disk)

🙌 1
adambros 2021-03-31T19:34:45.026100Z

@olical I use https://github.com/fulcrologic/fulcro-spec for testing, and it has a deftest wrapper that takes a string instead of a var symbol ie: (specification "thing under test" ,,,) and extracting the test var breaks when there is no symbol but a string I’ve written a command that essentially evals the root form surrounded with parenthesis, ie ((specification "blah" ,,,)) (note in my case i’m calling kaocha.repl/run as workaround for https://github.com/Olical/conjure/issues/188) I was then wondering why it’s currently implemented by sending the var to clojure.test/test-vars ?

Olical 2021-04-01T14:48:48.030Z

Not sure I really understand the question, it seems like you need a way to run a fulcro spec test under the cursor? Which is a different use case to t/deftest imo? I could probably add support for it though? And I pass it to test-vars because that's a nice way to run Clojure tests, I think that's pretty normal? Maybe not for fulcro's tests, but I'm afraid I've never used those. Again, support can probably be added somehow.

Olical 2021-04-01T14:50:00.030200Z

wrt the second question, I decided not to do two things when you requested one because I'd rather a boring surprise to an exciting one. If you have a change in your code and you definitely don't want that evaluated yet (you wanna test the old version in memory) then you'd have no way to do that. I'd be complecting eval and test, I'd rather those were separate while allowing users to create their own combined mappings if they so wish.

Olical 2021-04-01T14:50:44.030400Z

And I honestly didn't think of just executing the test, from my understanding the "right" way to do it is test-vars, otherwise you don't get the setup/teardown I think?

Olical 2021-04-01T14:51:10.030600Z

So the executing of the test like a function is more legacy support?

adambros 2021-04-01T18:12:54.032Z

I guess your reasoning makes sense, so it’ll be my own mapping… extracting the test var from the string would involve calling a fulcro-spec function… not sure if that’s worth generalizing when it’s a one off

adambros 2021-03-31T19:36:36.026400Z

additional question: it initially surprised me that running the current test did not evaluate the test contents, so I would be running the older test instead of what was in the buffer/file.

adambros 2021-03-31T19:38:31.026600Z

changing it to what i’m doing above, ((deftest f,,,)) would evaluate the test so i’m always running what’s in my buffer, instead of having to evaluate the test to refresh it and then run it

adambros 2021-03-31T19:39:34.026800Z

(but that might not be the preferred behavior? not sure, which is why i’m asking)