From 3a8385a9c68825b2108cf0288d23f8f171d78e29 Mon Sep 17 00:00:00 2001 From: eidheim Date: Wed, 31 Mar 2021 14:49:10 +0200 Subject: [PATCH] Added test for filesystem::get_current_path() --- src/filesystem.hpp | 2 +- tests/filesystem_test.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/filesystem.hpp b/src/filesystem.hpp index a09710c..d8501b0 100644 --- a/src/filesystem.hpp +++ b/src/filesystem.hpp @@ -16,7 +16,7 @@ public: static std::string escape_argument(const std::string &argument); static std::string unescape_argument(const std::string &argument); - /// Does not resolve symbolic links. Returns empty path on failure + /// Does not resolve symbolic links. Returns empty path on failure. static boost::filesystem::path get_current_path() noexcept; /// Returns empty path on failure static boost::filesystem::path get_home_path() noexcept; diff --git a/tests/filesystem_test.cpp b/tests/filesystem_test.cpp index 166c852..c83c60f 100644 --- a/tests/filesystem_test.cpp +++ b/tests/filesystem_test.cpp @@ -6,6 +6,12 @@ int main() { auto home_path = filesystem::get_home_path(); g_assert(!home_path.empty()); } + { + auto home_path = filesystem::get_current_path(); + g_assert(!home_path.empty()); + g_assert(boost::filesystem::exists(home_path)); + g_assert(boost::filesystem::is_directory(home_path)); + } { auto original = "test () '\"";