diff options
author | tobo <tobo@yandex-team.ru> | 2022-02-10 16:47:27 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:27 +0300 |
commit | 7fe839092527589b38f014d854c51565b3c1adfa (patch) | |
tree | 309e97022d3530044b712b8f71318c78faf7856e /library/cpp/testing/unittest | |
parent | d0d68c395c10da4cb56a1c845504570a04d7893e (diff) | |
download | ydb-7fe839092527589b38f014d854c51565b3c1adfa.tar.gz |
Restoring authorship annotation for <tobo@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/testing/unittest')
-rw-r--r-- | library/cpp/testing/unittest/registar.cpp | 2 | ||||
-rw-r--r-- | library/cpp/testing/unittest/registar.h | 26 | ||||
-rw-r--r-- | library/cpp/testing/unittest/registar_ut.cpp | 24 | ||||
-rw-r--r-- | library/cpp/testing/unittest/utmain.cpp | 4 |
4 files changed, 28 insertions, 28 deletions
diff --git a/library/cpp/testing/unittest/registar.cpp b/library/cpp/testing/unittest/registar.cpp index 3679b768ed..0fe5ef9700 100644 --- a/library/cpp/testing/unittest/registar.cpp +++ b/library/cpp/testing/unittest/registar.cpp @@ -364,7 +364,7 @@ void NUnitTest::TTestBase::AtEnd() { Processor()->UnitStop(unit); } -void NUnitTest::TTestBase::Run(std::function<void()> f, const TString& suite, const char* name, const bool forceFork) { +void NUnitTest::TTestBase::Run(std::function<void()> f, const TString& suite, const char* name, const bool forceFork) { TestErrors_ = 0; CurrentSubtest_ = name; Processor()->Run(f, suite, name, forceFork); diff --git a/library/cpp/testing/unittest/registar.h b/library/cpp/testing/unittest/registar.h index 44517a0092..76f48372bc 100644 --- a/library/cpp/testing/unittest/registar.h +++ b/library/cpp/testing/unittest/registar.h @@ -135,7 +135,7 @@ namespace NUnitTest { // Should execute a test whitin suite? virtual bool CheckAccessTest(TString /*suite*/, const char* /*name*/); - virtual void Run(std::function<void()> f, const TString& /*suite*/, const char* /*name*/, bool /*forceFork*/); + virtual void Run(std::function<void()> f, const TString& /*suite*/, const char* /*name*/, bool /*forceFork*/); // This process is forked for current test virtual bool GetIsForked() const; @@ -219,11 +219,11 @@ namespace NUnitTest { void AtEnd(); - void Run(std::function<void()> f, const TString& suite, const char* name, bool forceFork); + void Run(std::function<void()> f, const TString& suite, const char* name, bool forceFork); class TCleanUp { public: - explicit TCleanUp(TTestBase* base); + explicit TCleanUp(TTestBase* base); ~TCleanUp(); @@ -771,7 +771,7 @@ public: \ ITestSuiteProcessor* Processor() const noexcept; private: - explicit TTestFactory(ITestSuiteProcessor* processor); + explicit TTestFactory(ITestSuiteProcessor* processor); ~TTestFactory(); @@ -805,15 +805,15 @@ public: \ { } - inline TBaseTestCase(const char* name, std::function<void(TTestContext&)> body, bool forceFork) + inline TBaseTestCase(const char* name, std::function<void(TTestContext&)> body, bool forceFork) : Name_(name) - , Body_(std::move(body)) + , Body_(std::move(body)) , ForceFork_(forceFork) { } virtual ~TBaseTestCase() = default; - + // Each test case is executed in 3 steps: // // 1. SetUp() (from fixture) @@ -850,7 +850,7 @@ public: \ Parent->SetHandler(); } - TInvokeGuard(TInvokeGuard&& guard) noexcept + TInvokeGuard(TInvokeGuard&& guard) noexcept : Parent(guard.Parent) { guard.Parent = nullptr; @@ -912,7 +912,7 @@ public: \ }; #define UNIT_TEST_SUITE_REGISTRATION(T) \ - static const ::NUnitTest::TTestBaseFactory<T> Y_GENERATE_UNIQUE_ID(UTREG_); + static const ::NUnitTest::TTestBaseFactory<T> Y_GENERATE_UNIQUE_ID(UTREG_); #define Y_UNIT_TEST_SUITE_IMPL_F(N, T, F) \ namespace NTestSuite##N { \ @@ -936,9 +936,9 @@ public: \ return StaticName(); \ } \ \ - static void AddTest(const char* name, \ - const std::function<void(NUnitTest::TTestContext&)>& body, bool forceFork) \ - { \ + static void AddTest(const char* name, \ + const std::function<void(NUnitTest::TTestContext&)>& body, bool forceFork) \ + { \ Tests().push_back([=]{ return MakeHolder<NUnitTest::TBaseTestCase>(name, body, forceFork); }); \ } \ \ @@ -1005,7 +1005,7 @@ public: \ TCurrentTest::AddTest(TTestCase##N::Create); \ } \ }; \ - static const TTestRegistration##N testRegistration##N; + static const TTestRegistration##N testRegistration##N; #define Y_UNIT_TEST_IMPL(N, FF, F) \ Y_UNIT_TEST_IMPL_REGISTER(N, FF, F) \ diff --git a/library/cpp/testing/unittest/registar_ut.cpp b/library/cpp/testing/unittest/registar_ut.cpp index 1f36d53abb..b06a3f7a68 100644 --- a/library/cpp/testing/unittest/registar_ut.cpp +++ b/library/cpp/testing/unittest/registar_ut.cpp @@ -43,9 +43,9 @@ Y_UNIT_TEST_SUITE(TUnitTestMacroTest) { UNIT_ASSERT_TEST_FAILS(stringsEqual("q", TString("w"))); UNIT_ASSERT_TEST_FAILS(stringsEqual(TString("q"), "w")); UNIT_ASSERT_TEST_FAILS(stringsEqual(TString("a"), TString("b"))); - UNIT_ASSERT_TEST_FAILS(stringsEqual(TString("a"), TStringBuf("b"))); - UNIT_ASSERT_TEST_FAILS(stringsEqual("a", TStringBuf("b"))); - UNIT_ASSERT_TEST_FAILS(stringsEqual(TStringBuf("a"), "b")); + UNIT_ASSERT_TEST_FAILS(stringsEqual(TString("a"), TStringBuf("b"))); + UNIT_ASSERT_TEST_FAILS(stringsEqual("a", TStringBuf("b"))); + UNIT_ASSERT_TEST_FAILS(stringsEqual(TStringBuf("a"), "b")); TString empty; TStringBuf emptyBuf; @@ -86,19 +86,19 @@ Y_UNIT_TEST_SUITE(TUnitTestMacroTest) { UNIT_ASSERT_TEST_FAILS(stringsUnequal("", "")); UNIT_ASSERT_TEST_FAILS(stringsUnequal("42", TString("42"))); UNIT_ASSERT_TEST_FAILS(stringsUnequal(TString("4"), "4")); - UNIT_ASSERT_TEST_FAILS(stringsUnequal("d", TStringBuf("d"))); - UNIT_ASSERT_TEST_FAILS(stringsUnequal(TStringBuf("yandex"), "yandex")); - UNIT_ASSERT_TEST_FAILS(stringsUnequal(TStringBuf("index"), TString("index"))); - UNIT_ASSERT_TEST_FAILS(stringsUnequal(TString("diff"), TStringBuf("diff"))); + UNIT_ASSERT_TEST_FAILS(stringsUnequal("d", TStringBuf("d"))); + UNIT_ASSERT_TEST_FAILS(stringsUnequal(TStringBuf("yandex"), "yandex")); + UNIT_ASSERT_TEST_FAILS(stringsUnequal(TStringBuf("index"), TString("index"))); + UNIT_ASSERT_TEST_FAILS(stringsUnequal(TString("diff"), TStringBuf("diff"))); UNIT_ASSERT_STRINGS_UNEQUAL("1", "2"); UNIT_ASSERT_STRINGS_UNEQUAL("", "3"); - UNIT_ASSERT_STRINGS_UNEQUAL("green", TStringBuf("red")); - UNIT_ASSERT_STRINGS_UNEQUAL(TStringBuf("solomon"), "golovan"); + UNIT_ASSERT_STRINGS_UNEQUAL("green", TStringBuf("red")); + UNIT_ASSERT_STRINGS_UNEQUAL(TStringBuf("solomon"), "golovan"); UNIT_ASSERT_STRINGS_UNEQUAL("d", TString("f")); UNIT_ASSERT_STRINGS_UNEQUAL(TString("yandex"), "index"); - UNIT_ASSERT_STRINGS_UNEQUAL(TString("mail"), TStringBuf("yandex")); - UNIT_ASSERT_STRINGS_UNEQUAL(TStringBuf("C++"), TString("python")); + UNIT_ASSERT_STRINGS_UNEQUAL(TString("mail"), TStringBuf("yandex")); + UNIT_ASSERT_STRINGS_UNEQUAL(TStringBuf("C++"), TString("python")); } Y_UNIT_TEST(Equal) { @@ -352,7 +352,7 @@ Y_UNIT_TEST_SUITE(TUnitTestMacroTest) { Y_UNIT_TEST(ExceptionContains) { UNIT_ASSERT_TEST_FAILS(TTestException("abc").AssertExceptionContains<TTestException>("cba")); - UNIT_ASSERT_TEST_FAILS(TTestException("abc").AssertExceptionContains<TTestException>(TStringBuf("cba"))); + UNIT_ASSERT_TEST_FAILS(TTestException("abc").AssertExceptionContains<TTestException>(TStringBuf("cba"))); UNIT_ASSERT_TEST_FAILS(TTestException("abc").AssertExceptionContains<TTestException>(TString("cba"))); UNIT_ASSERT_TEST_FAILS(TTestException("abc").AssertExceptionContains<TTestException>(TStringBuilder() << "cba")); diff --git a/library/cpp/testing/unittest/utmain.cpp b/library/cpp/testing/unittest/utmain.cpp index 305bc6b40f..7f345ba7ca 100644 --- a/library/cpp/testing/unittest/utmain.cpp +++ b/library/cpp/testing/unittest/utmain.cpp @@ -151,12 +151,12 @@ private: TStringBuilder msgs; for (const TString& m : ErrorMessages) { if (msgs) { - msgs << TStringBuf("\n"); + msgs << TStringBuf("\n"); } msgs << m; } if (msgs) { - msgs << TStringBuf("\n"); + msgs << TStringBuf("\n"); } TraceSubtestFinished(descr->test->unit->name.data(), descr->test->name, "fail", msgs, descr->Context); ErrorMessages.clear(); |