Created
January 28, 2011 20:52
-
-
Save wilkes/800925 to your computer and use it in GitHub Desktop.
testing higher order functions with midje 1.0.1
This file contains hidden or 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
(ns higer-order | |
(:use midje.sweet)) | |
(defn sum-with [f vs] | |
(apply + (map f vs))) | |
(defn double [x] | |
(* x 2)) | |
(defn sum-double [xs] | |
(sum-with double xs)) | |
;.;. FAIL at (NO_SOURCE_FILE:1) | |
;.;. You never said sum-with would be needed with these arguments: | |
;.;. (#<higer_order$double higer_order$double@6cd0a64a> ...list...) | |
;.;. | |
;.;. FAIL at (NO_SOURCE_FILE:1) | |
;.;. You claimed the following was needed, but it was never used: | |
;.;. (sum-with double ...list...) | |
;.;. | |
;.;. FAIL at (NO_SOURCE_FILE:1) | |
;.;. Expected: ...sum... | |
;.;. Actual: (nil nil nil) | |
(fact "" | |
(sum-double ...list...) => ...sum... | |
(provided | |
(sum-with double ...list...) => ...sum...)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment