mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-02 11:28:20 +00:00
Fix handling of code units in compile
This commit is contained in:
parent
ba8d98cbb7
commit
e1bfb59619
@ -547,7 +547,7 @@ constexpr auto compile_format_string(S format_str) {
|
||||
return parse_tail<Args, end, ID>(make_text(str, POS, end - POS),
|
||||
format_str);
|
||||
} else {
|
||||
return parse_tail<Args, end, ID>(code_unit<char_type>{str[0]},
|
||||
return parse_tail<Args, end, ID>(code_unit<char_type>{str[POS]},
|
||||
format_str);
|
||||
}
|
||||
}
|
||||
|
@ -162,5 +162,6 @@ TEST(CompileTest, FormatTo) {
|
||||
|
||||
TEST(CompileTest, TextAndArg) {
|
||||
EXPECT_EQ(">>>42<<<", fmt::format(FMT_COMPILE(">>>{}<<<"), 42));
|
||||
EXPECT_EQ("42!", fmt::format(FMT_COMPILE("{}!"), 42));
|
||||
}
|
||||
#endif
|
||||
|
@ -81,7 +81,7 @@ TEST(UtilTest, FormatWindowsError) {
|
||||
EXPECT_EQ(fmt::format("test: {}", utf8_message.str()),
|
||||
fmt::to_string(actual_message));
|
||||
actual_message.resize(0);
|
||||
auto max_size = fmt::detail::max_value<long long>();
|
||||
auto max_size = fmt::detail::max_value<size_t>() / 2;
|
||||
fmt::detail::format_windows_error(actual_message, ERROR_FILE_EXISTS,
|
||||
fmt::string_view(nullptr, max_size));
|
||||
EXPECT_EQ(fmt::format("error {}", ERROR_FILE_EXISTS),
|
||||
|
Loading…
Reference in New Issue
Block a user