fix
This commit is contained in:
50
support/3rd_party/test/src/utils/path_test.cpp
vendored
50
support/3rd_party/test/src/utils/path_test.cpp
vendored
@@ -120,43 +120,43 @@ TEST(utils_path, combine) {
|
||||
}
|
||||
|
||||
TEST(utils_path, format_path) {
|
||||
std::string path{"\\"};
|
||||
utils::path::format_path(path, utils::path::directory_seperator,
|
||||
utils::path::not_directory_seperator);
|
||||
std::string path{"./"};
|
||||
utils::path::format_path(path, utils::path::slash, utils::path::backslash);
|
||||
EXPECT_STREQ(".", path.c_str());
|
||||
|
||||
path = "~/.test";
|
||||
utils::path::format_path(path, utils::path::slash, utils::path::backslash);
|
||||
EXPECT_STREQ("~/.test", path.c_str());
|
||||
|
||||
path = "\\";
|
||||
utils::path::format_path(path, utils::path::slash, utils::path::backslash);
|
||||
EXPECT_STREQ("/", path.c_str());
|
||||
|
||||
path = "\\\\";
|
||||
utils::path::format_path(path, utils::path::directory_seperator,
|
||||
utils::path::not_directory_seperator);
|
||||
utils::path::format_path(path, utils::path::slash, utils::path::backslash);
|
||||
EXPECT_STREQ("/", path.c_str());
|
||||
|
||||
path = "\\\\\\";
|
||||
utils::path::format_path(path, utils::path::directory_seperator,
|
||||
utils::path::not_directory_seperator);
|
||||
utils::path::format_path(path, utils::path::slash, utils::path::backslash);
|
||||
EXPECT_STREQ("/", path.c_str());
|
||||
|
||||
path = "\\\\\\\\";
|
||||
utils::path::format_path(path, utils::path::directory_seperator,
|
||||
utils::path::not_directory_seperator);
|
||||
utils::path::format_path(path, utils::path::slash, utils::path::backslash);
|
||||
EXPECT_STREQ("/", path.c_str());
|
||||
|
||||
path = "/";
|
||||
utils::path::format_path(path, utils::path::directory_seperator,
|
||||
utils::path::not_directory_seperator);
|
||||
utils::path::format_path(path, utils::path::slash, utils::path::backslash);
|
||||
EXPECT_STREQ("/", path.c_str());
|
||||
path = "//";
|
||||
utils::path::format_path(path, utils::path::directory_seperator,
|
||||
utils::path::not_directory_seperator);
|
||||
utils::path::format_path(path, utils::path::slash, utils::path::backslash);
|
||||
EXPECT_STREQ("/", path.c_str());
|
||||
|
||||
path = "///";
|
||||
utils::path::format_path(path, utils::path::directory_seperator,
|
||||
utils::path::not_directory_seperator);
|
||||
utils::path::format_path(path, utils::path::slash, utils::path::backslash);
|
||||
EXPECT_STREQ("/", path.c_str());
|
||||
|
||||
path = "////";
|
||||
utils::path::format_path(path, utils::path::directory_seperator,
|
||||
utils::path::not_directory_seperator);
|
||||
utils::path::format_path(path, utils::path::slash, utils::path::backslash);
|
||||
EXPECT_STREQ("/", path.c_str());
|
||||
}
|
||||
|
||||
@@ -245,4 +245,20 @@ TEST(utils_path, finalize) {
|
||||
EXPECT_STREQ("/cow/moose/dog/chicken", s.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(_WIN32)
|
||||
TEST(utils_path, resolve) {
|
||||
std::cout << utils::path::resolve("~") << std::endl;
|
||||
std::cout << utils::path::combine("~",
|
||||
{
|
||||
".local",
|
||||
})
|
||||
<< std::endl;
|
||||
std::cout << utils::path::resolve(utils::path::combine("~",
|
||||
{
|
||||
".local",
|
||||
}))
|
||||
<< std::endl;
|
||||
}
|
||||
#endif // !defined(_WIN32)
|
||||
} // namespace repertory
|
||||
|
Reference in New Issue
Block a user