diff options
Diffstat (limited to 'test/utils/cpp/path.test.cpp')
-rw-r--r-- | test/utils/cpp/path.test.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/utils/cpp/path.test.cpp b/test/utils/cpp/path.test.cpp new file mode 100644 index 00000000..b0e7eff8 --- /dev/null +++ b/test/utils/cpp/path.test.cpp @@ -0,0 +1,20 @@ +#include <filesystem> + +#include "catch2/catch.hpp" +#include "src/utils/cpp/path.hpp" + +TEST_CASE("normalization", "[path]") { + CHECK(ToNormalPath(std::filesystem::path{""}) == + ToNormalPath(std::filesystem::path{"."})); + CHECK(ToNormalPath(std::filesystem::path{""}).string() == "."); + CHECK(ToNormalPath(std::filesystem::path{"."}).string() == "."); + + CHECK(ToNormalPath(std::filesystem::path{"foo/bar/.."}).string() == "foo"); + CHECK(ToNormalPath(std::filesystem::path{"foo/bar/../"}).string() == "foo"); + CHECK(ToNormalPath(std::filesystem::path{"foo/bar/../baz"}).string() == + "foo/baz"); + CHECK(ToNormalPath(std::filesystem::path{"./foo/bar"}).string() == + "foo/bar"); + CHECK(ToNormalPath(std::filesystem::path{"foo/.."}).string() == "."); + CHECK(ToNormalPath(std::filesystem::path{"./foo/.."}).string() == "."); +} |