hello
is it possible to run async code into a (props/for-all)
?
I would like to test some cljs code that requires to be async, any ideas on how to do that?
@wilkerlucio: I’ve used property testing with core.async before. The only real way I could figure out to do it to make sure that there’s some kind of terminator on the channel (this could be that the channel was closed), and that you’ve hit it. You could also add a big enough sleep to make sure that everything should have finished, but that’s super hacky and will limit how many examples you can run in a given time
@wilkerlucio: you may also find https://github.com/czan/stateful-check helpful
hi Lucas, sorry, I didn't understand the idea you told me to use core.async, can you show me a code example of it please?
Sorry, I don’t really have an example handy. It really depends on what you’re trying to do
thats fine, on my case I don't really need the for-all, I'm doing ok just sampling and testing from it, thanks for the assistance
lucasbradstreet: "big enough sleep" ⇐ are you talking about clj-jvm instead of cljs?
wilkerlucio: I was just wondering about async tests myself like two days ago; I think you'd need a separate test runner
i.e., would have to modify clojure.test.check/quick-check
Oh yeah, I am
wilkerlucio: you'd have to rewrite quick-check to listen for results on a core.async channel I think
it'd probably be one of those "quick-check returns a channel that will eventually receive the result" sort of situations
Yeah, that’s basically along the lines of what I was trying to get across
and then would need to rewrite prop/for-all to supply a channel for the body to write to somehow, or something
yeah, seems a lot of fun doing it, just need some time to learn how test.check works, hehe
I'm happy to advise