diff options
author | bulatman <bulatman@yandex-team.com> | 2023-06-01 10:15:45 +0300 |
---|---|---|
committer | bulatman <bulatman@yandex-team.com> | 2023-06-01 10:15:45 +0300 |
commit | 4dea553457efda88fef237809afb5b9a95da7d41 (patch) | |
tree | 276164112112c63ee03db7d5b257900663d1908f /library/cpp/yt/string/unittests/enum_ut.cpp | |
parent | 636774447d59eeee64e2f500f2c1816c53cb96c4 (diff) | |
download | ydb-4dea553457efda88fef237809afb5b9a95da7d41.tar.gz |
YT: Fix ParseEnum when custom domain names used
Diffstat (limited to 'library/cpp/yt/string/unittests/enum_ut.cpp')
-rw-r--r-- | library/cpp/yt/string/unittests/enum_ut.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/library/cpp/yt/string/unittests/enum_ut.cpp b/library/cpp/yt/string/unittests/enum_ut.cpp index fed6d6eb21..f30aec1cab 100644 --- a/library/cpp/yt/string/unittests/enum_ut.cpp +++ b/library/cpp/yt/string/unittests/enum_ut.cpp @@ -29,6 +29,11 @@ DEFINE_BIT_ENUM(ELangs, ((JavaScript) (0x10)) ); +DEFINE_ENUM(ECustomDomainName, + ((A) (1) ("value_a")) + ((B) (2) ("value_b")) +); + TEST(TFormatTest, Enum) { EXPECT_EQ("Red", Format("%v", EColor::Red)); @@ -53,6 +58,19 @@ TEST(TFormatTest, Enum) EXPECT_EQ("cpp | go | python | java_script", Format("%lv", four)); } +TEST(TFormatEnumTest, FormatEnumWithCustomDomainName) +{ + EXPECT_EQ("value_a", FormatEnum(ECustomDomainName::A)); + EXPECT_EQ("value_b", FormatEnum(ECustomDomainName::B)); +} + +TEST(TParseEnumTest, ParseEnumWithCustomDomainName) +{ + EXPECT_EQ(ECustomDomainName::A, TryParseEnum<ECustomDomainName>("value_a")); + EXPECT_EQ(ECustomDomainName::B, TryParseEnum<ECustomDomainName>("value_b")); + EXPECT_EQ(std::nullopt, TryParseEnum<ECustomDomainName>("b")); +} + //////////////////////////////////////////////////////////////////////////////// } // namespace |