From 232e21d51ff2ad3e9c7d3caab5cf6e968ce2e94d Mon Sep 17 00:00:00 2001 From: Vladislav Shchapov Date: Tue, 31 May 2022 19:58:49 +0500 Subject: [PATCH] Add utf-8 test for std::filesystem::path formatter. Signed-off-by: Vladislav Shchapov --- test/CMakeLists.txt | 3 +++ test/std-test.cc | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6cdb7ac42fa0..34a693ea2492 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -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) diff --git a/test/std-test.cc b/test/std-test.cc index 069c83871955..257c8acd9c1a 100644 --- a/test/std-test.cc +++ b/test/std-test.cc @@ -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 }