testing

arohner 2023-03-08T13:37:48.041199Z

Does anyone have any strategies they like to verify that a function returns an actually lazy sequence?

respatialized 2023-03-08T13:44:18.595189Z

is realized? not working for your use case? https://clojuredocs.org/clojure.core/realized_q

arohner 2023-03-08T13:48:12.769699Z

I suppose I can hack it by using instance? for the lazy classes I expect

mpenet 2023-03-08T13:54:07.169709Z

ish. stuff like (range) will bite you

mpenet 2023-03-08T13:55:24.764889Z

some "things" are both lazy or not depending on what consumes them

mpenet 2023-03-08T13:56:08.250549Z

I guess you can check for all these cases (impl of IReduceInit & co), but that seems quite convoluted. Maybe there's some other way

mpenet 2023-03-08T13:56:41.466199Z

it's not unique to clj.core either, a few libs take advantage of that

Alys Brooks 2023-03-09T05:53:13.013089Z

I wonder if mocking would be appropriate here. This may be a terrible idea, but could you create a special class that implements ISeq but throws an exception if realized?