Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add missing function from rebar_utils for compiling eunit tests #3

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/rebar_utils.erl
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,22 @@ filter_defines([{platform_define, ArchRegex, Key, Value} | Rest], Acc) ->
filter_defines([Opt | Rest], Acc) ->
filter_defines(Rest, [Opt | Acc]).

%% @doc Reset the path to what it looked like before loaded test modules
cleanup_code_path(OrigPath) ->
CurrentPath = code:get_path(),
AddedPaths = CurrentPath -- OrigPath,
%% If someone has removed paths, it's hard to get them back into
%% the right order, but since this is currently rare, we can just
%% fall back to code:set_path/1.
case CurrentPath -- AddedPaths of
OrigPath ->
_ = [code:del_path(Path) || Path <- AddedPaths],
true;
_ ->
code:set_path(OrigPath)
end.


%% @doc ident to the level specified
-spec indent(non_neg_integer()) -> iolist().
indent(Amount) when erlang:is_integer(Amount) ->
Expand Down