Skip to content

Commit

Permalink
Dynamic variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
marick committed Oct 11, 2011
1 parent 136e8ec commit 6a6b87b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/midje/ideas/metaconstants.clj
Expand Up @@ -72,7 +72,7 @@
"If you have a compelling case for equality, please create an issue:"
ecosystem/issues-url)))))

(defmethod print-method Metaconstant [o ^Writer w]
(defmethod print-method Metaconstant [o ^java.io.Writer w]
(print-method (.name o) w))


Expand All @@ -82,7 +82,7 @@
(intern *ns* metaconstant (Metaconstant. metaconstant {})))
metaconstants))

(def *metaconstant-counts*)
(def ^{:dynamic true} *metaconstant-counts*)

(defmacro with-fresh-generated-metaconstant-names [& forms]
`(binding [*metaconstant-counts* (atom {})]
Expand Down
3 changes: 2 additions & 1 deletion src/midje/semi_sweet.clj
Expand Up @@ -99,7 +99,8 @@

(defonce
#^{:doc "True by default. If set to false, Midje checks are not
included into production code, whether compiled or loaded."}
included into production code, whether compiled or loaded."
:dynamic true}
*include-midje-checks* true)


Expand Down
4 changes: 2 additions & 2 deletions src/midje/util/report.clj
Expand Up @@ -13,14 +13,14 @@
[midje.util.exceptions :only [friendly-exception-text]]
[midje.checkers.util :only [captured-exception? captured-exception-value]]))

(def *renderer* println)
(def ^{:dynamic true} *renderer* println)


;;; This mechanism is only used to make `fact` return appropriate values of
;;; true or false. It doesn't piggyback off clojure.test/*report-counters*
;;; partly because that's not normally initialized and partly to reduce
;;; dependencies.
(def *failure-in-fact* false)
(def ^{:dynamic true} *failure-in-fact* false)
(defn note-failure-in-fact
([] (note-failure-in-fact true))
([val] (alter-var-root #'*failure-in-fact* (constantly val))))
Expand Down

0 comments on commit 6a6b87b

Please sign in to comment.