diff options
| author | deshevoy <[email protected]> | 2022-02-10 16:46:57 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:46:57 +0300 | 
| commit | 28148f76dbfcc644d96427d41c92f36cbf2fdc6e (patch) | |
| tree | b83306b6e37edeea782e9eed673d89286c4fef35 /library/cpp/testing | |
| parent | e988f30484abe5fdeedcc7a5d3c226c01a21800c (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/testing')
| -rw-r--r-- | library/cpp/testing/common/env.h | 2 | ||||
| -rw-r--r-- | library/cpp/testing/unittest/registar.h | 60 | ||||
| -rw-r--r-- | library/cpp/testing/unittest/simple.h | 2 | ||||
| -rw-r--r-- | library/cpp/testing/unittest/utmain.cpp | 8 | 
4 files changed, 36 insertions, 36 deletions
| diff --git a/library/cpp/testing/common/env.h b/library/cpp/testing/common/env.h index 10d8e51477f..7b89aa1bed8 100644 --- a/library/cpp/testing/common/env.h +++ b/library/cpp/testing/common/env.h @@ -26,7 +26,7 @@ bool FromYaTest();  // @brief returns TestsData dir (from env:ARCADIA_TESTS_DATA_DIR or path to existing folder `arcadia_tests_data` within parent folders)  TString GetArcadiaTestsData(); -  +  // @brief return current working dir (from env:TEST_WORK_PATH or cwd)  TString GetWorkPath(); diff --git a/library/cpp/testing/unittest/registar.h b/library/cpp/testing/unittest/registar.h index 40093717810..44517a00924 100644 --- a/library/cpp/testing/unittest/registar.h +++ b/library/cpp/testing/unittest/registar.h @@ -60,23 +60,23 @@ namespace NUnitTest {      class TAssertException: public yexception {      }; -    class ITestSuiteProcessor;  -  +    class ITestSuiteProcessor; +      struct TTestContext { -        TTestContext()  +        TTestContext()              : Processor(nullptr)          { -        }  -  -        explicit TTestContext(ITestSuiteProcessor* processor)  +        } + +        explicit TTestContext(ITestSuiteProcessor* processor)              : Processor(processor)          { -        }  -  +        } +          using TMetrics = THashMap<TString, double>;          TMetrics Metrics; -  -        ITestSuiteProcessor* Processor;  + +        ITestSuiteProcessor* Processor;      };      class ITestSuiteProcessor { @@ -307,22 +307,22 @@ private:                                                   \          this->TTestBase::Run(std::bind(&T##F##Caller::X, this, context), StaticName(), (#F), FF); \      } -#define UNIT_TEST_IMPL(F, FF)                                          \  -    UNIT_TEST_CHECK_TEST_IS_DECLARED_ONLY_ONCE(F) {                    \  -        NUnitTest::TTestContext context(this->TTestBase::Processor()); \  -        if (this->CheckAccessTest((#F))) {                             \  -            try {                                                      \  -                UNIT_TEST_RUN(F, FF, context)                          \  -            } catch (const ::NUnitTest::TAssertException&) {           \  -            } catch (const yexception& e) {                            \  -                CATCH_REACTION_BT((#F), e, &context);                  \  -            } catch (const std::exception& e) {                        \  -                CATCH_REACTION((#F), e, &context);                     \  -            } catch (...) {                                            \  -                this->AddError("non-std exception!", &context);        \  -            }                                                          \  -            this->Finish((#F), &context);                              \  -        }                                                              \  +#define UNIT_TEST_IMPL(F, FF)                                          \ +    UNIT_TEST_CHECK_TEST_IS_DECLARED_ONLY_ONCE(F) {                    \ +        NUnitTest::TTestContext context(this->TTestBase::Processor()); \ +        if (this->CheckAccessTest((#F))) {                             \ +            try {                                                      \ +                UNIT_TEST_RUN(F, FF, context)                          \ +            } catch (const ::NUnitTest::TAssertException&) {           \ +            } catch (const yexception& e) {                            \ +                CATCH_REACTION_BT((#F), e, &context);                  \ +            } catch (const std::exception& e) {                        \ +                CATCH_REACTION((#F), e, &context);                     \ +            } catch (...) {                                            \ +                this->AddError("non-std exception!", &context);        \ +            }                                                          \ +            this->Finish((#F), &context);                              \ +        }                                                              \      }  #define UNIT_TEST(F) UNIT_TEST_IMPL(F, false) @@ -335,7 +335,7 @@ private:                                                   \          UNIT_TEST_IMPL(F, false);                                                                                      \          /* forked process (or main without "--fork-tests") treats some exceptions as success - it's exception test! */ \      } else {                                                                                                           \ -        NUnitTest::TTestContext context(this->TTestBase::Processor());                                                 \  +        NUnitTest::TTestContext context(this->TTestBase::Processor());                                                 \          if (this->CheckAccessTest((#F))) {                                                                             \              try {                                                                                                      \                  UNIT_TEST_RUN(F, false, context)                                                                       \ @@ -752,7 +752,7 @@ public:                       \  #define UNIT_ASSERT_TEST_FAILS(A) UNIT_ASSERT_TEST_FAILS_C(A, "") -#define UNIT_ADD_METRIC(name, value) ut_context.Metrics[name] = value  +#define UNIT_ADD_METRIC(name, value) ut_context.Metrics[name] = value      class TTestFactory {          friend class TTestBase; @@ -953,7 +953,7 @@ public:                       \                      if (!this->CheckAccessTest(i->Name_)) {                                                             \                          continue;                                                                                       \                      }                                                                                                   \ -                    NUnitTest::TTestContext context(this->TTestBase::Processor());                                      \  +                    NUnitTest::TTestContext context(this->TTestBase::Processor());                                      \                      try {                                                                                               \                          this->BeforeTest(i->Name_);                                                                     \                          {                                                                                               \ @@ -1009,7 +1009,7 @@ public:                       \  #define Y_UNIT_TEST_IMPL(N, FF, F)      \      Y_UNIT_TEST_IMPL_REGISTER(N, FF, F) \ -    void TTestCase##N::Execute_(NUnitTest::TTestContext& ut_context Y_DECLARE_UNUSED)  +    void TTestCase##N::Execute_(NUnitTest::TTestContext& ut_context Y_DECLARE_UNUSED)  #define Y_UNIT_TEST(N) Y_UNIT_TEST_IMPL(N, false, TCurrentTestCase)  #define Y_UNIT_TEST_F(N, F) Y_UNIT_TEST_IMPL(N, false, F) diff --git a/library/cpp/testing/unittest/simple.h b/library/cpp/testing/unittest/simple.h index 52309d68aff..2a5300d886e 100644 --- a/library/cpp/testing/unittest/simple.h +++ b/library/cpp/testing/unittest/simple.h @@ -15,7 +15,7 @@ namespace NUnitTest {                  if (!CheckAccessTest(i->Name_)) {                      continue;                  } -                TTestContext context(this->Processor());  +                TTestContext context(this->Processor());                  try {                      BeforeTest(i->Name_);                      { diff --git a/library/cpp/testing/unittest/utmain.cpp b/library/cpp/testing/unittest/utmain.cpp index 5982754dd79..305bc6b40fc 100644 --- a/library/cpp/testing/unittest/utmain.cpp +++ b/library/cpp/testing/unittest/utmain.cpp @@ -727,10 +727,10 @@ int NUnitTest::RunMain(int argc, char** argv) {                      ++i;                      listFile = MakeHolder<TFixedBufferFileOutput>(argv[i]);                      listStream = listFile.Get(); -                } else if (strcmp(name, "--test-param") == 0) {  -                    ++i;  -                    TString param(argv[i]);  -                    size_t assign = param.find('=');  +                } else if (strcmp(name, "--test-param") == 0) { +                    ++i; +                    TString param(argv[i]); +                    size_t assign = param.find('=');                      Singleton<::NPrivate::TTestEnv>()->AddTestParam(param.substr(0, assign), param.substr(assign + 1));                  } else if (TString(name).StartsWith("--")) {                      return DoUsage(argv[0]), 1; | 
