Yes, I did find that out later. Thanks a lot. That what was I was looking 
for.
It is indeed not exactly the same but close enough.

Bertrand

On Sunday, November 10, 2013 8:49:39 AM UTC+1, James Reeves wrote:
>
> The standard clojure.test namespace included in Clojure has this 
> functionality (or something very similar) by default.
>
> You can attach tests as metadata to a function, either like:
>
>     (defn foo
>       {:test (fn [] (is (= (foo 1) 2)))}
>       [x]
>       (+ x 1))
>
> Or like:
>
>     (with-test
>       (defn foo [x]
>         (+ x 1))
>       (is (= (foo 1) 2)))
>
> - James
>
>
> On 9 November 2013 14:35, <dech...@gmail.com <javascript:>> wrote:
>
>> Hello,
>>
>> While reading about tests in Python, I found the doctest module : 
>> http://docs.python.org/3/library/doctest.html#module-doctest.
>>
>> Essentially, the idea is that the documentation of the function is 
>> parsed/evaluated. And if something looks like an example it is run and 
>> verified.
>> The neat consequence is that there is a verified working example in the 
>> documentation (ie with the implementation) that can be requested from the 
>> repl.
>>
>> In Clojure, it should be quite simple to do the same or add a specific 
>> meta to a function to separate the explanation and the example(s).
>> I was wondering if something like that already existed.
>>
>> Regards
>>
>> Bertrand
>>
>>
>>  -- 
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com<javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <javascript:>
>> 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+u...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
-- 
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/groups/opt_out.

Reply via email to