Skip to content

Commit

Permalink
Add utf-8 test for std::filesystem::path formatter.
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Shchapov <[email protected]>
  • Loading branch information
phprus authored and vitaut committed Jun 4, 2022
1 parent 8644654 commit 232e21d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ add_fmt_test(printf-test)
add_fmt_test(ranges-test ranges-odr-test.cc)
add_fmt_test(scan-test)
add_fmt_test(std-test)
if (MSVC)
target_compile_options(std-test PRIVATE /source-charset:utf-8)
endif ()
add_fmt_test(unicode-test HEADER_ONLY)
if (MSVC)
target_compile_options(unicode-test PRIVATE /utf-8)
Expand Down
5 changes: 5 additions & 0 deletions test/std-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ 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\"");

# ifdef _WIN32
EXPECT_EQ(fmt::format("{}", std::filesystem::path(L"Файл.txt")),
"\"\xd0\xa4\xd0\xb0\xd0\xb9\xd0\xbb.txt\"");
# endif
#endif
}

Expand Down

0 comments on commit 232e21d

Please sign in to comment.