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

Function remove_tests

test/operations_test.cpp:1417–1454  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1415// remove_tests --------------------------------------------------------------------//
1416
1417void remove_tests(const fs::path& dirx)
1418{
1419 cout << "remove_tests..." << endl;
1420
1421 // remove() file
1422 fs::path f1x = dirx / "shortlife";
1423 BOOST_TEST(!fs::exists(f1x));
1424 create_file(f1x, "");
1425 BOOST_TEST(fs::exists(f1x));
1426 BOOST_TEST(!fs::is_directory(f1x));
1427 BOOST_TEST(fs::remove(f1x));
1428 BOOST_TEST(!fs::exists(f1x));
1429 BOOST_TEST(!fs::remove("no-such-file"));
1430 BOOST_TEST(!fs::remove("no-such-directory/no-such-file"));
1431
1432#if defined(BOOST_FILESYSTEM_WINDOWS_API)
1433 // remove() read-only file
1434 BOOST_TEST(!fs::exists(f1x));
1435 create_file(f1x, "");
1436 BOOST_TEST(fs::exists(f1x));
1437 BOOST_TEST(!fs::is_directory(f1x));
1438 set_read_only(f1x);
1439 BOOST_TEST(fs::remove(f1x));
1440 BOOST_TEST(!fs::exists(f1x));
1441#endif // defined(BOOST_FILESYSTEM_WINDOWS_API)
1442
1443 // remove() directory
1444 fs::path d1x = dirx / "shortlife_dir";
1445 BOOST_TEST(!fs::exists(d1x));
1446 fs::create_directory(d1x);
1447 BOOST_TEST(fs::exists(d1x));
1448 BOOST_TEST(fs::is_directory(d1x));
1449 BOOST_TEST(fs::is_empty(d1x));
1450 bad_remove_dir = dirx;
1451 BOOST_TEST(CHECK_EXCEPTION(bad_remove, ENOTEMPTY));
1452 BOOST_TEST(fs::remove(d1x));
1453 BOOST_TEST(!fs::exists(d1x));
1454}
1455
1456// remove_symlink_tests ------------------------------------------------------------//
1457

Callers 1

cpp_mainFunction · 0.85

Calls 7

set_read_onlyFunction · 0.85
create_fileFunction · 0.70
existsFunction · 0.50
is_directoryFunction · 0.50
removeFunction · 0.50
create_directoryFunction · 0.50
is_emptyFunction · 0.50

Tested by

no test coverage detected