Welcome! Please see the About page for a little more info on how this works.

+2 votes
in Clojure by

I am getting false from s/valid on the below spec but s/explain gives success. Bug? Looks similar to this question.

(s/def ::mv (s/cat :args
                   (s/spec (s/cat :source string?
                                  :destination (s/alt :target string?
                                                      :dir string?)))
                   :opts empty?))

user> (s/valid? ::mv ['("one" "two") {}])
true
user> (s/valid? ::mv ['("one" "two" "three" "four") {}])
false
user> (s/explain ::mv ['("one" "two" "three" "four") {} ])
Success!
nil

1 Answer

0 votes
by

Yes, seems like similar. I suspect the issue here is something to do with checking for remaining input in the collection where that should fail but does not.

...