-
-
Save tirkarthi/8b5f76dcaf7cd0268b7e12c6433c4fe4 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