diff options
| author | antonovvk <[email protected]> | 2022-02-10 16:47:51 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:47:51 +0300 | 
| commit | 37a63debdc21e372d99e1808cdd31aecf75018c3 (patch) | |
| tree | fd84293fb9a1b16381dd6c1a5e14c78afacb8710 /library/cpp/testing/unittest | |
| parent | 1fe621e70df847cc201ac942fe6d7804ea10508d (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/testing/unittest')
| -rw-r--r-- | library/cpp/testing/unittest/registar.cpp | 36 | ||||
| -rw-r--r-- | library/cpp/testing/unittest/registar.h | 6 | 
2 files changed, 21 insertions, 21 deletions
| diff --git a/library/cpp/testing/unittest/registar.cpp b/library/cpp/testing/unittest/registar.cpp index 3679b768ed4..8dbcb8ab951 100644 --- a/library/cpp/testing/unittest/registar.cpp +++ b/library/cpp/testing/unittest/registar.cpp @@ -2,7 +2,7 @@  #include <library/cpp/diff/diff.h>  #include <library/cpp/colorizer/colors.h> - +   #include <util/generic/bt_exception.h>  #include <util/random/fast.h>  #include <util/string/printf.h> @@ -62,7 +62,7 @@ void ::NUnitTest::NPrivate::SetUnittestThread(bool unittestThread) {      Y_VERIFY(UnittestThread != unittestThread, "state check");      UnittestThread = unittestThread;  } - +   void ::NUnitTest::NPrivate::SetCurrentTest(TTestBase* test) {      Y_VERIFY(!test || !currentTest, "state check");      currentTest = test; @@ -72,10 +72,10 @@ NUnitTest::TTestBase* ::NUnitTest::NPrivate::GetCurrentTest() {      return currentTest;  } -struct TDiffColorizer { -    NColorizer::TColors Colors; +struct TDiffColorizer {  +    NColorizer::TColors Colors;       bool Reverse = false; - +       explicit TDiffColorizer(bool reverse = false)          : Reverse(reverse)      { @@ -83,19 +83,19 @@ struct TDiffColorizer {      TString Special(TStringBuf str) const {          return ToString(Colors.YellowColor()) + str; -    } - +    }  +       TString Common(TArrayRef<const char> str) const {          return ToString(Colors.OldColor()) + TString(str.begin(), str.end()); -    } - +    }  +       TString Left(TArrayRef<const char> str) const {          return ToString(GetLeftColor()) + TString(str.begin(), str.end()); -    } - +    }  +       TString Right(TArrayRef<const char> str) const {          return ToString(GetRightColor()) + TString(str.begin(), str.end()); -    } +    }       TStringBuf GetLeftColor() const {          return Reverse ? Colors.RedColor() : Colors.GreenColor(); @@ -104,8 +104,8 @@ struct TDiffColorizer {      TStringBuf GetRightColor() const {          return Reverse ? Colors.GreenColor() : Colors.RedColor();      } -}; - +};  +   struct TTraceDiffFormatter {      bool Reverse = false; @@ -144,17 +144,17 @@ TString NUnitTest::GetResetTag() {  }  TString NUnitTest::ColoredDiff(TStringBuf s1, TStringBuf s2, const TString& delims, bool reverse) { -    TStringStream res; +    TStringStream res;       TVector<NDiff::TChunk<char>> chunks; -    NDiff::InlineDiff(chunks, s1, s2, delims); +    NDiff::InlineDiff(chunks, s1, s2, delims);       if (NUnitTest::ShouldColorizeDiff) {          NDiff::PrintChunks(res, TDiffColorizer(reverse), chunks);      } else {          res << NUnitTest::GetResetTag();          NDiff::PrintChunks(res, TTraceDiffFormatter(reverse), chunks);      } -    return res.Str(); -} +    return res.Str();  +}   static TString MakeTestName(const NUnitTest::ITestSuiteProcessor::TTest& test) {      return TStringBuilder() << test.unit->name << "::" << test.name; diff --git a/library/cpp/testing/unittest/registar.h b/library/cpp/testing/unittest/registar.h index 44517a00924..22c0eaafa4d 100644 --- a/library/cpp/testing/unittest/registar.h +++ b/library/cpp/testing/unittest/registar.h @@ -44,7 +44,7 @@ namespace NUnitTest {      TString ColoredDiff(TStringBuf s1, TStringBuf s2, const TString& delims = TString(), bool reverse = false);      TString GetFormatTag(const char* name);      TString GetResetTag(); - +       // Raise error handler      // Used for testing library/cpp/testing/unittest macroses      // and unittest helpers. @@ -456,8 +456,8 @@ public:                       \          if (_a != _b) {                                                                                                                        \              UNIT_FAIL_IMPL("strings (" #A ") and (" #B ") are different", Sprintf("\n%s", ::NUnitTest::ColoredDiff(_a, _b, " \t\n.,:;'\"").data())); \          }                                                                                                                                      \ -    } while (false) - +    } while (false)  +   //strings  #define UNIT_ASSERT_STRINGS_UNEQUAL_C(A, B, C)                                                           \      do {                                                                                                 \ | 
