Fork me on GitHub
#conjure
<
2021-03-31
>
Matsu09:03:25

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.

>> (out) Old println
>> (out) New println
When the code only has the new one

Olical10:03:23

So <prefix>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.

Olical10:03:35

You may want <prefix>eb to eval the code in your buffer (not on disk)

🙌 3
adambrosio19:03:45

@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 ?

adambrosio19:03:36

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.

adambrosio19:03:31

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

adambrosio19:03:34

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

Olical14:04:48

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.

Olical14:04:00

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.

Olical14:04:44

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?

Olical14:04:10

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

adambrosio18:04:54

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