diff options
author | Alexey Romanov <alexey.v.romanov@gmail.com> | 2011-02-21 12:41:20 +0300 |
---|---|---|
committer | Alexey Romanov <alexey.v.romanov@gmail.com> | 2011-02-21 12:41:20 +0300 |
commit | 7dc371d8a3b9a6e2ab9f814c0d2536cf638ceb99 (patch) | |
tree | 174193ae08d2824164ba99e63f696a6593ee63c6 /test/rebar_file_utils_tests.erl | |
parent | 2ceeb3272139b7569c8dabc215ca1e7063b0d385 (diff) | |
parent | 6056c63eed288736c912c82d6f36aa7dd055f9ca (diff) |
Merge branch 'master' of https://github.com/basho/rebar
Diffstat (limited to 'test/rebar_file_utils_tests.erl')
-rw-r--r-- | test/rebar_file_utils_tests.erl | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/test/rebar_file_utils_tests.erl b/test/rebar_file_utils_tests.erl index 6b87986..ea8ccf9 100644 --- a/test/rebar_file_utils_tests.erl +++ b/test/rebar_file_utils_tests.erl @@ -1,4 +1,4 @@ -%% -*- tab-width: 4;erlang-indent-level: 4;indent-tabs-mode: nil -*- +%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*- %% ex: ts=4 sw=4 et %% ------------------------------------------------------------------- %% @@ -96,7 +96,7 @@ cp_r_file_to_file_test_() -> filename:join([?TMP_DIR,"dest","new_file"])) end, fun teardown/1, - [?_assert(filelib:is_file(filename:join([?TMP_DIR,"dest","new_file"])))]}. + [?_assert(filelib:is_regular(filename:join([?TMP_DIR,"dest","new_file"])))]}. cp_r_file_to_dir_test_() -> {"cp_r copies a file to directory", @@ -107,7 +107,7 @@ cp_r_file_to_dir_test_() -> filename:join([?TMP_DIR,"dest"])) end, fun teardown/1, - [?_assert(filelib:is_file(filename:join([?TMP_DIR,"dest","file1"])))]}. + [?_assert(filelib:is_regular(filename:join([?TMP_DIR,"dest","file1"])))]}. cp_r_dir_to_dir_test_() -> {"cp_r copies a directory to directory", @@ -132,7 +132,7 @@ cp_r_wildcard_file_to_dir_test_() -> filename:join([?TMP_DIR,"dest"])) end, fun teardown/1, - [?_assert(filelib:is_file(filename:join([?TMP_DIR,"dest","file1"])))]}. + [?_assert(filelib:is_regular(filename:join([?TMP_DIR,"dest","file1"])))]}. cp_r_wildcard_dir_to_dir_test_() -> {"cp_r copies wildcard directory to directory", @@ -215,6 +215,18 @@ cp_r_overwrite_dir_fail_test_() -> [filename:join([?TMP_DIR,"source"])], filename:join([?TMP_DIR,"dest"])))]}. +mv_file_test_() -> + {"move a file to folder", + setup, + fun() -> + setup(), + rebar_file_utils:mv(filename:join([?TMP_DIR,"source","file1"]), + filename:join([?TMP_DIR,"dest"])) + end, + fun teardown/1, + [?_assert(filelib:is_regular(filename:join([?TMP_DIR,"dest","file1"]))), + ?_assertNot(filelib:is_regular(filename:join([?TMP_DIR,"source","file1"])))]}. + %% ==================================================================== %% Utilities %% ==================================================================== @@ -254,12 +266,12 @@ teardown(_) -> %% ==================================================================== assert_files_in(Name, [File|T]) -> - [{Name ++ " has file: " ++ File, ?_assert(filelib:is_file(File))} | + [{Name ++ " has file: " ++ File, ?_assert(filelib:is_regular(File))} | assert_files_in(Name, T)]; assert_files_in(_, []) -> []. assert_files_not_in(Name, [File|T]) -> [{Name ++ " does not have file: " ++ File, - ?_assertNot(filelib:is_file(File))} | + ?_assertNot(filelib:is_regular(File))} | assert_files_not_in(Name, T)]; assert_files_not_in(_, []) -> []. |