There is nothing provided or planned to do that.
On Tuesday, July 5, 2016 at 8:43:31 AM UTC-5, Nikita Prokopov wrote:
>
> How to I make spec/fdef and regular clojure.test (not generative ones)
> work together? I’d like for my :ret specs and HOF :ret specs to be checked
> during regular tests. I
How to I make spec/fdef and regular clojure.test (not generative ones) work
together? I’d like for my :ret specs and HOF :ret specs to be checked
during regular tests. Is that possible?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this
explain-out is now public in master. Further mods may be coming re testing.
On Thursday, June 16, 2016 at 12:52:12 PM UTC-5, Sean Corfield wrote:
>
> I fear you’re missing my point.
>
>
>
> You can get close to the previous nice value with:
>
>
>
> (#’s/explain-out (:result (t/check-var #’ran
I fear you’re missing my point.
You can get close to the previous nice value with:
(#’s/explain-out (:result (t/check-var #’ranged-rand)))
But that leverages a private function / implementation detail and doesn’t
handle :failed-on very nicely:
boot.user=> (#'s/explain-out (:result
You haven't pretty-printed it to look very nice, but I think all of the
same information (and more due to shrinking) is still in the check-var
output. I don't know of any plan to add what you're asking for beyond
what's below.
{:result
{:clojure.spec/problems
{[]
{*:pred* *(>= (:ret %) (-
Given that we now have to use clojure.spec.test to get :ret / :fn tested, we
lose the “nice” exceptions explaining the conformance failure:
Alpha 5:
;;=> ExceptionInfo Call to #'spec-example.core/ranged-rand did not conform to
spec:
;;=> At: [:fn] val: {:args {:start 8, :end 10}, :ret 7}
I'm in the process of updating that part of the guide right now, should be
done by end of day.
On Wednesday, June 15, 2016 at 12:30:55 PM UTC-5, webber wrote:
>
> Maybe, the following is the same reason.
>
> ```
> (defn ranged-rand ;; BROKEN!
> "Returns random integer in range start <= rand <
Maybe, the following is the same reason.
```
(defn ranged-rand ;; BROKEN!
"Returns random integer in range start <= rand < end"
[start end]
(+ start (rand-int (- start end
(s/fdef ranged-rand
:args (s/and (s/cat :start integer? :end integer?)
#(< (:start %) (:end %)))
As noted in the alpha change list, this was an intentional change in what
instrument does. Instrument is intended to be used to verify that other
callers have invoked a function correctly. Checking that the function works
(by verifying that :ret and :fn return valid results) should be done using
Hi - Just noticed that the :ret function in fdef seems to be ignored in
1.9.0-alpha6:
user=> (require '[clojure.spec :as s])
user=> (defn dummy [x] (if x "yes" "no"))
user=> (s/fdef dummy
#_=> :args (s/cat :x integer?)
#_=> :ret integer?)
user=> (s/instrument #'dummy)
user=> (dummy 3) (pr
10 matches
Mail list logo