diff options
author | tkhanipov <tkhanipov@yandex-team.ru> | 2022-02-10 16:49:46 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:46 +0300 |
commit | 60a6df6d382906cd4ca6cd885920b3c20820170e (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/testing/unittest/registar_ut.cpp | |
parent | 60c0dade397b9b2f9a22f5daa5b2ea5e433e6e40 (diff) | |
download | ydb-60a6df6d382906cd4ca6cd885920b3c20820170e.tar.gz |
Restoring authorship annotation for <tkhanipov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/testing/unittest/registar_ut.cpp')
-rw-r--r-- | library/cpp/testing/unittest/registar_ut.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/library/cpp/testing/unittest/registar_ut.cpp b/library/cpp/testing/unittest/registar_ut.cpp index 81827e7571..1f36d53abb 100644 --- a/library/cpp/testing/unittest/registar_ut.cpp +++ b/library/cpp/testing/unittest/registar_ut.cpp @@ -301,15 +301,15 @@ Y_UNIT_TEST_SUITE(TUnitTestMacroTest) { UNIT_ASSERT_EXCEPTION_CONTAINS(Throw(), TExpectedException, substr); } - template <class TExpectedException, class P> - void AssertExceptionSatisfies(const P& predicate) { - UNIT_ASSERT_EXCEPTION_SATISFIES(Throw(), TExpectedException, predicate); - } - - int GetValue() const { - return 5; // just some value for predicate testing - } - + template <class TExpectedException, class P> + void AssertExceptionSatisfies(const P& predicate) { + UNIT_ASSERT_EXCEPTION_SATISFIES(Throw(), TExpectedException, predicate); + } + + int GetValue() const { + return 5; // just some value for predicate testing + } + bool ThrowMe; }; @@ -362,12 +362,12 @@ Y_UNIT_TEST_SUITE(TUnitTestMacroTest) { UNIT_ASSERT_EXCEPTION_CONTAINS(TTestException("abc").Throw(), TTestException, "a"); } - - Y_UNIT_TEST(ExceptionSatisfies) { - const auto goodPredicate = [](const TTestException& e) { return e.GetValue() == 5; }; - const auto badPredicate = [](const TTestException& e) { return e.GetValue() != 5; }; - UNIT_ASSERT_NO_EXCEPTION(TTestException().AssertExceptionSatisfies<TTestException>(goodPredicate)); - UNIT_ASSERT_TEST_FAILS(TTestException().AssertExceptionSatisfies<TTestException>(badPredicate)); - UNIT_ASSERT_TEST_FAILS(TTestException().AssertExceptionSatisfies<TOtherTestException>(goodPredicate)); - } + + Y_UNIT_TEST(ExceptionSatisfies) { + const auto goodPredicate = [](const TTestException& e) { return e.GetValue() == 5; }; + const auto badPredicate = [](const TTestException& e) { return e.GetValue() != 5; }; + UNIT_ASSERT_NO_EXCEPTION(TTestException().AssertExceptionSatisfies<TTestException>(goodPredicate)); + UNIT_ASSERT_TEST_FAILS(TTestException().AssertExceptionSatisfies<TTestException>(badPredicate)); + UNIT_ASSERT_TEST_FAILS(TTestException().AssertExceptionSatisfies<TOtherTestException>(goodPredicate)); + } } |