diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2017-07-31 04:17:59 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2017-07-31 04:17:59 +0300 |
commit | 5b09081e7c4e7207627b22219ea4e484347105c7 (patch) | |
tree | 362b4b3572607398607ad715483822bc8821fa3b /test/tests/file_handle_create_close | |
parent | 7bdbe98195af49bea11e5c08283142bc2d9898da (diff) |
All tests are passing once again on Windows (if built with clang 5.0)
Diffstat (limited to 'test/tests/file_handle_create_close')
3 files changed, 25 insertions, 5 deletions
diff --git a/test/tests/file_handle_create_close/kernel_async_file_handle.cpp.hpp b/test/tests/file_handle_create_close/kernel_async_file_handle.cpp.hpp index 8010e3fd..1017cd1a 100644 --- a/test/tests/file_handle_create_close/kernel_async_file_handle.cpp.hpp +++ b/test/tests/file_handle_create_close/kernel_async_file_handle.cpp.hpp @@ -26,7 +26,7 @@ Distributed under the Boost Software License, Version 1.0. namespace file_handle_create_close { - AFIO_TEST_KERNEL_DECL AFIO_V2_NAMESPACE::result<AFIO_V2_NAMESPACE::async_file_handle> test_kernel_async_file_handle(AFIO_V2_NAMESPACE::async_file_handle::mode m, AFIO_V2_NAMESPACE::async_file_handle::creation c, AFIO_V2_NAMESPACE::async_file_handle::flag f) + AFIO_TEST_KERNEL_DECL AFIO_V2_NAMESPACE::result<AFIO_V2_NAMESPACE::async_file_handle> test_kernel_async_file_handle_absolute(AFIO_V2_NAMESPACE::async_file_handle::mode m, AFIO_V2_NAMESPACE::async_file_handle::creation c, AFIO_V2_NAMESPACE::async_file_handle::flag f) { AFIO_V2_NAMESPACE::io_service service; auto h = AFIO_V2_NAMESPACE::async_file_handle::async_file(service, {}, "testfile.txt", m, c, AFIO_V2_NAMESPACE::async_file_handle::caching::all, f); @@ -34,4 +34,14 @@ namespace file_handle_create_close h.value().close().value(); return h; } + AFIO_TEST_KERNEL_DECL AFIO_V2_NAMESPACE::result<AFIO_V2_NAMESPACE::async_file_handle> test_kernel_async_file_handle_relative(AFIO_V2_NAMESPACE::async_file_handle::mode m, AFIO_V2_NAMESPACE::async_file_handle::creation c, AFIO_V2_NAMESPACE::async_file_handle::flag f) + { + AFIO_V2_NAMESPACE::io_service service; + OUTCOME_TRY(b, AFIO_V2_NAMESPACE::path_handle::path(".")); + auto h = AFIO_V2_NAMESPACE::async_file_handle::async_file(service, b, "testfile.txt", m, c, AFIO_V2_NAMESPACE::async_file_handle::caching::all, f); + if(h) + h.value().close().value(); + b.close().value(); + return h; + } } diff --git a/test/tests/file_handle_create_close/kernel_file_handle.cpp.hpp b/test/tests/file_handle_create_close/kernel_file_handle.cpp.hpp index 3a0be4be..f9a0c717 100644 --- a/test/tests/file_handle_create_close/kernel_file_handle.cpp.hpp +++ b/test/tests/file_handle_create_close/kernel_file_handle.cpp.hpp @@ -26,12 +26,20 @@ Distributed under the Boost Software License, Version 1.0. namespace file_handle_create_close { - AFIO_TEST_KERNEL_DECL AFIO_V2_NAMESPACE::result<AFIO_V2_NAMESPACE::file_handle> test_kernel_file_handle(AFIO_V2_NAMESPACE::file_handle::mode m, AFIO_V2_NAMESPACE::file_handle::creation c, AFIO_V2_NAMESPACE::file_handle::flag f) + AFIO_TEST_KERNEL_DECL AFIO_V2_NAMESPACE::result<AFIO_V2_NAMESPACE::file_handle> test_kernel_file_handle_absolute(AFIO_V2_NAMESPACE::file_handle::mode m, AFIO_V2_NAMESPACE::file_handle::creation c, AFIO_V2_NAMESPACE::file_handle::flag f) { - //! \todo TODO Use tempfile() once I've implemented it, that works around this being unsafe under mt permutation auto h = AFIO_V2_NAMESPACE::file_handle::file({}, "testfile.txt", m, c, AFIO_V2_NAMESPACE::file_handle::caching::all, f); if(h) h.value().close().value(); return h; } + AFIO_TEST_KERNEL_DECL AFIO_V2_NAMESPACE::result<AFIO_V2_NAMESPACE::file_handle> test_kernel_file_handle_relative(AFIO_V2_NAMESPACE::file_handle::mode m, AFIO_V2_NAMESPACE::file_handle::creation c, AFIO_V2_NAMESPACE::file_handle::flag f) + { + OUTCOME_TRY(b, AFIO_V2_NAMESPACE::path_handle::path(".")); + auto h = AFIO_V2_NAMESPACE::file_handle::file(b, "testfile.txt", m, c, AFIO_V2_NAMESPACE::file_handle::caching::all, f); + if(h) + h.value().close().value(); + b.close().value(); + return h; + } } diff --git a/test/tests/file_handle_create_close/runner.cpp b/test/tests/file_handle_create_close/runner.cpp index b0c30962..dd454e09 100644 --- a/test/tests/file_handle_create_close/runner.cpp +++ b/test/tests/file_handle_create_close/runner.cpp @@ -94,5 +94,7 @@ template <class U> inline void file_handle_create_close_creation(U &&f) check_results_with_boost_test(permuter, results); } -KERNELTEST_TEST_KERNEL(unit, afio, file_handle_create_close, file_handle, "Tests that afio::file_handle's creation parameter works as expected", file_handle_create_close_creation(file_handle_create_close::test_kernel_file_handle)) -KERNELTEST_TEST_KERNEL(unit, afio, file_handle_create_close, async_file_handle, "Tests that afio::async_file_handle's creation parameter works as expected", file_handle_create_close_creation(file_handle_create_close::test_kernel_async_file_handle)) +KERNELTEST_TEST_KERNEL(unit, afio, file_handle_create_close, file_handle, "Tests that afio::file_handle::file()'s parameters with absolute paths work as expected", file_handle_create_close_creation(file_handle_create_close::test_kernel_file_handle_absolute)) +KERNELTEST_TEST_KERNEL(unit, afio, file_handle_create_close, file_handle, "Tests that afio::file_handle::file()'s parameters with relative paths work as expected", file_handle_create_close_creation(file_handle_create_close::test_kernel_file_handle_relative)) +KERNELTEST_TEST_KERNEL(unit, afio, file_handle_create_close, async_file_handle, "Tests that afio::async_file_handle::async_file()'s parameters with absolute paths work as expected", file_handle_create_close_creation(file_handle_create_close::test_kernel_async_file_handle_absolute)) +KERNELTEST_TEST_KERNEL(unit, afio, file_handle_create_close, async_file_handle, "Tests that afio::async_file_handle::async_file()'s parameters with relative paths work as expected", file_handle_create_close_creation(file_handle_create_close::test_kernel_async_file_handle_relative)) |