1.2.0 permalink Arrow_down_16x16
  • (test-var v)
If v has a function in its :test metadata, calls that function,
with *testing-vars* bound to (conj *testing-vars* v).

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/test.clj:679 top

(defn test-var
  "If v has a function in its :test metadata, calls that function,
  with *testing-vars* bound to (conj *testing-vars* v)."
  {:dynamic true, :added "1.1"}
  [v]
  (when-let [t (:test (meta v))]
    (binding [*testing-vars* (conj *testing-vars* v)]
      (do-report {:type :begin-test-var, :var v})
      (inc-report-counter :test)
      (try (t)
           (catch Throwable e
             (do-report {:type :error, :message "Uncaught exception, not in assertion."
                      :expected nil, :actual e})))
      (do-report {:type :end-test-var, :var v}))))
Vars in clojure.contrib.test-is/test-var: binding defn when-let
Used in 0 other vars

Comments top

No comments for test-var. Log in to add a comment.