Fix handling of output iterator in ranges
This commit is contained in:
@@ -39,14 +39,14 @@ TEST(RangesTest, FormatMap) {
|
||||
}
|
||||
|
||||
TEST(RangesTest, FormatPair) {
|
||||
std::pair<int64_t, float> pa1{42, 3.14159265358979f};
|
||||
EXPECT_EQ("(42, 3.14159)", fmt::format("{}", pa1));
|
||||
std::pair<int64_t, float> pa1{42, 1.5f};
|
||||
EXPECT_EQ("(42, 1.5)", fmt::format("{}", pa1));
|
||||
}
|
||||
|
||||
TEST(RangesTest, FormatTuple) {
|
||||
std::tuple<int64_t, float, std::string, char> tu1{42, 3.14159265358979f,
|
||||
std::tuple<int64_t, float, std::string, char> tu1{42, 1.5f,
|
||||
"this is tuple", 'i'};
|
||||
EXPECT_EQ("(42, 3.14159, \"this is tuple\", 'i')", fmt::format("{}", tu1));
|
||||
EXPECT_EQ("(42, 1.5, \"this is tuple\", 'i')", fmt::format("{}", tu1));
|
||||
}
|
||||
|
||||
struct my_struct {
|
||||
@@ -80,5 +80,12 @@ TEST(RangesTest, FormatStruct) {
|
||||
EXPECT_EQ("(13, \"my struct\")", fmt::format("{}", mst));
|
||||
}
|
||||
|
||||
TEST(RangesTest, FormatTo) {
|
||||
char buf[10];
|
||||
auto end = fmt::format_to(buf, "{}", std::vector{1, 2, 3});
|
||||
*end = '\0';
|
||||
EXPECT_STREQ(buf, "{1, 2, 3}");
|
||||
}
|
||||
|
||||
#endif // (__cplusplus > 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >
|
||||
// 201402L && _MSC_VER >= 1910)
|
||||
|
||||
Reference in New Issue
Block a user