1.3.0 permalink Arrow_down_16x16
  • (are argv expr & args)
Checks multiple assertions with a template expression.
See clojure.template/do-template for an explanation of
templates.

Example: (are [x y] (= x y)
2 (+ 1 1)
4 (* 2 2))
Expands to:
(do (is (= 2 (+ 1 1)))
(is (= 4 (* 2 2))))

Note: This breaks some reporting features, such as line numbers.

1 Example top

  • ;; An alternate to the example in the documentation is 
    
    user=> (are [result arg-map] (= result (+ (:x arg-map) (:y arg-map)))
                 5      {:x 2 :y 3},
                 10     {:x 6 :y 4})
    
    
    
Log in to add / edit an example.

See Also top

  • 1
    clojure.test/is

    Generic assertion macro. 'form' is any predicate test. 'msg' is an

  • 0
    clojure.test/deftest

    Defines a test function with no arguments. Test functions may call

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/test.clj:556 top

(defmacro are
  "Checks multiple assertions with a template expression.
  See clojure.template/do-template for an explanation of
  templates.

  Example: (are [x y] (= x y)  
                2 (+ 1 1)
                4 (* 2 2))
  Expands to: 
           (do (is (= 2 (+ 1 1)))
               (is (= 4 (* 2 2))))

  Note: This breaks some reporting features, such as line numbers."
  {:added "1.1"}
  [argv expr & args]
  `(temp/do-template ~argv (is ~expr) ~@args))
Vars in clojure.test/are:
Used in 0 other vars

Comments top

No comments for are. Log in to add a comment.