(->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
(capture)(capture checker)(capture checker sym)adds a form to capture test input
adds a form to capture test input
(checker m)creates a 'code.test.checker.common.Checker' object
(checker {:tag :anything :fn (fn [x] true)}) => code.test.checker.common.Checker
creates a 'code.test.checker.common.Checker' object
(checker {:tag :anything :fn (fn [x] true)})
=> code.test.checker.common.Checker(checker? x)checks to see if a datastructure is a 'code.test.checker.common.Checker'
(checker? (checker {:tag :anything :fn (fn [x] true)})) => true
checks to see if a datastructure is a 'code.test.checker.common.Checker'
(checker? (checker {:tag :anything :fn (fn [x] true)}))
=> true(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
(function-string func)returns the string representation of a function
(function-string every?) => "every?"
(function-string reset!) => "reset!"
returns the string representation of a function (function-string every?) => "every?" (function-string reset!) => "reset!"
(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(stores v)a checker that looks into a ref object
((stores 1) (volatile! 1)) => true
((stores 1) 1) => false
a checker that looks into a ref object ((stores 1) (volatile! 1)) => true ((stores 1) 1) => false
(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") (res/result {:status :exception :data (Exception. "Hello There")})) => true
checker that determines if an exception has been thrown
((throws Exception "Hello There")
(res/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 builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |