summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Brown <russell.brown@mac.com>2010-07-04 22:14:56 +0100
committerRussell Brown <russell.brown@mac.com>2010-07-04 22:14:56 +0100
commite4772c0763e114b490bb32aeec01fe69997d85bf (patch)
treed5dc35c5d9cd54842aeb19bf28c260b769d1466d
parent688430fac0ecc5645512966fea263df607cd88e0 (diff)
beam_lib:chunks needs abs path to beam.
Uses code:which or cover:is_compiled to get path the beam for chunks
-rw-r--r--src/rebar_eunit.erl9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/rebar_eunit.erl b/src/rebar_eunit.erl
index b9107ef..67559ca 100644
--- a/src/rebar_eunit.erl
+++ b/src/rebar_eunit.erl
@@ -280,7 +280,14 @@ has_eunit_test_fun(Mod) ->
F == test]) =/= 0.
has_header(Mod, Header) ->
- {ok, {_, [{abstract_code, {_, AC}}]}} = beam_lib:chunks(Mod, [abstract_code]),
+ Mod1 = case code:which(Mod) of
+ cover_compiled ->
+ {file, File} = cover:is_compiled(Mod),
+ File;
+ undefined -> Mod;
+ L -> L
+ end,
+ {ok, {_, [{abstract_code, {_, AC}}]}} = beam_lib:chunks(Mod1, [abstract_code]),
length([F || {attribute, 1, file, {F, 1}} <- AC,
string:str(F, Header) =/= 0]) =/= 0.