Hi All,

Not sure if this is helpful or taking it too far, but often when I write a 
function, I have a few typical happy and unhappy code paths in mind. It 
would be nice if we can put that into spec's fdef. 

For example, in addition to :fn, :ret, :args, we add :examples, which is 
just array of [val1 val2 -> ret]. More concretely, for +, [[1 2 -> 3] [1.0 
2 -> 3.0]] (or however it should be defined).

Then when you run spec.test, we will also run those examples.

I think the benefits are: 1. it's a form of doc test, 2. no need to switch 
to another file to write these simple tests, 3. and since there's less 
overhead, we'd probably write more tests.

Frank

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