mirror of
https://github.com/fmtlib/fmt.git
synced 2026-04-28 18:02:08 +02:00
Path is not escaped twice in the debug mode (#3321)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
This commit is contained in:
committed by
GitHub
parent
3daf33837c
commit
050293646f
@@ -21,6 +21,8 @@ TEST(std_test, path) {
|
||||
EXPECT_EQ(fmt::format("{:8}", std::filesystem::path("foo")), "\"foo\" ");
|
||||
EXPECT_EQ(fmt::format("{}", std::filesystem::path("foo\"bar.txt")),
|
||||
"\"foo\\\"bar.txt\"");
|
||||
EXPECT_EQ(fmt::format("{:?}", std::filesystem::path("foo\"bar.txt")),
|
||||
"\"foo\\\"bar.txt\"");
|
||||
|
||||
# ifdef _WIN32
|
||||
// File.txt in Russian.
|
||||
@@ -46,6 +48,21 @@ TEST(ranges_std_test, format_vector_path) {
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(ranges_std_test, format_quote_path) {
|
||||
// Test that path is not escaped twice in the debug mode.
|
||||
#ifdef __cpp_lib_filesystem
|
||||
auto vec =
|
||||
std::vector<std::filesystem::path>{"path1/file1.txt", "path2/file2.txt"};
|
||||
EXPECT_EQ(fmt::format("{}", vec),
|
||||
"[\"path1/file1.txt\", \"path2/file2.txt\"]");
|
||||
# ifdef __cpp_lib_optional
|
||||
auto o = std::optional<std::filesystem::path>("path/file.txt");
|
||||
EXPECT_EQ(fmt::format("{}", o), "optional(\"path/file.txt\")");
|
||||
EXPECT_EQ(fmt::format("{:?}", o), "optional(\"path/file.txt\")");
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(std_test, thread_id) {
|
||||
EXPECT_FALSE(fmt::format("{}", std::this_thread::get_id()).empty());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user