*Please make stest/instrument check :ret too, not only :args.*

I have been experimenting a lot with spec during December, and I really 
like it. On the downside, the syntax is very verbose, compared to prismatic 
schema. However, reuse is much simpler than for schemas.

I disagree with this decision from two different reasons:

1. "that code is invoked correctly", yes, it is an API, but common courtesy 
also requires us to make sure we return the expected result, i.e. check the 
:ret
2. Performance is not a problem for checking :ret, since as cheap as 
checking a single args, i.e. will not increase execution time a lot.

Without checking the results, the s/fdef is really use-less.

A compromise would be to have a simple option to (stest/instrument) to make 
it also include run :ret.

For now, I a made a copy of the original definitions of instrument, 
instrument-1 and spec-checking-fn, and override the default ones.

---

I would recommend everyone interested in property based testing to go 
beyond stest/check, since in most cases doesn't find more problems than 
ML-like type-checking would have done. Property based testing is something 
completely different, I have done some in Erlang. There are a lot of good 
samples and concepts for Erlang. Just google "quickcheck erlang" 
"quickcheck elixir". There is also a lot of good articles by John Hughes 
and his collegues at https://www.researchgate.net/ and many recordings 
like https://www.youtube.com/watch?v=H18vxq-VsCk

---


Den torsdag 16 juni 2016 kl. 15:29:05 UTC+2 skrev Alex Miller:
>
> Instrumentation is about verifying that code is invoked correctly (things 
> *external* to a function).
>
> The :ret and :fn specs verify that things *internal* to a function are 
> working correctly, and that is seen as a testing-time activity with support 
> in clojure.spec.test.
>
>
>>>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to