diff options
Diffstat (limited to 'library/cpp/yt/error/unittests/error_ut.cpp')
| -rw-r--r-- | library/cpp/yt/error/unittests/error_ut.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/library/cpp/yt/error/unittests/error_ut.cpp b/library/cpp/yt/error/unittests/error_ut.cpp index e7cbbcd21d8..4cba6ca563f 100644 --- a/library/cpp/yt/error/unittests/error_ut.cpp +++ b/library/cpp/yt/error/unittests/error_ut.cpp @@ -395,6 +395,19 @@ TEST(TErrorTest, ThrowErrorExceptionIfFailedMacroExpression) } } +TEST(TErrorTest, ThrowErrorExceptionIfMacroAttributes) +{ + try { + THROW_ERROR_EXCEPTION_IF(true, "Condition holds") + << TErrorAttribute("attr", "attr_value"); + ADD_FAILURE() << "Expected the macro to throw."; + } catch (const std::exception& ex) { + TError error(ex); + EXPECT_EQ(error.GetMessage(), "Condition holds"); + EXPECT_EQ(error.Attributes().Get<std::string>("attr"), "attr_value"); + } +} + TEST(TErrorTest, ThrowErrorExceptionIfFailedMacroDontStealValue) { TErrorOr<TWidget> widget = TWidget(); |
