Add filesystem utils functions

This commit is contained in:
Richard Berger
2020-06-02 13:48:31 -04:00
parent 8b61b12921
commit 60f17e7397
3 changed files with 83 additions and 0 deletions

View File

@ -182,3 +182,19 @@ TEST(Utils, strmatch_char_range) {
TEST(Utils, strmatch_opt_range) {
ASSERT_TRUE(utils::strmatch("rigid","^[0-9]*[p-s]igid"));
}
TEST(Utils, path_join) {
#if defined(_WIN32)
ASSERT_THAT(utils::path_join("c:\\parent\\folder", "filename"), Eq("c:\\parent\\folder\\filename"));
#else
ASSERT_THAT(utils::path_join("/parent/folder", "filename"), Eq("/parent/folder/filename"));
#endif
}
TEST(Utils, path_basename) {
#if defined(_WIN32)
ASSERT_THAT(utils::path_basename("c:\\parent\\folder\\filename"), Eq("filename"));
#else
ASSERT_THAT(utils::path_basename("/parent/folder/filename"), Eq("filename"));
#endif
}