aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'library/cpp')
-rw-r--r--library/cpp/yt/string/format-inl.h2
-rw-r--r--library/cpp/yt/string/unittests/format_ut.cpp7
2 files changed, 8 insertions, 1 deletions
diff --git a/library/cpp/yt/string/format-inl.h b/library/cpp/yt/string/format-inl.h
index e90d68bfe1..b18c435cb8 100644
--- a/library/cpp/yt/string/format-inl.h
+++ b/library/cpp/yt/string/format-inl.h
@@ -722,7 +722,7 @@ void FormatValue(TStringBuilderBase* builder, const std::tuple<Ts...>& value, TS
[&] <size_t... Idx> (std::index_sequence<Idx...>) {
([&] {
FormatValue(builder, std::get<Idx>(value), spec);
- if constexpr (Idx != sizeof...(Ts)) {
+ if constexpr (Idx != sizeof...(Ts) - 1) {
builder->AppendString(TStringBuf(", "));
}
} (), ...);
diff --git a/library/cpp/yt/string/unittests/format_ut.cpp b/library/cpp/yt/string/unittests/format_ut.cpp
index 8aca8c8e29..e6b5eb7cfe 100644
--- a/library/cpp/yt/string/unittests/format_ut.cpp
+++ b/library/cpp/yt/string/unittests/format_ut.cpp
@@ -239,6 +239,13 @@ TEST(TFormatTest, Pointers)
}
}
+TEST(TFormatTest, Tuples)
+{
+ EXPECT_EQ("{}", Format("%v", std::tuple()));
+ EXPECT_EQ("{1, 2, 3}", Format("%v", std::tuple(1, 2, 3)));
+ EXPECT_EQ("{1, 2}", Format("%v", std::pair(1, 2)));
+}
+
TEST(TFormatTest, LazyMultiValueFormatter)
{
int i = 1;