Hi all,

I created a new framework for defining specifications on functions...

http://www.bitbucket.org/BestFriendChris/clojure-spec/wiki/Home

An example spec (taken from the main wiki page):

(defspec +              ; Shows we are defining a specification for
the + function
  ([]      (= value 0)) ; Verify that (+) => 0
  ([1]     (= value 1)) ; Verify that (+ 1) => 1
  ([1 2 3] (= value 6)) ; Verify that (+ 1 2 3) => 6
  ([1 'a]               ; Verify that (+ 1 'a) throws a
ClassCastException
    (instance? java.lang.ClassCastException exception)
    (.contains (.getMessage exception) "Symbol cannot be cast to
java.lang.Number")))

I've tried to make it concise enough that it is easy to read and can
be defined right next to the actual function... I personally use tests
as documentation, and having this available would be perfect for me.

Thoughts?

Chris

--~--~---------~--~----~------------~-------~--~----~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to