So a bit of constructive feedback on Fudje, firstly, I like that it's
pretty simple, I can take bits I want and leave bits I don't, so
good work on that.
But I do have a issue with the sweet.clj syntax, and I think it's
best exemplified by the code found in the intro:
(testing "arg-checker in mocking vector"
(mocking [(f (just {:a (contains [2 3])
:b (has every? keyword?)})) => :some-number]
(is (= :some-number (f {:a [1 2 3 4] :b #{:x :y :z}})))))
This is a good example of a DSL, and it falls under the criticisms I
level at most DSLs, mainly they aren't Clojure. If we dive into
sweet.clj and the surrounding namespaces we see a good example of a
parser (from clojure to a AST) and a execution engine (via the
protocols). You wrote a programming language, congrats!
But with that DSL comes some baggage, it's no longer Clojure. Now my
code is written in one language and my tests in another. I must now
go and read the Fudje docs to understand the syntax and the
evaluation order/semantics. I know these are mostly taken from Midje,
but that's one of my criticisms about that library as well.
Instead, I would prefer to just use something like the following
(testing "arguments are sane"
(is (contains (:a input) [2 3]))
(is (every? keyword? (:b input))))
Now any Clojure programmer that comes after me can easily understand
what's going on, since everything is written in the same language.
There's still room for more advanced testing predicates, and even the
mocking macro may have its place. But I'd recommend dropping the DSL.
Timothy
On Wed, Jan 27, 2016 at 12:47 PM, dimitris <jimpil1...@gmail.com
<mailto:jimpil1...@gmail.com>> wrote:
Hi Brian,
Thanks for your kind words and, of course, for midje...I've been
using it for years!
About the AOT issues, i was mainly referring to this:
https://github.com/marick/Midje/issues/274
In addition, where i work we have to package our
'harness-testing' module separately and not AOT it. That has
generally worked nicely, and taking a step back it seems like
good practice to package all your testing infrastructure
separately, but the fact that we can't is unfortunate
nonetheless. Has something changed in terms of this issue that
I'm not aware of? If yes, please forgive me for 'misleading'- i
will fix asap!
Thanks again...
Cheers,
dimitris
On 26/01/16 23:42, Brian Marick wrote:
dimitris wrote:
This is a small testing library inspired by midje.
For what it's worth, I (author of Midje) think this is wonderful.
You might consider emphasizing that you have similar
checkers, as I think that's one of Midje's strong points.
I've been recently incorporating
https://github.com/marick/structural-typing/ to get better
error messages when checking collections. Like this:
The checker said this about the reason:
[0 :a :b] should be `even?`; it is `1`
[1 :c] must exist and be non-nil
[2 :a :b] should be `neg?`; it is `2`
Otherwise:
1) The implementation is utterly intimidating (i' ve
heard this from
plenty other people)
Yeah. It started as my project to learn Clojure, so it's
not... um... the way I write code today.
2) Doesn't play nicely with AOT
At two companies, I've used Midje and deployed AOT-compiled
uberjars. It would be interesting to have a specific example
of the problem.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be
patient with your first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
<mailto:clojure%2bunsubscr...@googlegroups.com>
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- You received this message because you are subscribed to the
Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to clojure+unsubscr...@googlegroups.com
<mailto:clojure%2bunsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.
--
“One of the main causes of the fall of the Roman Empire was
that–lacking zero–they had no way to indicate successful termination
of their C programs.”
(Robert Firth)
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient
with your first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to clojure+unsubscr...@googlegroups.com
<mailto:clojure+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.