cloverage

https://github.com/lshift/cloverage/issues/103
fossifoo 2016-08-13T09:49:13.000086Z

wow, lvh, this surely is a spree you sent me on

fossifoo 2016-08-13T09:49:32.000087Z

write a test he said. it's going to be fun he said XD

fossifoo 2016-08-13T09:51:16.000088Z

tbh, this code is a bit, um, side effect heavy all over the place

fossifoo 2016-08-13T09:55:43.000089Z

i'm not sure you are going to like my test code much... it's not pretty

lvh 2016-08-13T12:18:15.000090Z

haha

lvh 2016-08-13T12:18:17.000091Z

OK

lvh 2016-08-13T12:18:19.000092Z

sorry πŸ˜„

lvh 2016-08-13T12:19:13.000093Z

I mean, I’ll let you get away with it if you’d like to call it quits β€” it’ll be a lot easier to test that code if we get to have dependencies β€” at least the code around it will have more facilities for testing

lvh 2016-08-13T12:19:44.000094Z

@fossifoo: I’d expect it to be not terribly hard with with-out-str though?

lvh 2016-08-13T12:20:00.000095Z

or are there side effects I’m forgetting about

fossifoo 2016-08-13T15:11:09.000096Z

most of the stuff is wrapped in a with-out-writer macro that you can't with-redef-fn in a test

fossifoo 2016-08-13T15:11:23.000097Z

so yeah, i had to split my code in two parts. so far, so fine

fossifoo 2016-08-13T15:11:51.000098Z

then you need forms to test with and i thought i'd use the content of the sample.clj

fossifoo 2016-08-13T15:12:33.000099Z

then you need to read that back in as testdata and the functions in source.clj almost do what you want, but not quite

fossifoo 2016-08-13T15:13:16.000100Z

and after all that i discovered that the gather-stats form reads all the source files again during reporting

fossifoo 2016-08-13T15:13:47.000101Z

which is probably not what we want in the long run either, because it effectively prohibits output plugins

fossifoo 2016-08-13T15:15:26.000102Z

i guess i always overengineer a bit too πŸ˜‰

jaceklach 2016-08-13T15:15:47.000103Z

the reason we reread the source files is i believe because it was the simplest way to get the formatting right

fossifoo 2016-08-13T15:15:51.000104Z

but hey, what's free time good for, if you aren't properly yakshaving

fossifoo 2016-08-13T15:16:38.000105Z

yeah, now that i look at it, i think it's more of an "interface" abstraction thing

fossifoo 2016-08-13T15:17:32.000106Z

if the whole gather-stats would be in it's own package or such, reports would be "out" only

fossifoo 2016-08-13T15:17:40.000107Z

and running/coverage "in"

fossifoo 2016-08-13T15:18:04.000108Z

but conceptionally i guess that "gather-stats" belongs more to the reporting phase

fossifoo 2016-08-13T15:18:13.000109Z

so mainly, i was a bit confused πŸ˜‰

jaceklach 2016-08-13T15:18:57.000110Z

oh ye that doesn't really belong in report.clj i guess.

jaceklach 2016-08-13T15:19:08.000111Z

i forgot that was a thing πŸ™‚

fossifoo 2016-08-13T15:19:16.000112Z

i would propose splitting "coverage.clj" anyway

fossifoo 2016-08-13T15:19:32.000113Z

because it's hard to deal with from the boot task for example

fossifoo 2016-08-13T15:19:45.000114Z

having to construct string parameters and such XD

jaceklach 2016-08-13T15:19:55.000115Z

no argument there, it's not nice

fossifoo 2016-08-13T15:20:06.000116Z

but, yeah, first things first

jaceklach 2016-08-13T15:20:31.000117Z

or at least exctract the body of -main so that parsing options is separate from actually acting on them πŸ˜›

fossifoo 2016-08-13T20:09:54.000118Z

yes

fossifoo 2016-08-13T20:10:28.000119Z

i've got the testing in. resubmitting PR

fossifoo 2016-08-13T20:37:42.000120Z

also submitted a PR for the boot task, even though it's still a bit rough. would be nice if people comment especially if anybody has more than 3 days of boot experience πŸ˜„