admin-announcements

Announcements from the Clojurians Admin Team (@U11BV7MTK @U077BEWNQ @U050TNB9F @U0ETXRFEW @U04V70XH6 @U8MJBRSR5 and others)
markmandel 2015-11-26T06:41:35.000461Z

Trying to work out the best option for testing lib that works across both clj+cljs and works with reader conditionals. I was previously using midje, but finding it a bit flaky with the newer clojure versions - thinking about just shifting to clojure/cljs.test - unless anyone has any other suggestions?

2015-11-26T06:49:25.000462Z

@markmandel: haven't yet put it through its paces, but speclj appears to be closer to the BDD spirit of midje https://github.com/slagyr/speclj

markmandel 2015-11-26T06:49:44.000464Z

Yeah, speclj also has specljs... I was wondering about that

markmandel 2015-11-26T06:51:17.000465Z

Wondering how well it handles .cljc files

2015-11-26T06:51:34.000466Z

it's on my radar specifically because it mentions cljs as supported (i've worked in clj but only starting to work in cljs), but bonus it uses rspec-ish semantics

markmandel 2015-11-26T06:52:08.000467Z

Looks like there are some issues: https://github.com/slagyr/speclj/issues/133

markmandel 2015-11-26T06:52:54.000469Z

And this library is a library that can work from clj and cljs.. so having tests that can be cljc is pretty important

2015-11-26T06:53:08.000470Z

honestly, and granted i'm new to cljs (as in, days), but i've found cljc fiddly at best

markmandel 2015-11-26T06:53:10.000471Z

I was using cljx before, which was generative, so it was less of an issue

markmandel 2015-11-26T06:53:58.000472Z

Yeah, that was why my thought was just go back to clojure/cljs.test - keep it super simple

2015-11-26T06:54:55.000473Z

i found clojure.test basically intolerable. best of luck if that's what you end up with

markmandel 2015-11-26T06:55:21.000474Z

What did you hate about it?

2015-11-26T06:55:30.000475Z

well, i'm a BDD partisan. so...

markmandel 2015-11-26T06:55:44.000476Z

Ah, I'm not as fussed - as long as I can write tests

2015-11-26T06:56:38.000477Z

i find the form (deftest somebadnamewithpoorformating assert-things-that-dont-express-what-i-want-to-ensure) a poor recipe for good testing

2015-11-26T06:56:55.000478Z

but again, partisan

markmandel 2015-11-26T06:57:25.000479Z

I see your point - but I can't have a testing library that just doesn't work with reader conditionals.

markmandel 2015-11-26T06:57:55.000480Z

That's just the biggest thing

2015-11-26T06:58:46.000481Z

so, my inclination (again days in) is to strictly separate clj and cljs. i think testing those will prove simpler (even if i end up needing different testing environments, which i don't know)

markmandel 2015-11-26T06:59:04.000482Z

I'll have a massive amount of repetition then

markmandel 2015-11-26T06:59:08.000483Z

that's not a good thing

2015-11-26T06:59:35.000484Z

are you working on something isomorphic?

2015-11-26T07:00:11.000485Z

how much work is actually expected to be done, and done the same way, client and server?

markmandel 2015-11-26T07:01:25.000486Z

so it's a game framework library, and sometimes people write games in clj and sometimes they write them in cljs

markmandel 2015-11-26T07:01:42.000487Z

it's more of a game architecture library (entity system components)

2015-11-26T07:01:45.000488Z

gotcha

markmandel 2015-11-26T07:01:56.000489Z

so there isn't a huge amount that needs to switch between the two implementations - but there are things

2015-11-26T07:02:49.000490Z

that definitely falls outside the use cases i've been researching for

markmandel 2015-11-26T07:03:07.000491Z

https://github.com/markmandel/brute < library in question

2015-11-26T07:04:53.000493Z

`

2015-11-26T07:04:56.000494Z

dammit slack

2015-11-26T07:05:14.000495Z

#+clj (java.util.UUID/randomUUID)
  #+cljs
  (let [template "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"

2015-11-26T07:05:16.000496Z

hehe

2015-11-26T07:06:41.000497Z

interop is fun. it's surprising how little i've needed to think of it either on the JVM or JS

markmandel 2015-11-26T07:06:55.000498Z

Yeah, it's those little small pieces that needs to switch

markmandel 2015-11-26T07:07:49.000499Z

I think I'll take a stab at this test suite that is failing with midje (no idea why really, magic macros are failing with cljc I think), to clojure.test, and see how it feels

markmandel 2015-11-26T07:08:08.000500Z

It's not such a huge test suite that I can't pick it up and move it again to something else

2015-11-26T07:08:37.000501Z

good luck

2015-11-26T07:09:02.000502Z

midje is all magic, i always feared i'd hit a black box with it

markmandel 2015-11-26T07:09:12.000503Z

Plus, in theory it should be better tested for this type of scenario

2015-11-26T07:09:38.000504Z

the type of scenario where the testing framework isn't suited to multiple host envs?

2015-11-26T07:09:40.000505Z

:simple_smile:

markmandel 2015-11-26T07:09:41.000506Z

Every time I look at a testing library, I see issues with reader conitionals

markmandel 2015-11-26T07:09:45.000507Z

pretty much

2015-11-26T07:10:36.000508Z

obviously much more difficult, but i'd like a multi-host language to be able to handle that, as much as possible

2015-11-26T07:11:06.000509Z

(more than that i'd prefer a self-hosted language, buuuuut)

markmandel 2015-11-26T07:12:00.000510Z

One thing at a time? 😉

markmandel 2015-11-26T07:12:55.000511Z

TIme to go to bed and dream about lisp :simple_smile: thanks for the sounding board.

2015-11-26T07:13:10.000512Z

cheers

seancorfield 2015-11-26T07:45:50.000514Z

@markmandel: have a look at Expectations. Uses cljx right now but at least it does both clj and cljs

seancorfield 2015-11-26T07:46:31.000515Z

Jay Fields has always been very responsive to our feedback so I would expect him to be receptive to moving to cljc if that's an obstacle...

markmandel 2015-11-26T17:30:52.000525Z

@seancorfield So expectations looks interesting, but there is zero mentions of cljs support on the website and/or how to get up and running with it in cljs, which makes me hesitant to adopt it.

roelof 2015-11-26T18:14:34.000526Z

Is there somewhere a good tutorial or book how to learn to make tests with clojure

udit 2015-11-26T18:24:55.000527Z

I am just a humble beginner in clojure. But coming from a Java background I would say test.check knocked my socks off when it came to writing tests.

2015-11-26T18:25:56.000528Z

@roelof: clojure-cookbook has a chapter on testing that is a good start. https://github.com/clojure-cookbook/clojure-cookbook other than that, the book clojure applied has good stuff on testing as well. http://www.amazon.com/Clojure-Applied-Practitioner-Ben-Vandgrift/dp/1680500740/ref=sr_1_1?ie=UTF8&amp;qid=1448562345&amp;sr=8-1&amp;keywords=clojure+applied

roelof 2015-11-26T18:38:19.000530Z

@twillis: any book you recommend for a beginner.

roberto 2015-11-26T18:47:08.000531Z

@roelof: this is a great beginners book http://www.braveclojure.com/

roberto 2015-11-26T18:47:27.000532Z

also Living Clojure is explicitly targeting beginners

roberto 2015-11-26T18:48:22.000533Z

the author of Living Clojure discusses her book in this podcast http://blog.cognitect.com/cognicast/088

2015-11-26T19:03:21.000535Z

yep those

roelof 2015-11-26T19:39:38.000537Z

I have read braveclojure

roelof 2015-11-26T19:40:03.000538Z

I mean with my question which one book twillis mentioned is better for a beginner

jaen 2015-11-26T19:52:23.000539Z

Neither, really.

roelof 2015-11-26T20:14:05.000540Z

oke, I will continue reading brave and I hope when I ends that book , One of the books can be the next one

seancorfield 2015-11-26T20:19:45.000541Z

Having skimmed through both of those books I'd say the cookbook might be more approachable. Clojure Applied is awesome but it has some more advanced material in it.

seancorfield 2015-11-26T20:20:16.000542Z

They're both very practical books.

seancorfield 2015-11-26T20:20:54.000543Z

My other strong recommendation is Emerick's Clojure Programming on O'Reilly.

roelof 2015-11-26T20:25:46.000544Z

Thanks all.

roelof 2015-11-26T20:27:02.000545Z

@seancorfield: I had it all because of a question earlier about a state question for a toy project which I have in mind

roelof 2015-11-26T20:27:46.000546Z

I call it a day, Going watching tv and then I hope I sleep well. Tomorrow and Saterday very busy days