Last active
December 16, 2017 18:36
-
-
Save bhb/5abeff11f5252e915a07ea20acadd7fc to your computer and use it in GitHub Desktop.
Expound describes missing specs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user=> (require '[clojure.spec.alpha :as s]) | |
nil | |
user=> (require '[expound.alpha :as expound]) | |
nil | |
user=> (s/def ::name string?) | |
:user/name | |
user=> (s/def ::age pos-int?) | |
:user/age | |
user=> (s/def ::user (s/keys :req [::name] :req-un [::age])) | |
:user/user | |
user=> (s/explain ::user {}) | |
val: {} fails spec: :user/user predicate: (contains? % :user/name) | |
val: {} fails spec: :user/user predicate: (contains? % :age) | |
nil | |
user=> (expound/expound ::user {}) | |
-- Spec failed -------------------- | |
{} | |
should contain keys: `:age`, `:user/name` | |
| key | spec | | |
|------------+----------| | |
| :age | pos-int? | | |
| :user/name | string? | | |
-- Relevant specs ------- | |
:user/user: | |
(clojure.spec.alpha/keys :req [:user/name] :req-un [:user/age]) | |
------------------------- | |
Detected 1 error | |
nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment