diff options
| author | lukyan <[email protected]> | 2025-04-16 22:43:47 +0300 |
|---|---|---|
| committer | lukyan <[email protected]> | 2025-04-16 22:59:26 +0300 |
| commit | 6574e3bb8e463246106d483ba72fdf2d6d32cbdc (patch) | |
| tree | 00eb6688be5b9f85810730a1b078189ad6cd42c2 /library/cpp/yt/string/unittests/format_ut.cpp | |
| parent | 475f6be41dd8364cd4726086ee21d6ad3215964d (diff) | |
Fix MakeFormattableView
commit_hash:0e4b24c65451e75f168b456cd0d271ddebb7219d
Diffstat (limited to 'library/cpp/yt/string/unittests/format_ut.cpp')
| -rw-r--r-- | library/cpp/yt/string/unittests/format_ut.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/library/cpp/yt/string/unittests/format_ut.cpp b/library/cpp/yt/string/unittests/format_ut.cpp index e2e23c737c2..a6c5ef6837f 100644 --- a/library/cpp/yt/string/unittests/format_ut.cpp +++ b/library/cpp/yt/string/unittests/format_ut.cpp @@ -267,6 +267,19 @@ TEST(TFormatTest, LazyMultiValueFormatter) EXPECT_EQ("int: 1, string: hello, range: [1, 2, 3]", Format("%v", lazyFormatter)); } +TEST(TFormatTest, ReusableLambdaFormatter) +{ + auto formatter = [&] (auto* builder, int value) { + builder->AppendFormat("%v", value); + }; + + std::vector<int> range1{1, 2, 3}; + EXPECT_EQ("[1, 2, 3]", Format("%v", MakeFormattableView(range1, formatter))); + + std::vector<int> range2{4, 5, 6}; + EXPECT_EQ("[4, 5, 6]", Format("%v", MakeFormattableView(range2, formatter))); +} + TEST(TFormatTest, VectorArg) { std::vector<TString> params = {"a", "b", "c"}; |
