tests.cpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. #include <library/cpp/testing/unittest/registar.h>
  2. namespace NSubjectTests {
  3. class TAlwaysTearDownFixture : public NUnitTest::TBaseFixture {
  4. public:
  5. void TearDown(NUnitTest::TTestContext&) override {
  6. Cerr << Name_ << ": TearDown is ran" << Endl;
  7. }
  8. };
  9. class TAlwaysTearDownSetUpThrowsFixture : public NUnitTest::TBaseFixture {
  10. public:
  11. void SetUp(NUnitTest::TTestContext&) override {
  12. ythrow yexception() << "hope this won't skip teardown";
  13. }
  14. void TearDown(NUnitTest::TTestContext&) override {
  15. Cerr << Name_ << ": TearDown is ran" << Endl;
  16. }
  17. };
  18. Y_UNIT_TEST_SUITE(TestsAlwaysTearDown) {
  19. Y_UNIT_TEST_F(TestFail, TAlwaysTearDownFixture) {
  20. UNIT_ASSERT(false);
  21. }
  22. Y_UNIT_TEST_F(TestThrow, TAlwaysTearDownFixture) {
  23. ythrow yexception() << "hope this won't skip teardown";
  24. }
  25. Y_UNIT_TEST_F(TestSetUpThrows, TAlwaysTearDownSetUpThrowsFixture) {
  26. }
  27. }
  28. }