mirror of
https://github.com/fmtlib/fmt.git
synced 2025-06-25 01:11:40 +02:00
Test non-SSO constexpr string formatting
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user