Permalink
Browse files

It was wrong for extended-list-= to treat lists w/ different arities …

…as equal
  • Loading branch information...
marick committed Mar 20, 2013
1 parent dcb856f commit 89030e8a502fdd1a046be24464bbb486cb8d5868
Showing with 8 additions and 2 deletions.
  1. +2 −1 src/midje/checking/core.clj
  2. +6 −1 test/midje/checking/t_core.clj
@@ -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
@@ -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])

0 comments on commit 89030e8

Please sign in to comment.