Skip to content

Commit 4a149f5

Browse files
committed
Test non-SSO constexpr string formatting
1 parent 067bc47 commit 4a149f5

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

test/compile-test.cc

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,10 +425,20 @@ TEST(compile_time_formatting_test, multibyte_fill) {
425425
#if FMT_USE_CONSTEXPR_STRING
426426

427427
TEST(compile_test, constexpr_format) {
428-
constexpr auto result = []() {
429-
return fmt::format(FMT_COMPILE("{}"), 42) == "42";
430-
}();
431-
EXPECT_TRUE(result);
428+
{
429+
constexpr auto result = []() {
430+
return fmt::format(FMT_COMPILE("{}"), 42) == "42";
431+
}();
432+
EXPECT_TRUE(result);
433+
}
434+
435+
{
436+
// Test with a larger string to avoid small string optimization.
437+
constexpr auto result = []() {
438+
return fmt::format(FMT_COMPILE("{:100}"), ' ') == std::string(100, ' ');
439+
}();
440+
EXPECT_TRUE(result);
441+
}
432442
}
433443

434444
#endif // FMT_USE_CONSTEXPR_STRING

0 commit comments

Comments
 (0)