Skip to content

Commit

Permalink
It was wrong for extended-list-= to treat lists w/ different arities …
Browse files Browse the repository at this point in the history
…as equal
  • Loading branch information
marick committed Mar 20, 2013
1 parent dcb856f commit 89030e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/midje/checking/core.clj
Expand Up @@ -66,7 +66,8 @@
(defn extended-list-=
"Element-by-element comparison, using extended-= for the right-hand-side values."
[actual-args checkers]
(every? (partial apply extended-=) (vertical-slices actual-args checkers)))
(and (= (count actual-args) (count checkers))
(every? (partial apply extended-=) (vertical-slices actual-args checkers))))

;;; An element of extended-= is that an actual map cannot match an expected record (or type).
;;; That produces a plain `false` above. If client code wants to be more informative, it
Expand Down
7 changes: 6 additions & 1 deletion test/midje/checking/t_core.clj
Expand Up @@ -51,7 +51,12 @@
(extended-list-= [] []) => truthy
(extended-list-= [1] [1]) => truthy
(extended-list-= ['()] [seq?]) => truthy
(extended-list-= ['() 1] [seq? seq?]) => falsey)
(extended-list-= ['() 1] [seq? seq?]) => falsey

(fact "counts must match"
(extended-list-= [] [1]) => falsey
(extended-list-= [1] []) => falsey))


(defrecord AB [a b])
(defrecord AB2 [a b])
Expand Down

0 comments on commit 89030e8

Please sign in to comment.