-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix is_formattable for tuple-like types. #2940
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,6 +90,18 @@ TEST(ranges_test, format_tuple) { | |
std::tuple<int, float, std::string, char>(42, 1.5f, "this is tuple", 'i'); | ||
EXPECT_EQ(fmt::format("{}", t), "(42, 1.5, \"this is tuple\", 'i')"); | ||
EXPECT_EQ(fmt::format("{}", std::tuple<>()), "()"); | ||
|
||
enum class noformatenum{b}; | ||
struct noformatstruct{}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only one unformattable type is needed. Please reuse existing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed. |
||
EXPECT_TRUE((fmt::is_formattable<std::tuple<>>::value)); | ||
EXPECT_FALSE((fmt::is_formattable<noformatenum>::value)); | ||
EXPECT_FALSE((fmt::is_formattable<noformatstruct>::value)); | ||
EXPECT_FALSE((fmt::is_formattable<std::tuple<noformatenum>>::value)); | ||
EXPECT_FALSE((fmt::is_formattable<std::tuple<noformatstruct>>::value)); | ||
EXPECT_FALSE((fmt::is_formattable<std::tuple<noformatstruct,int>>::value)); | ||
EXPECT_FALSE((fmt::is_formattable<std::tuple<int,noformatenum>>::value)); | ||
EXPECT_FALSE((fmt::is_formattable<std::tuple<noformatstruct,noformatenum>>::value)); | ||
EXPECT_TRUE((fmt::is_formattable<std::tuple<int,float>>::value)); | ||
} | ||
|
||
#ifdef FMT_RANGES_TEST_ENABLE_FORMAT_STRUCT | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is
fmt::
needed here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, fixed.