fix fmt can't format enum
This commit is contained in:
24
src/log/fmt_test.cc
Normal file
24
src/log/fmt_test.cc
Normal 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");
|
||||
}
|
||||
Reference in New Issue
Block a user