Permalink
Browse files

Merge pull request #53 from oferrigni/unit_test_file_handling_fix

Fix file handling on windows for tests
  • Loading branch information...
2 parents baf2655 + d893708 commit c5e8671ef68d0b51ac3a5e60cdbc7cf63727ff92 @dizzyd dizzyd committed Jun 16, 2013
Showing with 11 additions and 3 deletions.
  1. +11 −3 test/rebar_eunit_tests.erl
View
@@ -337,7 +337,15 @@ basic_setup_test_() ->
"myfunc_test() -> ?assertMatch(ok, myapp_mymod:myfunc()).\n"]).
make_tmp_dir() ->
- ok = file:make_dir(?TMP_DIR).
+ case file:make_dir(?TMP_DIR) of
+ ok ->
+ ok;
+ {error, eexist} ->
+ remove_tmp_dir(),
+ make_tmp_dir();
+ Error ->
+ throw(Error)
+ end.
setup_environment() ->
ok = make_tmp_dir(),
@@ -389,8 +397,8 @@ prepare_rebar_script() ->
{unix, _} ->
[] = os:cmd("chmod u+x " ++ Rebar);
{win32, _} ->
- {ok, _} = file:copy(?REBAR_SCRIPT ++ ".bat",
- ?TMP_DIR ++ "rebar.bat")
+ {ok, _} = file:copy(?REBAR_SCRIPT ++ ".cmd",
+ ?TMP_DIR ++ "rebar.cmd")
end.
rebar() ->

0 comments on commit c5e8671

Please sign in to comment.