Put simply, I would like the code shown below to behave how one could think it should behave, e.g. defining the left-hand side value (here as a trivial anonymous associative collection) just once and applying multiple different arrow functions (asserions) to it in a clean and idiomatic way:
(deftest test-test
(fact "some-fact"
{:a 1 :b 2}
=>
(contains {:a odd?}))
=not=>
(contains {:a even?})
)
This code obviously doesn't work: only =>
arrow actually asserts and =not=>
is irrelevant (e.g. if we change even?
to odd?
there the test still passes).
Maybe it's as simple as wrapping in let
or using def
, but being new to Clojure I would like to know what is the preferred way.