Add tests <fstream> addition and update CMake

This commit is contained in:
Steffen Schümann 2026-07-11 21:22:17 +02:00
parent 603dacf69e
commit cdbf7835b4
3 changed files with 26 additions and 0 deletions

View File

@ -97,6 +97,14 @@ if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
endif()
add_test(fwd_impl_test fwd_impl_test)
if("cxx_std_17" IN_LIST GHC_FILESYSTEM_TEST_COMPILE_FEATURES)
add_executable(fs_std_header_test fs_std_header_test.cpp fs_std_fwd_header_test.cpp)
target_link_libraries(fs_std_header_test ghc_filesystem)
target_compile_features(fs_std_header_test PRIVATE cxx_std_17)
SetTestCompileOptions(fs_std_header_test)
add_test(fs_std_header_test fs_std_header_test)
endif()
add_executable(exception exception.cpp)
if(NOT MSVC)
target_compile_options(exception PRIVATE -fno-exceptions)

View File

@ -0,0 +1,8 @@
#define GHC_USE_STD_FS
#include <ghc/fs_std_fwd.hpp>
bool fs_std_fwd_header_test()
{
fs::fstream stream;
return stream.is_open();
}

View File

@ -0,0 +1,10 @@
#define GHC_USE_STD_FS
#include <ghc/fs_std.hpp>
bool fs_std_fwd_header_test();
int main()
{
fs::ifstream stream;
return stream.is_open() || fs_std_fwd_header_test() ? 1 : 0;
}