diff options
author | Aleksandr <ivansduck@gmail.com> | 2022-02-10 16:47:52 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:52 +0300 |
commit | b05913d1c3c02a773578bceb7285084d2933ae86 (patch) | |
tree | c0748b5dcbade83af788c0abfa89c0383d6b779c /library/cpp/testing/unittest/registar.cpp | |
parent | ea6c5b7f172becca389cacaff7d5f45f6adccbe6 (diff) | |
download | ydb-b05913d1c3c02a773578bceb7285084d2933ae86.tar.gz |
Restoring authorship annotation for Aleksandr <ivansduck@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/testing/unittest/registar.cpp')
-rw-r--r-- | library/cpp/testing/unittest/registar.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/library/cpp/testing/unittest/registar.cpp b/library/cpp/testing/unittest/registar.cpp index 06882dd1ae..3679b768ed 100644 --- a/library/cpp/testing/unittest/registar.cpp +++ b/library/cpp/testing/unittest/registar.cpp @@ -106,10 +106,10 @@ struct TDiffColorizer { } }; -struct TTraceDiffFormatter { +struct TTraceDiffFormatter { bool Reverse = false; - explicit TTraceDiffFormatter(bool reverse = false) + explicit TTraceDiffFormatter(bool reverse = false) : Reverse(reverse) { } @@ -123,26 +123,26 @@ struct TTraceDiffFormatter { } TString Left(TArrayRef<const char> str) const { - return NUnitTest::GetFormatTag("good") + + return NUnitTest::GetFormatTag("good") + TString(str.begin(), str.end()) + NUnitTest::GetResetTag(); } TString Right(TArrayRef<const char> str) const { - return NUnitTest::GetFormatTag("bad") + + return NUnitTest::GetFormatTag("bad") + TString(str.begin(), str.end()) + NUnitTest::GetResetTag(); } }; TString NUnitTest::GetFormatTag(const char* name) { - return Sprintf("[[%s]]", name); -} - + return Sprintf("[[%s]]", name); +} + TString NUnitTest::GetResetTag() { return TString("[[rst]]"); -} - +} + TString NUnitTest::ColoredDiff(TStringBuf s1, TStringBuf s2, const TString& delims, bool reverse) { TStringStream res; TVector<NDiff::TChunk<char>> chunks; @@ -150,8 +150,8 @@ TString NUnitTest::ColoredDiff(TStringBuf s1, TStringBuf s2, const TString& deli if (NUnitTest::ShouldColorizeDiff) { NDiff::PrintChunks(res, TDiffColorizer(reverse), chunks); } else { - res << NUnitTest::GetResetTag(); - NDiff::PrintChunks(res, TTraceDiffFormatter(reverse), chunks); + res << NUnitTest::GetResetTag(); + NDiff::PrintChunks(res, TTraceDiffFormatter(reverse), chunks); } return res.Str(); } @@ -478,18 +478,18 @@ unsigned NUnitTest::TTestFactory::Execute() { #ifdef _unix_ // on Windows RTTI causes memory leaks TString type = test->TypeId(); if (types.insert(type).second == false) { - warnx("Duplicate suite found: %s (%s). Probably you have copy-pasted suite without changing it name", factory->Name().c_str(), type.c_str()); + warnx("Duplicate suite found: %s (%s). Probably you have copy-pasted suite without changing it name", factory->Name().c_str(), type.c_str()); return 1; } #endif // _unix_ test->Parent_ = this; -#ifdef UT_SKIP_EXCEPTIONS +#ifdef UT_SKIP_EXCEPTIONS try { #endif test->Execute(); -#ifdef UT_SKIP_EXCEPTIONS +#ifdef UT_SKIP_EXCEPTIONS } catch (...) { } #endif @@ -497,7 +497,7 @@ unsigned NUnitTest::TTestFactory::Execute() { Processor_->End(); - return bool(Processor_->FailTests()); + return bool(Processor_->FailTests()); } void NUnitTest::TTestFactory::SetProcessor(ITestSuiteProcessor* processor) { |