fix fmt can't format enum

This commit is contained in:
tqcq
2024-03-23 14:28:04 +08:00
parent dbdc34279e
commit 56d57d5783
3 changed files with 33 additions and 0 deletions

24
src/log/fmt_test.cc Normal file
View File

@@ -0,0 +1,24 @@
#include <gtest/gtest.h>
#include <sled/log/log.h>
TEST(format, enum)
{
enum EnumType {
kOne = 1,
kTwo = 2,
kThree = 3,
};
EXPECT_EQ(fmt::format("{}{}{}", kOne, kTwo, kThree), "123");
}
TEST(format, neg_enum)
{
enum EnumType {
kOne = -1,
kTwo = -2,
kThree = -3,
};
EXPECT_EQ(fmt::format("{}{}{}", kOne, kTwo, kThree), "-1-2-3");
}