Liking cljdoc? Tell your friends :D

hara.test.checker.base


->checkerclj

(->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
raw docstring

anythingclj

(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
raw docstring

approxclj

(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
raw docstring

exactlyclj

(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
raw docstring

satisfiesclj

(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
raw docstring

storesclj

(stores v)

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
raw docstring

succeeded?clj

(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
raw docstring

throwsclj

(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
raw docstring

verifyclj

(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})
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close