Fork me on GitHub
Petrus Theron09:05:57

How do I use Spec with core.async? E.g. how do I spec a function that returns a channel where I'll put! another spec on? Or do I need to wrap it in some kind of record for this?


you can spec that something is a Channel, but that’s not very useful, so you probably want to spec the values at the points where you put/take them

Petrus Theron20:05:17

Yes, I realized that I could spec the channel transducers that interpret incoming values on put!.


I'm seeing strange behavior in spec alpha2 (latest github commit). If I define a schema using the map form, to specify non-namespaced keywords, refer to it from another schema, and later try to generate data from a selection of latter schema, I get an "Unable to resolve spec" exception:

; Context
  (s/def ::foo int?)
  (s/def ::inner (s/schema {:foo ::foo}))
  (s/def ::outer (s/schema [::inner]))

  ; Works as expected:
  (s/exercise ::outer)
  (s/exercise (s/select ::inner [*]))

  ; Fails with "Unable to resolve spec: :foo"
  (s/exercise (s/select ::outer [*]))


Is this expected, should I change something in my code, or is it a bug that I should report somewhere?


Spec 2 is very much a work in progress and isn't ready for folks to use -- and, yes, it has numerous bugs in it @rafael


Yeah, so far I'm finding workarounds. I think I can work around this one as well with s/keys