Hello, > (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")))
Such a specification looks a lot like a set of unit tests, though I'm sure you may push it beyond. Thus, I think it might be nice if these specification clauses could be set as metadata to the function as well, and yet register to your check-on-load system. The clojure.contrib.test-is library supplies such a framework whereby unit tests may be specified either as function metadata or by themselves, using macro deftest. Benoit --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---