mirror of
https://github.com/fmtlib/fmt.git
synced 2026-08-03 20:14:20 +02:00
Support fmt::runtime with wchar_t in fmt::format_to_n (#4715)
This commit is contained in:
@@ -146,6 +146,26 @@ TEST(format_test, wide_format_to_n) {
|
||||
EXPECT_EQ(L"BC x", fmt::wstring_view(buffer, 4));
|
||||
}
|
||||
|
||||
TEST(format_test, wide_format_to_n_runtime) {
|
||||
wchar_t buffer[4];
|
||||
buffer[3] = L'x';
|
||||
auto result = fmt::format_to_n(buffer, 3, fmt::runtime(L"{}"), 12345);
|
||||
EXPECT_EQ(5u, result.size);
|
||||
EXPECT_EQ(buffer + 3, result.out);
|
||||
EXPECT_EQ(L"123x", fmt::wstring_view(buffer, 4));
|
||||
buffer[0] = L'x';
|
||||
buffer[1] = L'x';
|
||||
buffer[2] = L'x';
|
||||
result = fmt::format_to_n(buffer, 3, fmt::runtime(L"{}"), L'A');
|
||||
EXPECT_EQ(1u, result.size);
|
||||
EXPECT_EQ(buffer + 1, result.out);
|
||||
EXPECT_EQ(L"Axxx", fmt::wstring_view(buffer, 4));
|
||||
result = fmt::format_to_n(buffer, 3, fmt::runtime(L"{}{} "), L'B', L'C');
|
||||
EXPECT_EQ(3u, result.size);
|
||||
EXPECT_EQ(buffer + 3, result.out);
|
||||
EXPECT_EQ(L"BC x", fmt::wstring_view(buffer, 4));
|
||||
}
|
||||
|
||||
TEST(xchar_test, named_arg_udl) {
|
||||
using namespace fmt::literals;
|
||||
auto udl_a =
|
||||
|
||||
Reference in New Issue
Block a user