diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2020-11-20 14:05:10 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2020-11-20 14:05:10 +0300 |
commit | 86821fa3370eb75b90bd6b0963eab7f28585d8e8 (patch) | |
tree | 77221c3016b603592bac4ead2de3da6692e1f111 | |
parent | 18edb99d1a3c564e68099b79896160a1c8be0270 (diff) |
Fix unit test failures, and regress Windows CI testing to VS2017 as VS2019 latest ICEs.
-rw-r--r-- | .github/workflows/unittests_windows.yml | 3 | ||||
-rw-r--r-- | include/llfio/v2.0/path_view.hpp | 13 | ||||
-rw-r--r-- | test/tests/path_view.cpp | 4 |
3 files changed, 17 insertions, 3 deletions
diff --git a/.github/workflows/unittests_windows.yml b/.github/workflows/unittests_windows.yml index a15ca09d..0371f2e7 100644 --- a/.github/workflows/unittests_windows.yml +++ b/.github/workflows/unittests_windows.yml @@ -12,7 +12,8 @@ on: jobs: WinVS2019: name: Windows VS2019 - runs-on: windows-2019 +# runs-on: windows-2019 + runs-on: windows-2016 strategy: fail-fast: false matrix: diff --git a/include/llfio/v2.0/path_view.hpp b/include/llfio/v2.0/path_view.hpp index 293baa0e..1121ccfd 100644 --- a/include/llfio/v2.0/path_view.hpp +++ b/include/llfio/v2.0/path_view.hpp @@ -867,7 +867,7 @@ public: abort(); } #endif - if(required_bytes <= _buffer_bytes) + if(required_bytes < _buffer_bytes) { // Use the internal buffer memcpy(_buffer, source, required_bytes); @@ -1809,7 +1809,16 @@ public: { return path_view(); } - return this->_invoke([sep_idx, this](auto v) { return path_view(v.data(), sep_idx + 1, not_zero_terminated, formatting()); }); + return this->_invoke([sep_idx, this](auto v) { + return path_view(v.data(), +#ifdef _WIN32 + sep_idx + 1 // Windows leaves the final separator in place +#else + sep_idx // POSIX removes the final separator +#endif + , + not_zero_terminated, formatting()); + }); } //! Returns a view of the root name part of this view e.g. C: LLFIO_PATH_VIEW_CONSTEXPR path_view root_name() const noexcept diff --git a/test/tests/path_view.cpp b/test/tests/path_view.cpp index a0880ebc..16b917df 100644 --- a/test/tests/path_view.cpp +++ b/test/tests/path_view.cpp @@ -115,7 +115,11 @@ static inline void TestPathView() llfio::path_view e(p); // NOLINT llfio::path_view f(e.filename()); e = e.remove_filename(); +#ifdef _WIN32 BOOST_CHECK(0 == e.compare<>("/mnt/c/Users/ned/Documents/boostish/afio/programs/build_posix/testdir/")); +#else + BOOST_CHECK(0 == e.compare<>("/mnt/c/Users/ned/Documents/boostish/afio/programs/build_posix/testdir")); +#endif BOOST_CHECK(0 == f.compare<>("0")); // Trailing BOOST_CHECK(0 == llfio::path_view("/a/b/").without_trailing_separator().compare<>("/a/b")); |