Use overloaded operator<< for enums if available (#232)

This commit is contained in:
vitaut
2015-11-24 08:18:19 -08:00
parent 1a2a333a1a
commit 6cff6d8137
3 changed files with 69 additions and 20 deletions

View File

@@ -1637,3 +1637,15 @@ TEST(LiteralsTest, NamedArg) {
udl_a_w);
}
#endif // FMT_USE_USER_DEFINED_LITERALS
enum TestEnum {};
std::ostream &operator<<(std::ostream &os, TestEnum) {
return os << "TestEnum";
}
enum TestEnum2 { A };
TEST(FormatTest, Enum) {
EXPECT_EQ("TestEnum", fmt::format("{}", TestEnum()));
EXPECT_EQ("0", fmt::format("{}", A));
}