From 4a149f513f2245965fc27c074702dced1f7501ea Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Mon, 16 Jun 2025 08:23:21 -0700 Subject: [PATCH] Test non-SSO constexpr string formatting --- test/compile-test.cc | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/test/compile-test.cc b/test/compile-test.cc index 95960e27..27e39336 100644 --- a/test/compile-test.cc +++ b/test/compile-test.cc @@ -425,10 +425,20 @@ TEST(compile_time_formatting_test, multibyte_fill) { #if FMT_USE_CONSTEXPR_STRING TEST(compile_test, constexpr_format) { - constexpr auto result = []() { - return fmt::format(FMT_COMPILE("{}"), 42) == "42"; - }(); - EXPECT_TRUE(result); + { + constexpr auto result = []() { + return fmt::format(FMT_COMPILE("{}"), 42) == "42"; + }(); + 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