anchor.diff:      %% Make sure ?EUNIT_DIR/ directory exists (tack on dummy module)
       ok = filelib:ensure_dir(?EUNIT_DIR ++ "/foo"),
   
  -    %% grab all the test modules for inclusion in the compile stage
  +    %% Obtain all the test modules for inclusion in the compile stage.
  +    %% Notice: this could also be achieved with the following rebar.config option:
  +    %% {eunit_compile_opts, [{src_dirs, ["test"]}]}
       TestErls = rebar_utils:find_files("test", ".*\\.erl\$"),
   
       %% Compile erlang code to ?EUNIT_DIR, using a tweaked config
  
positive.code:             IsAvail
      end.
  
  cover_init(_Config) ->
      %% Make sure any previous runs of cover don't unduly influence
      cover:reset(),
  
      ?INFO("Cover compiling ~s\n", [rebar_utils:get_cwd()]),
  
      case cover:compile_beam_directory(?EUNIT_DIR) of
          {error, Reason2} ->
              ?ERROR("Cover compilation failed: ~p\n", [Reason2]),
              ?FAIL;
          Modules ->
              %% It's not an error for cover compilation to fail partially, but we do want
              %% to warn about them
              [?CONSOLE("Cover compilation warning: ~p", [Desc]) || {error, Desc} <- Modules],
  
              %% Identify the modules that were compiled successfully
              case [ M || {ok, M} <- Modules] of
                  [] ->
                      %% No modules compiled successfully...fail
                      ?ERROR("Cover failed to compile any modules; aborting.\n", []),
                      ?FAIL;
                  _ ->
                      %% At least one module compiled successfully
                      ok
              end
      end.
  
  cover_analyze(_Config, []) ->
      ok;
  cover_analyze(_Config, Modules) ->
      %% Generate coverage info for all the cover-compiled modules
      Coverage = [cover_analyze_mod(M) || M <- Modules],
  
      %% Write index of coverage info
      cover_write_index(lists:sort(Coverage)),
  
      %% Write coverage details for each file
      [{ok, _} = cover:analyze_to_file(M, cover_file(M), [html]) || {M, _, _} <- Coverage],
  
      Index = filename:join([rebar_utils:get_cwd(), ?EUNIT_DIR, "index.html"]),
      ?CONSOLE("Cover analysis: ~s\n", [Index]).
  
  
  cover_analyze_mod(Module) ->
      case cover:analyze(Module, coverage, module) of
  
negative.code: cover_file(Module) ->
      filename:join([?EUNIT_DIR, atom_to_list(Module) ++ ".COVER.html"]).
  
  percentage(Cov, NotCov) ->
      trunc((Cov / (Cov + NotCov)) * 100).
  