X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/8893e8cf0dfd542508e9e45d715ee0165b249bd8..2c0c6e6ba25ec56bab8c224865a7979af577adaa:/sdk/ruby/test/test_collection.rb diff --git a/sdk/ruby/test/test_collection.rb b/sdk/ruby/test/test_collection.rb index e96054bfbd..e2a39bc5ed 100644 --- a/sdk/ruby/test/test_collection.rb +++ b/sdk/ruby/test/test_collection.rb @@ -223,13 +223,17 @@ class CollectionTest < Minitest::Test assert_equal(expected.join(""), coll.manifest_text) end - def test_copy_stream_over_file_raises_ENOTDIR + def test_copy_stream_over_file_raises_ENOTDIR(source="./s1", target="./f2") coll = Arv::Collection.new(TWO_BY_TWO_MANIFEST_S) assert_raises(Errno::ENOTDIR) do - coll.cp_r("./s1", "./f2") + coll.cp_r(source, target) end end + def test_copy_file_under_file_raises_ENOTDIR + test_copy_stream_over_file_raises_ENOTDIR("./f1", "./f2/newfile") + end + def test_copy_stream_over_nonempty_stream_merges_and_overwrites blocks = random_blocks(3, 9) manifest_a = @@ -323,6 +327,20 @@ class CollectionTest < Minitest::Test assert_equal(expect_lines.join(""), coll.manifest_text) end + def test_copy_file_into_new_stream_with_implicit_filename + coll = Arv::Collection.new(SIMPLEST_MANIFEST) + coll.cp_r("./simple.txt", "./new/") + assert_equal(SIMPLEST_MANIFEST + SIMPLEST_MANIFEST.sub(". ", "./new "), + coll.manifest_text) + end + + def test_copy_file_into_new_stream_with_explicit_filename + coll = Arv::Collection.new(SIMPLEST_MANIFEST) + coll.cp_r("./simple.txt", "./new/newfile.txt") + new_line = SIMPLEST_MANIFEST.sub(". ", "./new ").sub(":simple", ":newfile") + assert_equal(SIMPLEST_MANIFEST + new_line, coll.manifest_text) + end + def test_copy_stream_contents_into_root coll = Arv::Collection.new(TWO_BY_TWO_MANIFEST_S) coll.cp_r("./s1/", ".")