Browse Source

Added test for filesystem::get_current_path()

pipelines/280567345
eidheim 5 years ago
parent
commit
3a8385a9c6
  1. 2
      src/filesystem.hpp
  2. 6
      tests/filesystem_test.cpp

2
src/filesystem.hpp

@ -16,7 +16,7 @@ public:
static std::string escape_argument(const std::string &argument); static std::string escape_argument(const std::string &argument);
static std::string unescape_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; static boost::filesystem::path get_current_path() noexcept;
/// Returns empty path on failure /// Returns empty path on failure
static boost::filesystem::path get_home_path() noexcept; static boost::filesystem::path get_home_path() noexcept;

6
tests/filesystem_test.cpp

@ -6,6 +6,12 @@ int main() {
auto home_path = filesystem::get_home_path(); auto home_path = filesystem::get_home_path();
g_assert(!home_path.empty()); 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 () '\""; auto original = "test () '\"";

Loading…
Cancel
Save