diff options
author | Alexander Smirnov <alex@ydb.tech> | 2024-04-16 09:11:59 +0000 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2024-04-16 09:11:59 +0000 |
commit | 25de1d521ca218e2b040739fea77a39e9fc543e9 (patch) | |
tree | 21521d8866cf1462dbd52c071cf369974c29650e /library/cpp/http/io/headers_ut.cpp | |
parent | bf444b8ed4d0f6bf17fd753e2cf88f9440012e87 (diff) | |
parent | 0a63d9ddc516f206f2b8745ce5e5dfa60190d755 (diff) | |
download | ydb-25de1d521ca218e2b040739fea77a39e9fc543e9.tar.gz |
Merge branch 'rightlib' into mergelibs-240416-0910
Diffstat (limited to 'library/cpp/http/io/headers_ut.cpp')
-rw-r--r-- | library/cpp/http/io/headers_ut.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/library/cpp/http/io/headers_ut.cpp b/library/cpp/http/io/headers_ut.cpp index 1d23ef8fdc..6205efb154 100644 --- a/library/cpp/http/io/headers_ut.cpp +++ b/library/cpp/http/io/headers_ut.cpp @@ -44,6 +44,7 @@ bool operator==(const THttpHeaders& lhs, const THeadersExistence& rhs) { class THttpHeadersTest: public TTestBase { UNIT_TEST_SUITE(THttpHeadersTest); + UNIT_TEST(TestConstructorFromArrayRef); UNIT_TEST(TestAddOperation1Arg); UNIT_TEST(TestAddOperation2Args); UNIT_TEST(TestAddOrReplaceOperation1Arg); @@ -57,6 +58,7 @@ private: typedef void (*TAddOrReplaceHeaderFunction)(THttpHeaders&, TStringBuf name, TStringBuf value); public: + void TestConstructorFromArrayRef(); void TestAddOperation1Arg(); void TestAddOperation2Args(); void TestAddOrReplaceOperation1Arg(); @@ -87,6 +89,26 @@ private: UNIT_TEST_SUITE_REGISTRATION(THttpHeadersTest); +void THttpHeadersTest::TestConstructorFromArrayRef() { + THeadersExistence expected; + expected.Add("h1", "v1"); + expected.Add("h2", "v2"); + + // Construct from vector + TVector<THttpInputHeader> headerVec{ + {"h1", "v1"}, + {"h2", "v2"} + }; + THttpHeaders h1(headerVec); + UNIT_ASSERT(expected == h1); + + // Construct from initializer list + THttpHeaders h2({ + {"h1", "v1"}, + {"h2", "v2"} + }); + UNIT_ASSERT(expected == h2); +} void THttpHeadersTest::TestAddOperation1Arg() { DoTestAddOperation(AddHeaderImpl1Arg); } |