summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2017-01-27 12:19:08 -0500
committerFred Hebert <mononcqc@ferd.ca>2017-01-27 12:19:08 -0500
commitbc3b53f1e5d1a78d94c3cc2f68404ee41a1abd66 (patch)
tree021df7355ca1b07b86c583b64165f8023cc11146
parent92e6997cf128382f7596fcc546caceee9d10a428 (diff)
Rework test to work and pass on linux
to be roundtripped again to windows.
-rw-r--r--test/rebar_file_utils_SUITE.erl18
1 files changed, 11 insertions, 7 deletions
diff --git a/test/rebar_file_utils_SUITE.erl b/test/rebar_file_utils_SUITE.erl
index 949001d..4cc6a93 100644
--- a/test/rebar_file_utils_SUITE.erl
+++ b/test/rebar_file_utils_SUITE.erl
@@ -187,7 +187,7 @@ mv_dir(Config) ->
%% move files from dir to empty dir
F1 = filename:join(SrcDir, "file1"),
F2 = filename:join(SrcDir, "subdir/file2"),
- ec_file:mkdir_p(F2),
+ filelib:ensure_dir(F2),
file:write_file(F1, "hello"),
file:write_file(F2, "world"),
DstDir2 = filename:join(BaseDir, "dst2/"),
@@ -197,17 +197,20 @@ mv_dir(Config) ->
?assertEqual(ok, rebar_file_utils:mv(SrcDir, DstDir2)),
?assert(filelib:is_file(D2F1)),
?assert(filelib:is_file(D2F2)),
-
- %% move files from dir to existing dir
- ec_file:mkdir_p(F2),
+
+ %% move files from dir to existing dir moves it to
+ %% a subdir
+ filelib:ensure_dir(F2),
file:write_file(F1, "hello"),
file:write_file(F2, "world"),
DstDir3 = filename:join(BaseDir, "dst3/"),
- D3F1 = filename:join(DstDir3, "file1"),
- D3F2 = filename:join(DstDir3, "subdir/file2"),
+ D3F1 = filename:join(DstDir3, "src/file1"),
+ D3F2 = filename:join(DstDir3, "src/subdir/file2"),
ec_file:mkdir_p(DstDir3),
?assert(filelib:is_dir(DstDir3)),
?assertEqual(ok, rebar_file_utils:mv(SrcDir, DstDir3)),
+ ?assertNot(filelib:is_file(F1)),
+ ?assertNot(filelib:is_file(F2)),
?assert(filelib:is_file(D3F1)),
?assert(filelib:is_file(D3F2)),
?assertNot(filelib:is_dir(SrcDir)),
@@ -279,8 +282,9 @@ mv_file_dir_diff(Config) ->
F = filename:join(SrcDir, "file"),
file:write_file(F, "hello"),
DstDir = filename:join(BaseDir, "dst/"),
+ ec_file:mkdir_p(DstDir),
Dst = filename:join(DstDir, "file-rename"),
- ?assertNot(filelib:is_dir(DstDir)),
+ ?assert(filelib:is_dir(DstDir)),
?assertNot(filelib:is_file(Dst)),
?assertEqual(ok, rebar_file_utils:mv(F, Dst)),
?assert(filelib:is_file(Dst)),