(->checker x)
creates a 'satisfies' checker if not already a checker
((->checker 1) 1) => true
((->checker (exactly 1)) 1) => true
creates a 'satisfies' checker if not already a checker ((->checker 1) 1) => true ((->checker (exactly 1)) 1) => true
(anything x)
a checker that returns true for any value
(anything nil) => true
(anything [:hello :world]) => true
a checker that returns true for any value (anything nil) => true (anything [:hello :world]) => true
(approx v)
(approx v threshold)
checker that allows approximate verifications
((approx 1) 1.000001) => true
((approx 1) 1.1) => false
((approx 1 0.0000001) 1.001) => false
checker that allows approximate verifications ((approx 1) 1.000001) => true ((approx 1) 1.1) => false ((approx 1 0.0000001) 1.001) => false
(exactly v)
(exactly v function)
checker that allows exact verifications
((exactly 1) 1) => true
((exactly Long) 1) => false
((exactly number?) 1) => false
checker that allows exact verifications ((exactly 1) 1) => true ((exactly Long) 1) => false ((exactly number?) 1) => false
(satisfies v)
(satisfies v function)
checker that allows loose verifications
((satisfies 1) 1) => true
((satisfies Long) 1) => true
((satisfies number?) 1) => true
((satisfies #{1 2 3}) 1) => true
((satisfies [1 2 3]) 1) => false
((satisfies number?) "e") => false
((satisfies #"hello") #"hello") => true
checker that allows loose verifications ((satisfies 1) 1) => true ((satisfies Long) 1) => true ((satisfies number?) 1) => true ((satisfies #{1 2 3}) 1) => true ((satisfies [1 2 3]) 1) => false ((satisfies number?) "e") => false ((satisfies #"hello") #"hello") => true
(succeeded? {:keys [status data]})
determines if the results of a check have succeeded
(-> (satisfies Long) (verify 1) succeeded?) => true
(-> (satisfies even?) (verify 1) succeeded?) => false
determines if the results of a check have succeeded (-> (satisfies Long) (verify 1) succeeded?) => true (-> (satisfies even?) (verify 1) succeeded?) => false
(throws)
(throws e)
(throws e msg)
checker that determines if an exception has been thrown
((throws Exception "Hello There") (result/map->Result {:status :exception :data (Exception. "Hello There")})) => true
checker that determines if an exception has been thrown ((throws Exception "Hello There") (result/map->Result {:status :exception :data (Exception. "Hello There")})) => true
(verify ck result)
verifies a value with it's associated check
(verify (satisfies 2) 1) => (contains-in {:status :success :data false :checker {:tag :satisfies :doc string? :expect 2} :actual 1 :from :verify})
(verify (->checker #(/ % 0)) 1) => (contains {:status :exception :data java.lang.ArithmeticException :from :verify})
verifies a value with it's associated check (verify (satisfies 2) 1) => (contains-in {:status :success :data false :checker {:tag :satisfies :doc string? :expect 2} :actual 1 :from :verify}) (verify (->checker #(/ % 0)) 1) => (contains {:status :exception :data java.lang.ArithmeticException :from :verify})
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close