std::errc expected_err;
} TestCases[] = {
{env.create_dir("dir"), std::errc::is_a_directory},
+#ifndef _WIN32
{env.create_fifo("fifo"), std::errc::not_supported},
+#endif
{env.create_directory_symlink("dir", "sym"), std::errc::is_a_directory}};
for (auto const& TC : TestCases) {
scoped_test_env env;
path f = env.create_file("foo", 42);
path d = env.create_dir("dir");
- path fifo = env.create_fifo("fifo");
path hl = env.create_hardlink("foo", "hl");
- for (auto p : {hl, f, d, fifo}) {
+ auto test_path = [=](const path &p) {
directory_entry e(p);
file_status st = status(p);
file_status sym_st = symlink_status(p);
TEST_CHECK(e.is_regular_file() == is_regular_file(st));
TEST_CHECK(e.is_socket() == is_socket(st));
TEST_CHECK(e.is_symlink() == is_symlink(sym_st));
- }
+ };
+ test_path(f);
+ test_path(d);
+ test_path(hl);
+#ifndef _WIN32
+ path fifo = env.create_fifo("fifo");
+ test_path(fifo);
+#endif
}
TEST_CASE(test_with_ec) {
scoped_test_env env;
path f = env.create_file("foo", 42);
path d = env.create_dir("dir");
- path fifo = env.create_fifo("fifo");
path hl = env.create_hardlink("foo", "hl");
- for (auto p : {hl, f, d, fifo}) {
+ auto test_path = [=](const path &p) {
directory_entry e(p);
std::error_code status_ec = GetTestEC();
std::error_code sym_status_ec = GetTestEC(1);
TEST_CHECK(e.is_symlink(ec) == is_symlink(sym_st));
TEST_CHECK(CheckEC(sym_status_ec));
- }
+ };
+ test_path(f);
+ test_path(d);
+ test_path(hl);
+#ifndef _WIN32
+ path fifo = env.create_fifo("fifo");
+ test_path(fifo);
+#endif
}
TEST_CASE(test_with_ec_dne) {
scoped_test_env env;
const path dir = env.create_dir("dir");
const path dir2 = env.create_dir("dir/dir2");
- const path fifo = env.create_fifo("dir/fifo");
- const path sym_to_fifo = env.create_symlink("dir/fifo", "dir/sym");
const perms old_perms = status(dir).permissions();
- for (auto p : {dir2, fifo, sym_to_fifo}) {
- permissions(dir, old_perms);
+ auto test_path = [=](const path &p) {
std::error_code dummy_ec = GetTestEC();
directory_entry ent(p, dummy_ec);
TEST_CHECK(!dummy_ec);
TEST_CHECK(ent.hard_link_count(ec) == expect);
TEST_CHECK(!ec);
TEST_CHECK_NO_THROW(ent.hard_link_count());
- }
+ permissions(dir, old_perms);
+ };
+ test_path(dir2);
+#ifndef _WIN32
+ const path fifo = env.create_fifo("dir/fifo");
+ const path sym_to_fifo = env.create_symlink("dir/fifo", "dir/sym");
+ test_path(fifo);
+ test_path(sym_to_fifo);
+#endif
}
TEST_CASE(error_reporting) {
scoped_test_env env;
const path file = env.create_file("file1", 42);
const path dir = env.create_dir("dir");
+#ifndef _WIN32
const path fifo = env.create_fifo("fifo");
TEST_REQUIRE(is_other(fifo));
+#endif
const auto test_ec = GetTestEC();
TEST_REQUIRE(ec != test_ec);
TEST_CHECK(checkThrow(dir, file, ec));
}
+#ifndef _WIN32
{ // is_other(from)
std::error_code ec = test_ec;
fs::copy(fifo, dir, ec);
TEST_REQUIRE(ec != test_ec);
TEST_CHECK(checkThrow(file, fifo, ec));
}
+#endif
}
TEST_CASE(from_is_symlink)
}
}
+#ifndef _WIN32
TEST_CASE(non_regular_file_test) {
scoped_test_env env;
const path fifo = env.create_fifo("fifo");
}
}
+#endif
TEST_CASE(test_attributes_get_copied) {
scoped_test_env env;
TEST_CHECK(equivalent(hl1, hl2));
}
+#ifndef _WIN32
TEST_CASE(equivalent_is_other_succeeds) {
scoped_test_env env;
path const file = env.create_file("file", 42);
TEST_CHECK(!equivalent(fifo1, fifo2));
TEST_CHECK(equivalent(fifo1, fifo1));
}
+#endif
TEST_SUITE_END()
}
+#ifndef _WIN32
TEST_CASE(test_fifo_fails)
{
scoped_test_env env;
TEST_CHECK_THROW(filesystem_error, is_empty(fifo));
}
+#endif
TEST_SUITE_END()
#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(_WIN32) // No support for domain sockets
{env.create_socket("socket"), file_type::socket},
#endif
+#ifndef _WIN32
{env.create_fifo("fifo"), file_type::fifo}
+#endif
};
for (const auto& TC : cases) {
// test non-throwing case
#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(_WIN32) // No support for domain sockets
{env.create_socket("socket"), file_type::socket},
#endif
+#ifndef _WIN32
{env.create_fifo("fifo"), file_type::fifo}
+#endif
};
for (const auto& TC : cases) {
// test non-throwing case