Simple clojure coverage tool. Currently requires clojure 1.4.
Simply add [lein-cloverage "1.0.2"] to :plugins in your .lein/profiles.clj
This library currently only supports clojure.test. You can get midje to work
by wrapping facts in deftest
declarations.
Run lein cloverage
in your project. See cloverage/coverage.clj for more
options.
There is no maven plugin right now. A workaround is to import this library in the
project being tested, then run:
mvn exec:java -Dexec.classpathScope=test -Dexec.mainClass='clojure.main' -Dexec.args='--main cloverage.coverage *args-to-coverage*'
Where args-to-coverage will usually be something like "-n 'ns.regex.' -t 'text.ns.regex.'"
IllegalArgumentException No matching field found: foo for class user.Bar clojure.lang.Reflector.getInstanceField (Reflector.java:271)
This is usually caused by protocols with methods starting with -. Before clojure 1.6:
user=> (defprotocol Foo (-foo [x] x))
Foo
user=> (deftype Bar [] Foo (-foo [_] "foo"))
user.Bar
user=> (-foo (Bar.))
"foo"
user=> ((do -foo) (Bar.))
IllegalArgumentException No matching field found: foo for class user.Bar clojure.lang.Reflector.getInstanceField (Reflector.java:271)
Since cloverage will wrap the -foo symbol to track whether it's accessed, you will get this error. Upgrade to clojure 1.6.
1.0.4-SNAPSHOT:
1.0.3:
Distributed under the Eclipse Public License, the same as Clojure.
Some code was taken from