Permalink
Browse files

Remove deprecated functions

  • Loading branch information...
1 parent da3ca7e commit 96e9133b129339d9546889efbaf40955f9b5713b @marick committed May 4, 2013
@@ -22,7 +22,7 @@
(some #(= % (str node)) (concat base-names semi-sweet-names sweet-names))))
(defn semi-sweet-keyword? [loc]
- (matches-symbols-in-semi-sweet-or-sweet-ns? '(expect fake not-called data-fake) loc))
+ (matches-symbols-in-semi-sweet-or-sweet-ns? '(expect fake data-fake) loc))
(defn symbol-named?
@@ -32,7 +32,7 @@
;; rather than midje.semi_sweet_test. Since 'fake' is used only in the latter,
;; the tests fail.
;;
-;; FURTHERMORE, I wanted to use set operations to check for fake and not-called,
+;; FURTHERMORE, I wanted to use set operations to check for fake
;; but those fail for reasons I don't understand. Bah.
(defn expect-match-or-mismatch [arrow]
(condp = (name arrow)
@@ -131,5 +131,4 @@
(defn fake? [form]
(or (first-named? form "fake")
- (first-named? form "data-fake")
- (first-named? form "not-called")))
+ (first-named? form "data-fake")))
View
@@ -26,33 +26,23 @@
;;; Interface: unfinished
-(letfn [(unfinished* [names]
- (pile/macro-for [name names]
- `(do
- (defn ~name [& args#]
- (let [pprint# (partial cl-format nil "~S")]
- (throw (user-error (format "#'%s has no implementation, but it was called like this:%s(%s %s)"
- '~name line-separator '~name (join " " (map pprint# args#)))))))
-
- ;; A reliable way of determining if an `unfinished` function has since been defined.
- (alter-meta! (var ~name) assoc :midje/unfinished-fun ~name)
- :ok)))]
-
- (defmacro unfinished
+(defn- unfinished* [names]
+ (pile/macro-for [name names]
+ `(do
+ (defn ~name [& args#]
+ (let [pprint# (partial cl-format nil "~S")]
+ (throw (user-error (format "#'%s has no implementation, but it was called like this:%s(%s %s)"
+ '~name line-separator '~name (join " " (map pprint# args#)))))))
+
+ ;; A reliable way of determining if an `unfinished` function has since been defined.
+ (alter-meta! (var ~name) assoc :midje/unfinished-fun ~name)
+ :ok)))
+
+(defmacro unfinished
"Defines a list of names as functions that have no implementation yet. They will
throw Errors if ever called."
[& names] (unfinished* names))
- (defmacro only-mocked
- "Defines a list of names as functions that have no implementation yet. They will
- throw Errors if ever called.
- DEPRECATED: Prefer `unfinished`."
- {:deprecated "1.3-alpha2"}
- [& names]
- (deprecate "`only-mocked` will be removed in version 1.6. Use `unfinished` instead.")
- (unfinished* names)))
-
-
;;; Interface: production mode
@@ -100,14 +90,5 @@
(parse-expects/to-lexical-map-form &form)))
-(defmacro not-called
- "Creates an fake map that a function will not be called.
- Example: (not-called f))
- DEPRECATED: Prefer `:times 0` annotation to `fake`, ex. (provided (f) => irrelevant :times 0))"
- {:deprecated "1.3-alpha2"
- :arglists '([var-sym & overrides])}
- [var-sym & overrides]
- (deprecate "`not-called` (and the entire midje.semi-sweet namespace) will be removed in 1.6. Use `(provided (f) => irrelevant :times 0)` instead.")
- (let [fake-form `(fake (~var-sym) => "doesn't matter" ~@(concat overrides [:times 0]))]
- (with-meta fake-form {:line (meta &form)})))
+
@@ -37,10 +37,6 @@
actual => [ '[(fake (f 1) => 2)]
'[:key 'value] ])
- (let [actual (separate recognize/fake? '( (not-called some-function) :key 'value))]
- actual => [ '[(not-called some-function)]
- '[:key 'value] ])
-
;; often passed a seq.
(let [actual (separate recognize/fake? (seq '( (fake (f 1) => 2) :key 'value)))]
actual => [ '[(fake (f 1) => 2)]
@@ -103,16 +99,6 @@
(expect (+ 1 3) => nil))
(note-that fact-fails, (fact-expected nil), (fact-actual 4))
- (fact "not-called in the first position"
- (expect (function-under-test) => 33
- (not-called no-caller)
- (fake (mocked-function) => 33)))
-
- (fact "not-called in last position"
- (expect (function-under-test) => 33
- (fake (mocked-function) => 33)
- (not-called no-caller)))
-
(silent-fact "mocked calls go fine, but function under test produces the wrong result"
(expect (function-under-test 33) => 12
(fake (mocked-function 33) => (not 12) )))
@@ -123,16 +109,6 @@
(fake (mocked-function) => 33)))
(note-that fact-fails, (the-prerequisite-was-never-called))
- ;;; This causes an java.lang.AbstractMethodError in Clojure 1.4,
- ;;; 1.5. Clojure bug? In any case, since not-called is deprecated
- ;;; and :times 0 works, I'm not that worried about it. Also, it only
- ;;; happens because the function under test uses apply to call the mocked function.
- ;;; Direct call is no problem.
- (future-fact "mock call was not supposed to be made, but was (non-zero call count)"
- (expect (function-under-test 33) => "irrelevant"
- (not-called mocked-function)))
- ; (note-that fact-fails, (the-prerequisite-was-incorrectly-called 1 :time))
-
(fact "call not from inside function"
(expect (+ (mocked-function 12) (other-function 12)) => 12
(fake (mocked-function 12) => 11)
View
@@ -90,11 +90,6 @@
(str "It should be the identity for value " v) ;; doc string needn't be constant
(a-fun v) => v))
-; http://github.com/marick/Midje/issues/#issue/2
-(fact
- (expect (always-one 5) => 1
- (not-called a-fun)))
-
(binding [midje.semi-sweet/*include-midje-checks* false]
(load "sweet_compile_out"))

0 comments on commit 96e9133

Please sign in to comment.