mirror of
https://github.com/fmtlib/fmt.git
synced 2026-05-05 03:54:10 +02:00
Fix formatting of objects convertible to std::string
This commit is contained in:
@@ -1213,6 +1213,16 @@ TEST(FormatterTest, FormatStringView) {
|
||||
EXPECT_EQ("test", format("{0}", string_view("test")));
|
||||
}
|
||||
|
||||
struct ConvertibleToString {
|
||||
std::string s;
|
||||
ConvertibleToString() : s("foo") {}
|
||||
operator const std::string &() const { return s; }
|
||||
};
|
||||
|
||||
TEST(FormatterTest, FormatConvertibleToString) {
|
||||
EXPECT_EQ("foo", format("{}", ConvertibleToString()));
|
||||
}
|
||||
|
||||
namespace fmt {
|
||||
template <>
|
||||
struct formatter<Date> {
|
||||
|
||||
Reference in New Issue
Block a user