ghostwheel

Hassle-free clojure.spec, automatic generative testing, side effect detection, and evaluation tracing for Clojure(-Script) – https://github.com/gnl/ghostwheel
Sen 2019-04-24T11:23:42.001900Z

Hi there, I am trying to generate instance of cljs-time (http://www.andrewmcveigh.com/cljs-time/latest/index.html) but instead getting:

cljs.user> (gen/generate (s/gen #(instance? time/date-time %)))
#object[Error Error: Unable to construct gen at: [] for: function (p1__27926_SHARP_){
return (p1__27926_SHARP_ instanceof cljs_time.core.date_time);
}]
Error: Unable to construct gen at: [] for: function (p1__27926_SHARP_){
return (p1__27926_SHARP_ instanceof cljs_time.core.date_time);
}

Sen 2019-04-24T11:24:35.002600Z

I tried gen/generate (s/gen #(time/date? %))) - result the same

Sen 2019-04-24T11:29:25.003900Z

Then tried just normal js/Date putting in repl this: (gen/generate (s/gen #(instance? js/Date %))) - similar error

Sen 2019-04-24T11:44:15.004700Z

After more googling my guess is that for Dates in general I need custom generator https://stackoverflow.com/questions/55059517/i-have-complex-spec-for-my-data-how-to-generate-samples

gnl 2019-04-25T20:09:28.000300Z

Don't really have time to look into this at the moment, but you might want to ask on the #clojure-spec channel, cause this isn't Ghostwheel-specific and there's a few more people on there. 🙂