Skip to content

Commit

Permalink
Support for test against clang 7.0.0 std::filesystem and fixing some …
Browse files Browse the repository at this point in the history
…recursive_directory_iterator test cases
  • Loading branch information
gulrak committed Sep 23, 2018
1 parent d097c95 commit 5595cfe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if(CMAKE_GENERATOR STREQUAL Xcode)
target_link_libraries(filesystem_test_cov PRIVATE --coverage)
endif()

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 8.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0))
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 7.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0))
include_directories(/usr/local/opt/llvm/include)
link_directories(/usr/local/opt/llvm/lib)
add_executable(std_filesystem_test test/filesystem_test.cpp filesystem.h test/catch.hpp)
Expand Down
12 changes: 7 additions & 5 deletions test/filesystem_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ TEST_CASE("30.10.8.4.1 path constructors and destructor", "[filesystem][path][fs
CHECK("//host/foo/bar" == fs::path("//host/foo/bar"));
}

#if !defined(GHC_OS_WINDOWS) && !(defined(GCC_VERSION) && GCC_VERSION < 80100)
#if !defined(GHC_OS_WINDOWS) && !(defined(GCC_VERSION) && GCC_VERSION < 80100) && !defined(USE_STD_FS)
std::locale loc;
bool testUTF8Locale = false;
try {
Expand Down Expand Up @@ -1074,12 +1074,14 @@ TEST_CASE("30.10.14 class recursive_directory_iterator", "[filesystem][recursive
fs::recursive_directory_iterator rd1(t.path());
CHECK(fs::recursive_directory_iterator(rd1) != fs::recursive_directory_iterator());
fs::recursive_directory_iterator rd2(t.path());
CHECK(fs::recursive_directory_iterator(std::move(rd2)) == rd1);
CHECK(fs::recursive_directory_iterator(std::move(rd2)) != fs::recursive_directory_iterator());
fs::recursive_directory_iterator rd3(t.path(), fs::directory_options::skip_permission_denied);
CHECK(rd3.options() == fs::directory_options::skip_permission_denied);
fs::recursive_directory_iterator rd4;
rd4 = std::move(rd3);
CHECK(rd4 == rd1);
CHECK(rd4 != fs::recursive_directory_iterator());
CHECK_NOTHROW(++rd4);
CHECK(rd4 == fs::recursive_directory_iterator());
fs::recursive_directory_iterator rd5;
rd5 = rd4;
}
Expand Down Expand Up @@ -1165,7 +1167,7 @@ TEST_CASE("30.10.15.3 copy", "[filesystem][operations][fs.op.copy]")
generateFile("dir1/file2");
fs::create_directory("dir1/dir2");
generateFile("dir1/dir2/file3");
CHECK_NOTHROW(fs::copy("dir1", "dir3", fs::copy_options::create_symlinks | fs::copy_options::recursive));
REQUIRE_NOTHROW(fs::copy("dir1", "dir3", fs::copy_options::create_symlinks | fs::copy_options::recursive));
CHECK(!ec);
CHECK(fs::exists("dir3/file1"));
CHECK(fs::is_symlink("dir3/file1"));
Expand All @@ -1186,7 +1188,7 @@ TEST_CASE("30.10.15.3 copy", "[filesystem][operations][fs.op.copy]")
auto f2hl = fs::hard_link_count("dir1/file2");
auto f3hl = fs::hard_link_count("dir1/dir2/file3");
CHECK_NOTHROW(fs::copy("dir1", "dir3", fs::copy_options::create_hard_links | fs::copy_options::recursive, ec));
CHECK(!ec);
REQUIRE(!ec);
CHECK(fs::exists("dir3/file1"));
CHECK(fs::hard_link_count("dir1/file1") == f1hl + 1);
CHECK(fs::exists("dir3/file2"));
Expand Down

0 comments on commit 5595cfe

Please sign in to comment.