diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-10-10 00:40:00 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-10-10 10:58:39 +0200 |
| commit | 6d1582f3c4b5afe57bdc3c34dada275a05a961a4 (patch) | |
| tree | 0b443f98a21ec0c9271e9400506f275211c8a9e9 /test | |
| parent | d70c44e87632a69a2b8bc90db7ca4b06b7aa611d (diff) | |
Implement weakly_canonical for boost versions without it (e.g. the one on Ubuntu 16.04).
Diffstat (limited to 'test')
| -rw-r--r-- | test/filesystem_test.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/filesystem_test.cc b/test/filesystem_test.cc index fc13db99..90b7761e 100644 --- a/test/filesystem_test.cc +++ b/test/filesystem_test.cc @@ -95,3 +95,18 @@ BOOST_AUTO_TEST_CASE (windows_long_filename_test) } #endif + +BOOST_AUTO_TEST_CASE(weakly_canonical_test) +{ +#ifdef LIBDCP_WINDOWS + BOOST_CHECK(dcp::filesystem::weakly_canonical("c:\\a\\b\\c") == boost::filesystem::path("c:\\a\\b\\c")); + BOOST_CHECK(dcp::filesystem::weakly_canonical("c:\\a\\b\\..\\c") == boost::filesystem::path("c:\\a\\c")); + BOOST_CHECK(dcp::filesystem::weakly_canonical("c:\\a\\b\\..\\c\\.\\d") == boost::filesystem::path("c:\\a\\c\\d")); + BOOST_CHECK(dcp::filesystem::weakly_canonical("c:\\a\\..\\b\\..\\c") == boost::filesystem::path("c:\\c")); +#else + BOOST_CHECK(dcp::filesystem::weakly_canonical("/a/b/c") == boost::filesystem::path("/a/b/c")); + BOOST_CHECK(dcp::filesystem::weakly_canonical("/a/b/../c") == boost::filesystem::path("/a/c")); + BOOST_CHECK(dcp::filesystem::weakly_canonical("/a/b/../c/./d") == boost::filesystem::path("/a/c/d")); + BOOST_CHECK(dcp::filesystem::weakly_canonical("/a/../b/../c") == boost::filesystem::path("/c")); +#endif +} |
