From 9ab0046b6c28ff074fdc0c1c29a9a54aa9c59093 Mon Sep 17 00:00:00 2001 From: Ryo Nakamura Date: Tue, 12 Aug 2025 14:46:31 +0900 Subject: [PATCH] add test_dst_has_suffix_slash for #24 --- test/test_e2e.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/test_e2e.py b/test/test_e2e.py index 068c5e2..2962d35 100644 --- a/test/test_e2e.py +++ b/test/test_e2e.py @@ -226,6 +226,25 @@ def test_copy_file_under_root_to_dir(mscp, src_prefix, dst_prefix): src.cleanup() dst.cleanup(preserve_dir = True) +@pytest.mark.parametrize("src_prefix, dst_prefix", param_remote_prefix) +def test_dst_has_suffix_slash(mscp, src_prefix, dst_prefix): + """ + if dst path has suffix '/' like "dir/" and does not exist, + mscp should create dir/ and put dir/src-file-name. + """ + dstdir = "non_existent_dstdir/" + shutil.rmtree(dstdir, ignore_errors=True) + + src = File("src", size = 1024 * 1024).make() + dst = File(f"{dstdir}/src") + + run2ok([mscp, "-vvv", src_prefix + src.path, + dst_prefix + dstdir]) + + assert check_same_md5sum(src, dst) + src.cleanup() + dst.cleanup() + @pytest.mark.parametrize("src_prefix, dst_prefix", param_remote_prefix) def test_min_chunk(mscp, src_prefix, dst_prefix):