Fuctions used in conjunction with clojure.spec.alpha
.
Fuctions used in conjunction with `clojure.spec.alpha`.
(test-valid? spec value)
Tests if value
is a valid instance of spec
.
Returns true if value
is valid.
Otherwise, returns the value of clojure.spec.alpha/explain-str
.
Useful in tests to check if a value is valid, and to get feedback when tests fail.
Example:
(test-valid? ::int? 1) ; => true
(test-valid? ::int? "1") ; => "spec: :com.wallbrew.spoon.spec/int? fails predicate: int? with: \"1\""
Tests if `value` is a valid instance of `spec`. Returns true if `value` is valid. Otherwise, returns the value of `clojure.spec.alpha/explain-str`. Useful in tests to check if a value is valid, and to get feedback when tests fail. Example: ```clj (test-valid? ::int? 1) ; => true (test-valid? ::int? "1") ; => "spec: :com.wallbrew.spoon.spec/int? fails predicate: int? with: \"1\"" ```
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close