MCPcopy Create free account
hub / github.com/boostorg/filesystem / test_copy_dir_default_ec

Function test_copy_dir_default_ec

test/copy_test.cpp:147–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147void test_copy_dir_default_ec(fs::path const& root_dir, bool with_symlinks)
148{
149 // This test is similar to test_copy_dir_default, but uses an error_code overload of the operation.
150 // Tests for https://github.com/boostorg/filesystem/issues/152 fix.
151
152 std::cout << "test_copy_dir_default_ec" << std::endl;
153
154 fs::path target_dir = fs::unique_path();
155
156 boost::system::error_code ec;
157 fs::copy(root_dir, target_dir, ec);
158 BOOST_TEST(!ec);
159
160 directory_tree tree = collect_directory_tree(target_dir);
161
162 BOOST_TEST_EQ(tree.size(), 4u + with_symlinks);
163 BOOST_TEST(tree.find("f1") != tree.end());
164 BOOST_TEST(tree.find("f2") != tree.end());
165 BOOST_TEST(tree.find("d1") != tree.end());
166 BOOST_TEST(tree.find("d2") != tree.end());
167 if (with_symlinks)
168 {
169 BOOST_TEST(tree.find("s1") != tree.end());
170 }
171
172 verify_file(target_dir / "f1", "f1");
173 verify_file(target_dir / "f2", "f2");
174
175 fs::remove_all(target_dir);
176}
177
178void test_copy_dir_recursive(fs::path const& root_dir)
179{

Callers 1

mainFunction · 0.85

Calls 7

collect_directory_treeFunction · 0.85
verify_fileFunction · 0.70
unique_pathFunction · 0.50
copyFunction · 0.50
remove_allFunction · 0.50
sizeMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected