Last active
November 1, 2017 07:16
-
-
Save bhb/0f2210914095b45afb7d0061322bc6a3 to your computer and use it in GitHub Desktop.
Adding your own spec for filter
This file contains hidden or 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
(require '[clojure.spec.test.alpha :as st]) | |
(require '[clojure.spec.alpha :as s]) | |
(require '[expound.alpha :as expound]) | |
(set! s/*explain-out* expound/printer) | |
(st/instrument) | |
(filter 123 "12333333333333") ; java.lang.Long cannot be cast to clojure.lang.IFn | |
(s/fdef clojure.core/filter | |
:args (s/cat :pred ifn? :coll (s/? coll?))) | |
(st/instrument) | |
(filter 123 "12333333333333") | |
;; ExceptionInfo Call to #'clojure.core/filter did not conform to spec: | |
;; form-init3643830678794618507.clj:1 | |
;; -- Spec failed -------------------- | |
;; Function arguments | |
;; (123 ...) | |
;; ^^^ | |
;; should satisfy | |
;; ifn? | |
;; ------------------------- | |
;; Detected 1 error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment