Reputation: 3335
I am using Rebar to build my erlang project and want to integrate it more tightly with Emacs. I found that if I add {cover_print_enabled, true}.
to my rebar config file I get code coverage in the build output.
However there is also an option cover_export_enabled
which outputs a binary file of some form. Is there an emacs plugin to parse that file and color code my code to show what code is covered by tests?
I really don't like having to switch to a browser to see code coverage.
Upvotes: 2
Views: 560
Reputation: 121
Just added this feature to rebar.el
in commit https://github.com/leoliu/rebar.el/commit/9ba8699ff6310721226b93341e62491ebfd0ee99
Leo
Upvotes: 0
Reputation: 41568
As far as I know, there is no such plugin.
The exported cover data file can be read as follows:
N
.N
bytes in Erlang binary term format. This can be decoded with binary_to_term/1.{'$size',X}
, then read X
bytes and decode as a term. (This happens when the binary representation of the term is longer than 255 bytes.)Distel has an Emacs Lisp implementation of binary_to_term
called erlext-read-obj in erlext.el.
I haven't looked into what to do with the terms in the file, once decoded, but hopefully this is enough to get someone started. Read lib/tools/src/cover.erl if in doubt.
Upvotes: 2