Skip to content

Prerequisites that throw exceptions

marick edited this page Apr 27, 2012 · 1 revision

Available in 1.4

You can ask that a prerequisite throw an exception when it's called:

(unfinished f)

(defn counter [n]
  (try
    (f n)
  (catch Exception ex
    0)))
      
(fact
  (counter 4) => 0
  (provided
    (f 4) =throws=> (NullPointerException.)))
Clone this wiki locally