Test non-SSO constexpr string formatting

This commit is contained in:
Victor Zverovich
2025-06-16 08:23:21 -07:00
parent 067bc479b4
commit 4a149f513f

View File

@ -425,10 +425,20 @@ TEST(compile_time_formatting_test, multibyte_fill) {
#if FMT_USE_CONSTEXPR_STRING #if FMT_USE_CONSTEXPR_STRING
TEST(compile_test, constexpr_format) { TEST(compile_test, constexpr_format) {
constexpr auto result = []() { {
return fmt::format(FMT_COMPILE("{}"), 42) == "42"; constexpr auto result = []() {
}(); return fmt::format(FMT_COMPILE("{}"), 42) == "42";
EXPECT_TRUE(result); }();
EXPECT_TRUE(result);
}
{
// Test with a larger string to avoid small string optimization.
constexpr auto result = []() {
return fmt::format(FMT_COMPILE("{:100}"), ' ') == std::string(100, ' ');
}();
EXPECT_TRUE(result);
}
} }
#endif // FMT_USE_CONSTEXPR_STRING #endif // FMT_USE_CONSTEXPR_STRING