From 5595cfe8483466b133f4295536ebb63045a286a5 Mon Sep 17 00:00:00 2001 From: Steffen Schuemann Date: Sun, 23 Sep 2018 14:15:54 +0200 Subject: [PATCH] Support for test against clang 7.0.0 std::filesystem and fixing some recursive_directory_iterator test cases --- CMakeLists.txt | 2 +- test/filesystem_test.cpp | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f2801d1..757f8f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/test/filesystem_test.cpp b/test/filesystem_test.cpp index 8c4efdf..bf09359 100644 --- a/test/filesystem_test.cpp +++ b/test/filesystem_test.cpp @@ -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 { @@ -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; } @@ -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")); @@ -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"));