with-fakes
macro now asserts if dynamic bindings work correctly.
Specifically, this prevents its usage in core.async/go
blocks under ClojureScript because there's an unresolved issue
https://dev.clojure.org/jira/browse/CLJS-884 which led to not resetting *context*
back to nil
on exiting the faking block in previous clj-fakes versions.
This was a source of subtle bugs in async ClojureScript tests.with-fakes
macro now doesn't generate an anonymous function
so that it now can be used inside core.async/go
blocks.was-matched-once
and method-was-matched-once
.BREAKING CHANGE: matcher any?
is renamed to any
to fix v1.9 compiler warnings.
(ClojureScript) BREAKING CHANGE: required ClojureScript version updated from 1.7.28 to 1.9.229.
(ClojureScript) it's now possible to require library namespaces in the same way as you do it in Clojure:
(ns unit.example
(:require
[clj-fakes.core :as f]
[clj-fakes.context :as fc]))
were-called-in-order
now always marks all passed fakes as checked.
So that the self-test about unchecked fakes is not also triggered if some steps are not reached
because of an exception in were-called-in-order
.
Fixed: were-called-in-order
with any
args matcher in a failing step threw an incorrect exception.
with-fakes
should catch all Throwable
s, not only Exception
s,
otherwise original errors are not reported in case of self-test fail.(ClojureScript) it's now possible to implement any new methods under Object
in reify-fake
/reify-nice-fake
. E.g.:
(let [calculator (f/reify-fake Object
(sum [x y] :fake [[f/any? f/any?] #(+ %2 %3)]))]
(is (= 5 (.sum calculator 2 3))))
Better formatting of args matchers in assertion errors for protocol methods. E.g. before and after:
expected: (f/method-was-called p/speak cow [1 2 3])
actual: clojure.lang.ExceptionInfo: Function was never called with the expected args.
Args matcher: first: <any?>, rest: [1 2 3].
Actual calls: ...
expected: (f/method-was-called p/speak cow [1 2 3])
actual: clojure.lang.ExceptionInfo: Function was never called with the expected args.
Args matcher: <this> [1 2 3].
Actual calls: ...
New function clj-fakes.context/self-test
will run all available self-tests.
Better arg naming in API.
Fixed:
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close