anchor.diff:              BaseOpts = []
       end,
   
  +    %% If cover support is requested, set it up
  +    case rebar_config:get(Config, cover_enabled, false) of
  +        true ->
  +            cover_init(Config);
  +        _ ->
  +            ok
  +    end,
  +
       %% Run eunit
       EunitOpts = BaseOpts ++ rebar_config:get_list(Config, eunit_opts, []),
  -    case catch(eunit:test({dir, ?EUNIT_DIR}, EunitOpts)) of
  +    EunitResult = (catch eunit:test(Modules, EunitOpts)),
  +
  +    %% Analyze cover modules
  +    cover_analyze(Config, cover:modules()),
  +
  +    case EunitResult of
           ok ->
               ok;
           _ ->
               ?CONSOLE("One or more eunit tests failed.\n", []),
               ?FAIL
       end,
  +
   
       %% Restore code path
       true = code:set_path(InitCodePath),
  
positive.code:             IsAvail
      end.
                            
  
  
negative.code:     ok = filelib:ensure_dir(?EUNIT_DIR ++ "/foo"),
  
      %% Compile all erlang from src/ into ?EUNIT_DIR
      rebar_erlc_compiler:do_compile(Config, "src/*.erl", ?EUNIT_DIR, ".erl", ".beam",
                                     fun compile_erl/2,
                                     rebar_config:get_list(Config, erl_first_files, [])),
  
      %% Build a list of all the .beams in ?EUNIT_DIR -- use this for cover
      %% and eunit testing. Normally you can just tell cover and/or eunit to
      %% scan the directory for you, but eunit does a code:purge in conjunction
      %% with that scan and causes any cover compilation info to be lost. So,
      %% we do it by hand. :(
      Modules = [list_to_atom(filename:basename(N, ".beam")) ||
                    N <- filelib:wildcard("*.beam", "ebin")],
  
      %% TODO: If there are other wildcards specified in eunit_sources, compile them
  
  