@@ -210,6 +210,28 @@ defmodule FileTest do
210210
211211 File . mkdir ( dest )
212212
213+ try do
214+ refute File . exists? ( tmp_path ( "tmp/cp_r/a/1.txt" ) )
215+ refute File . exists? ( tmp_path ( "tmp/cp_r/a/a/2.txt" ) )
216+ refute File . exists? ( tmp_path ( "tmp/cp_r/b/3.txt" ) )
217+
218+ { :ok , files } = File . cp_r ( src , dest )
219+ assert length ( files ) == 7
220+
221+ assert File . exists? ( tmp_path ( "tmp/cp_r/a/1.txt" ) )
222+ assert File . exists? ( tmp_path ( "tmp/cp_r/a/a/2.txt" ) )
223+ assert File . exists? ( tmp_path ( "tmp/cp_r/b/3.txt" ) )
224+ after
225+ File . rm_rf dest
226+ end
227+ end
228+
229+ test :cp_r_with_src_dir_slash_and_dest_dir do
230+ src = fixture_path ( "cp_r" ) <> "/"
231+ dest = tmp_path ( "tmp" )
232+
233+ File . mkdir ( dest )
234+
213235 try do
214236 refute File . exists? ( tmp_path ( "tmp/a/1.txt" ) )
215237 refute File . exists? ( tmp_path ( "tmp/a/a/2.txt" ) )
@@ -265,7 +287,7 @@ defmodule FileTest do
265287 end
266288
267289 test :cp_r_with_dir_and_file_conflict do
268- src = fixture_path ( "cp_r/." )
290+ src = fixture_path ( "cp_r" ) <> "/"
269291 dest = tmp_path ( "tmp" )
270292
271293 try do
@@ -278,7 +300,7 @@ defmodule FileTest do
278300 end
279301
280302 test :cp_r_with_src_dir_and_dest_dir_using_lists do
281- src = fixture_path ( "cp_r/. " ) |> to_char_list
303+ src = ( fixture_path ( "cp_r" ) <> "/ ") |> to_char_list
282304 dest = tmp_path ( "tmp" ) |> to_char_list
283305
284306 File . mkdir ( dest )
@@ -301,7 +323,7 @@ defmodule FileTest do
301323 end
302324
303325 test :cp_r_with_src_with_file_conflict do
304- src = fixture_path ( "cp_r/." )
326+ src = fixture_path ( "cp_r" ) <> "/"
305327 dest = tmp_path ( "tmp" )
306328
307329 File . mkdir_p tmp_path ( "tmp/a" )
@@ -317,7 +339,7 @@ defmodule FileTest do
317339 end
318340
319341 test :cp_r_with_src_with_file_conflict_callback do
320- src = fixture_path ( "cp_r/." )
342+ src = fixture_path ( "cp_r" ) <> "/"
321343 dest = tmp_path ( "tmp" )
322344
323345 File . mkdir_p tmp_path ( "tmp/a" )
@@ -337,7 +359,7 @@ defmodule FileTest do
337359 end
338360
339361 test :cp_r! do
340- src = fixture_path ( "cp_r/." )
362+ src = fixture_path ( "cp_r" ) <> "/"
341363 dest = tmp_path ( "tmp" )
342364
343365 File . mkdir ( dest )
@@ -770,7 +792,7 @@ defmodule FileTest do
770792 test :rm_rf do
771793 fixture = tmp_path ( "tmp" )
772794 File . mkdir ( fixture )
773- File . cp_r! ( fixture_path ( "cp_r/." ) , fixture )
795+ File . cp_r! ( fixture_path ( "cp_r" ) <> "/" , fixture )
774796
775797 assert File . exists? ( tmp_path ( "tmp/a/1.txt" ) )
776798 assert File . exists? ( tmp_path ( "tmp/a/a/2.txt" ) )
@@ -811,7 +833,7 @@ defmodule FileTest do
811833 test :rm_rf_with_char_list do
812834 fixture = tmp_path ( "tmp" ) |> to_char_list
813835 File . mkdir ( fixture )
814- File . cp_r! ( fixture_path ( "cp_r/." ) , fixture )
836+ File . cp_r! ( fixture_path ( "cp_r" ) <> "/" , fixture )
815837
816838 assert File . exists? ( tmp_path ( "tmp/a/1.txt" ) )
817839 assert File . exists? ( tmp_path ( "tmp/a/a/2.txt" ) )
@@ -847,7 +869,7 @@ defmodule FileTest do
847869 test :rm_rf! do
848870 fixture = tmp_path ( "tmp" )
849871 File . mkdir ( fixture )
850- File . cp_r! ( fixture_path ( "cp_r/." ) , fixture )
872+ File . cp_r! ( fixture_path ( "cp_r" ) <> "/" , fixture )
851873
852874 assert File . exists? ( tmp_path ( "tmp/a/1.txt" ) )
853875 assert File . exists? ( tmp_path ( "tmp/a/a/2.txt" ) )
0 commit comments