Created
September 15, 2010 13:34
-
-
Save pepijndevos/580719 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn test [function] | |
(doseq [tests (:tests (meta function))] | |
(assert (= (apply function (key tests)) (val tests))))) | |
;define a macro like deftestedfn for this | |
(def tested+ (with-meta + {:tests {[1 2 3] 6, [5 5] 10}})) | |
(test tested+) | |
;true | |
(def tested+ (with-meta + {:tests {[1 2] 4}})) | |
(test tested+) | |
; java.lang.AssertionError |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment