Permalink
Browse files

Remove deprecated checker functions

  • Loading branch information...
1 parent c60f0d8 commit da3ca7e1c13900cb35f5d2cec03ad1703ea6181d @marick committed May 4, 2013
View
@@ -27,6 +27,4 @@
'[every-checker some-checker])
(republish 'midje.checking.checkers.collection
'[has has-suffix has-prefix just contains n-of
- one-of two-of three-of four-of five-of six-of seven-of eight-of nine-of ten-of])
- (republish 'midje.checking.checkers.deprecated
- '[map-containing only-maps-containing maps-containing in-any-order]))
+ one-of two-of three-of four-of five-of six-of seven-of eight-of nine-of ten-of]))
@@ -1,7 +0,0 @@
-(ns midje.checkers.extended-equality
- (:require [midje.checking.core :as new-place]
- [midje.emission.deprecation :as deprecation]))
-
-(defn extended-= [actual expected]
- (deprecation/deprecate "`extended-=` has moved to midje.checking.core. This version will be removed in 1.6.")
- (new-place/extended-= actual expected))
@@ -1,61 +0,0 @@
-(ns ^{:doc "Deprecated checkers."}
- midje.checking.checkers.deprecated
- (:use [midje.checking.checkers.defining :only [defchecker]]
- [midje.emission.deprecation :only [deprecate]]
- [midje.checking.checkers.collection :only [just contains]]))
-
-;; Note: checkers need to be exported in ../checkers.clj
-
-(defchecker map-containing
- "DEPRECATED: use 'contains' checker instead.
- Accepts a map that contains all the keys and values in expected,
- perhaps along with others"
- {:deprecated "0.9.0"
- :arglists '([expected])}
- [expected]
- (deprecate "`map-containing will be removed in 1.6. Use `contains` instead.")
- (contains expected))
-
-(letfn [(one-level-map-flatten [list-like-thing]
- (if (map? (first list-like-thing))
- list-like-thing
- (first list-like-thing)))]
-
- (defchecker only-maps-containing
- "DEPRECATED: use (just [ (contains {..}) ]) instead.
- Each map in the argument(s) contains some map in the expected
- result. There may be no extra maps in either the argument(s) or expected result.
-
- You can call this with either (only-maps-containing {..} {..}) or
- (only-maps-containing [ {..} {..} ])."
- {:deprecated "0.9.0"
- :arglists '([maps-or-maplist])}
- [& maps-or-maplist]
- (deprecate "`only-maps-containing will be removed in 1.6. Use `(just [ (contains {..}) ])` instead.")
- (let [expected (one-level-map-flatten maps-or-maplist)
- subfunctions (map contains expected)]
- (just subfunctions :in-any-order)))
-
- (defchecker maps-containing
- "DEPRECATED: use (contains [ (contains {..}) ] instead.
- Each map in the argument(s) contains contains some map in the expected
- result. There may be extra maps in the actual result.
-
- You can call this with either (maps-containing {..} {..}) or
- (maps-containing [ {..} {..} ])."
- {:deprecated "0.9.0"
- :arglists '([maps-or-maplist])}
- [& maps-or-maplist]
- (deprecate "`maps-containing will be removed in 1.6. Use `(contains [ (contains {..}) ])` instead.")
- (let [expected (one-level-map-flatten maps-or-maplist)
- subfunctions (map contains expected)]
- (contains subfunctions :in-any-order :gaps-ok))))
-
-(defchecker in-any-order
- "DEPRECATED: use (just x :in-any-order) instead.
- Produces matcher that matches sequences without regard to order."
- {:deprecated "0.9.0"
- :arglists '([expected])}
- [expected]
- (deprecate "`in-any-order will be removed in 1.6. Use `(just x :in-any-order)` instead.")
- (just expected :in-any-order))
View
@@ -15,7 +15,6 @@
[midje.parsing.lexical-maps :as lexical-maps]
[midje.emission.api :as emit]
midje.checking.predictions
- midje.checkers.extended-equality
[midje.parsing.util.fnref :as fnref]
[midje.parsing.2-to-lexical-maps.expects :as parse-expects]
[midje.parsing.2-to-lexical-maps.fakes :as parse-fakes]
@@ -1,61 +0,0 @@
-(ns midje.checking.checkers.t-deprecated
- (:use midje.sweet
- [midje.checking.checkers.defining :only [checker?]]
- midje.test-util))
-
-
-(facts "about in-any-order"
- in-any-order => checker?
- #'in-any-order => checker?
- (in-any-order []) => checker?
- [] => (in-any-order [])
- [1] => (in-any-order [1])
- '(2 1) => (in-any-order [1 2])
- [ {:a 1} {:b 2} ] => (in-any-order [{:b 2} {:a 1}])
-
- ( (in-any-order [1 2]) [1 2 3]) => falsey
- ( (in-any-order [1 2]) [1]) => falsey
- ( (in-any-order [1 2]) [1 3]) => falsey
-
- ( (in-any-order [1 2 2 3]) [1 2 3 3]) => falsey
- ( (in-any-order [2 1 3 2]) [1 2 3 3]) => falsey)
-
-(facts "about map-containing"
- map-containing => checker?
- #'map-containing => checker?
- (map-containing {}) => checker?
-
- {:a 1 :b 2} => (map-containing {:a 1 :b 2})
- {:a 1 :b 2 :c 3} => (map-containing {:a 1 :b 2})
-
- ( (map-containing {:a 1 :b 2}) {:a 1}) => falsey
- ( (map-containing {:a 1 :b 2}) {:a 1 :b 3}) => falsey)
-
-(facts "about only-maps-containing-test"
- only-maps-containing => checker?
- #'only-maps-containing => checker?
- (only-maps-containing {}) => checker?
-
- ( (only-maps-containing {:a 1 :b 2}) [{:a 1 :b 2} {:extra true}]) => falsey
- ( (only-maps-containing {:a 1 :b 2} {:extra true}) [{:a 1 :b 2}]) => falsey
-
- [{:a 1 :b 2} {:extra 1}] => (only-maps-containing {:extra 1} {:a 1})
- [{:a 1 :b 2} {:a 1 :b 22}] => (only-maps-containing {:b 2} {:b 22})
- [{:a 1 :b 2} {:a 1 :b 22}] => (only-maps-containing [{:b 2} {:b 22}])
- ( (only-maps-containing {:b 2} {:b 22}) [{:b 2} {:b 33}]) => falsey)
-
-(facts "about maps-containing"
- maps-containing => checker?
- #'maps-containing => checker?
- (maps-containing {}) => checker?
-
- ( (maps-containing {:a 1 :b 2} {:extra true}) [{:a 1 :b 2}]) => falsey
-
- [{:a 1 :b 2} {:extra 1}] => (maps-containing {:extra 1} {:a 1})
- [{:a 1 :b 2} {:a 1 :b 22}] => (maps-containing {:b 2} {:b 22})
- [{:a 1 :b 2} {:a 1 :b 22} {:a 1 :b 33}] => (maps-containing {:b 2} {:b 22})
- [{:a 1 :b 2} {:a 1 :b 22} {:a 1 :b 33}] => (maps-containing [{:b 2} {:b 22}])
- ( (maps-containing {:b 2} {:b 22}) [{:b 2} {:b 33}]) => falsey)
-
-
-
@@ -1,22 +1,15 @@
-(ns midje.t-checkers
+(ns user.fus-checkers
(:use midje.sweet
midje.test-util))
-;; Make sure the published interface actually exists.
-
-(fact "simple checkers exist"
+(fact "simple checkers are exported into midje.sweet"
1 => truthy
nil => falsey
'foo => anything
odd? => (exactly odd?)
+ 5 => (roughly 5)
(throw (Error.)) => (throws Error))
-(fact "deprecated checkers"
- [1 2 3] => (in-any-order [3 2 1])
- {:a 1 :b 2} => (map-containing {:a 1})
- [{:a 1} {:b 2}] => (maps-containing {:a 1} {:b 2})
- [{:a 1} {:b 2}] => (only-maps-containing {:a 1} {:b 2}))
-
(defn equality [expected]
(chatty-checker [actual] (= actual expected)))
@@ -32,20 +25,21 @@
-(defn as-sets [& expected]
- (let [set-of-sets #(set (map set %))]
- (fn [actual]
- ( (just (set-of-sets expected)) (set-of-sets actual)))))
-
-
-(silent-fact
- [ [1] [2 3] ] => (as-sets [ [1] ]))
-
(future-fact "Failures from chatty-checkers-within-functions propagate chatty information"
- @silent-fact:last-raw-failure => (contains {:type :actual-result-did-not-match-checker
- :actual [ [1] [2 3]]
- :expected-result-form '(as-sets [[1]])
- :notes ["Expected one element. There were two."]}))
+
+ (defn as-sets [& expected]
+ (let [set-of-sets #(set (map set %))]
+ (fn [actual]
+ ( (just (set-of-sets expected)) (set-of-sets actual)))))
+
+
+ (silent-fact
+ [ [1] [2 3] ] => (as-sets [ [1] ]))
+
+ @silent-fact:last-raw-failure => (contains {:type :actual-result-did-not-match-checker
+ :actual [ [1] [2 3]]
+ :expected-result-form '(as-sets [[1]])
+ :notes ["Expected one element. There were two."]}))
;; The behavior of checkers is different in prerequisites

0 comments on commit da3ca7e

Please sign in to comment.