@@ -210,6 +210,28 @@ defmodule FileTest do
210
210
211
211
File . mkdir ( dest )
212
212
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
+
213
235
try do
214
236
refute File . exists? ( tmp_path ( "tmp/a/1.txt" ) )
215
237
refute File . exists? ( tmp_path ( "tmp/a/a/2.txt" ) )
@@ -265,7 +287,7 @@ defmodule FileTest do
265
287
end
266
288
267
289
test :cp_r_with_dir_and_file_conflict do
268
- src = fixture_path ( "cp_r/." )
290
+ src = fixture_path ( "cp_r" ) <> "/"
269
291
dest = tmp_path ( "tmp" )
270
292
271
293
try do
@@ -278,7 +300,7 @@ defmodule FileTest do
278
300
end
279
301
280
302
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
282
304
dest = tmp_path ( "tmp" ) |> to_char_list
283
305
284
306
File . mkdir ( dest )
@@ -301,7 +323,7 @@ defmodule FileTest do
301
323
end
302
324
303
325
test :cp_r_with_src_with_file_conflict do
304
- src = fixture_path ( "cp_r/." )
326
+ src = fixture_path ( "cp_r" ) <> "/"
305
327
dest = tmp_path ( "tmp" )
306
328
307
329
File . mkdir_p tmp_path ( "tmp/a" )
@@ -317,7 +339,7 @@ defmodule FileTest do
317
339
end
318
340
319
341
test :cp_r_with_src_with_file_conflict_callback do
320
- src = fixture_path ( "cp_r/." )
342
+ src = fixture_path ( "cp_r" ) <> "/"
321
343
dest = tmp_path ( "tmp" )
322
344
323
345
File . mkdir_p tmp_path ( "tmp/a" )
@@ -337,7 +359,7 @@ defmodule FileTest do
337
359
end
338
360
339
361
test :cp_r! do
340
- src = fixture_path ( "cp_r/." )
362
+ src = fixture_path ( "cp_r" ) <> "/"
341
363
dest = tmp_path ( "tmp" )
342
364
343
365
File . mkdir ( dest )
@@ -770,7 +792,7 @@ defmodule FileTest do
770
792
test :rm_rf do
771
793
fixture = tmp_path ( "tmp" )
772
794
File . mkdir ( fixture )
773
- File . cp_r! ( fixture_path ( "cp_r/." ) , fixture )
795
+ File . cp_r! ( fixture_path ( "cp_r" ) <> "/" , fixture )
774
796
775
797
assert File . exists? ( tmp_path ( "tmp/a/1.txt" ) )
776
798
assert File . exists? ( tmp_path ( "tmp/a/a/2.txt" ) )
@@ -811,7 +833,7 @@ defmodule FileTest do
811
833
test :rm_rf_with_char_list do
812
834
fixture = tmp_path ( "tmp" ) |> to_char_list
813
835
File . mkdir ( fixture )
814
- File . cp_r! ( fixture_path ( "cp_r/." ) , fixture )
836
+ File . cp_r! ( fixture_path ( "cp_r" ) <> "/" , fixture )
815
837
816
838
assert File . exists? ( tmp_path ( "tmp/a/1.txt" ) )
817
839
assert File . exists? ( tmp_path ( "tmp/a/a/2.txt" ) )
@@ -847,7 +869,7 @@ defmodule FileTest do
847
869
test :rm_rf! do
848
870
fixture = tmp_path ( "tmp" )
849
871
File . mkdir ( fixture )
850
- File . cp_r! ( fixture_path ( "cp_r/." ) , fixture )
872
+ File . cp_r! ( fixture_path ( "cp_r" ) <> "/" , fixture )
851
873
852
874
assert File . exists? ( tmp_path ( "tmp/a/1.txt" ) )
853
875
assert File . exists? ( tmp_path ( "tmp/a/a/2.txt" ) )
0 commit comments