Fork me on GitHub
#conjure
<
2021-03-01
>
mynomoto19:03:48

Is there a command to run a test using conjure? As in a single test defined by deftest.

Olical19:03:57

<prefix>tc for "test current" by default

Olical19:03:59

Should do it!

mynomoto19:03:02

Cool, thanks! Is there a mark version for that?

Olical19:03:54

Nope, I'm afraid that's just eval at mark. You could set an eval at mark to call a specific form that executes your tests though. Or add your own mapping that goes to the mark, runs the test and hops back? I could look into adding a generic mapping for this but not sure how it'd fit in with the others :thinking_face:

mynomoto19:03:06

I'm also wondering about that. So what I want is to be able to run an specific test after changing other parts of the code (same use as the eval at mark). But tests do not work in the same way and more setup is necessary. I would argue that it would be good for developer ergonomics even if this is not a general thing (I don't think that every command should have a eval at mark version)

dharrigan20:03:57

If, like me, you perfer to use clojure-expectations, , you may find this useful...

dharrigan20:03:59

let g:conjure#client#clojure#nrepl#test#current_form_names = ['deftest', 'defexpect']

dharrigan20:03:18

So that Conjure picks up defexpect to run tests

mynomoto20:03:43

That is cool, I will add to my config. I have been years since I used expectations, currently I use a plain deftest and the nubank/matcher-combinators` library for useful machers.

mynomoto20:03:13

I kind of like named tests at least sometimes.

mynomoto17:03:22

I possible improvement would be eval the test form before running the test, I found surprising that it ran the version without changes of the test form.

Olical14:03:56

I tried to avoid any sort of automatic eval since it could cause HUGE problems for people, it's in the realms of dangerous depending on what you're doing. Being able to run a test, then eval, then test again to see changes can be useful too.

Olical14:03:24

There's no one solution that fits everyone for this sort of thing, so I try to go with the safer option then let users add custom mappings that do this sort of thing where required.

mynomoto14:03:27

I understand the tradeoffs, maybe adding docs on how to create custom mappings composing commands would help.

Olical14:03:04

Hmm, maybe, although that's kinda just normal vim things. Like nmap <localleader>G :ConjureLogResetSoft<cr>:ConjureEvalCurrentForm<cr> gives you a mapping that resets the log before each eval

Olical14:03:27

There's nothing Conjure specific here, but I could maybe provide some examples? Or even a wiki page that people stick their interesting config in

mynomoto14:03:42

Yeah, I think that would help. Usually there are many ways to do things in in vimland depending on what the plugin exposes and not every vim user knows how to customize things on their own.

Olical14:03:19

I just realised the command to run the test under the cursor had an s on the end, making it sound like it ran many tests, not one. I've just fixed that on develop, so it'll be nmap <localleader>T :ConjureEvalRootForm<cr>:CljRunCurrentTest<cr> to get the behaviour you want, although you probably want to do this buffer local under a filetype autocmd.

mynomoto15:03:14

Buffer local under a filetype autocmd is the sort of thing that I think could help people. I know that is not directly conjure related but it helps using conjure the way it should be used.

mynomoto15:03:04

I learned almost everything I know about configuring vim by copying other people configs and then trying to understand how that works. Certainly not optimal but gets the job done. Nice examples help a lot for that.

Olical15:03:15

Yeah I get that, makes sense. I can try to find time to do some more general documentation like that, I'm just already kinda stretched to my breaking point with work/life/oss, so no promises I'm afraid. If people write up posts / wiki entries I'll gladly share them around, but I'm struggling to find time for myself at the moment.

mynomoto15:03:53

Sure, I will try to help, answering questions here helps a lot, I'm really thankful for your work on conjure.

Olical15:03:11

Any time people get to a question before me it brings a smile to my face 🙂 takes a weight off my mind. I've got a couple of weeks off soon so hopefully I can decompress my head a little then and work on a few more things around Conjure