aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/string/unittests/enum_ut.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'library/cpp/yt/string/unittests/enum_ut.cpp')
-rw-r--r--library/cpp/yt/string/unittests/enum_ut.cpp18
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