diff options
| author | glebx777 <[email protected]> | 2022-02-10 16:49:44 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:49:44 +0300 | 
| commit | 573561e4ea1e5fcbf31e871b7f81ece0051c6bf2 (patch) | |
| tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /util/generic | |
| parent | ab9150ae9d81b97b19a2a6a8b903f9a40791c8b4 (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'util/generic')
| -rw-r--r-- | util/generic/array_ref.h | 8 | ||||
| -rw-r--r-- | util/generic/yexception.h | 32 | ||||
| -rw-r--r-- | util/generic/yexception_ut.cpp | 36 | 
3 files changed, 38 insertions, 38 deletions
diff --git a/util/generic/array_ref.h b/util/generic/array_ref.h index adecc340dbc..1ac60ac7d3c 100644 --- a/util/generic/array_ref.h +++ b/util/generic/array_ref.h @@ -273,8 +273,8 @@ template <class T>  constexpr TArrayRef<T> MakeArrayRef(T* data, size_t size) {      return TArrayRef<T>(data, size);  } -  -template <class T>  + +template <class T>  constexpr TArrayRef<T> MakeArrayRef(T* begin, T* end) { -    return TArrayRef<T>(begin, end);  -}  +    return TArrayRef<T>(begin, end); +} diff --git a/util/generic/yexception.h b/util/generic/yexception.h index c77cd96db1e..b0c604e8c45 100644 --- a/util/generic/yexception.h +++ b/util/generic/yexception.h @@ -22,21 +22,21 @@  class TBackTrace;  namespace NPrivateException { -    class TTempBufCuttingWrapperOutput: public IOutputStream {  -    public:  -        TTempBufCuttingWrapperOutput(TTempBuf& tempbuf)  -            : TempBuf_(tempbuf)  -        {  -        }  -  -        void DoWrite(const void* data, size_t len) override {  -            TempBuf_.Append(data, Min(len, TempBuf_.Left()));  -        }  -  -    private:  -        TTempBuf& TempBuf_;  -    };  -  +    class TTempBufCuttingWrapperOutput: public IOutputStream { +    public: +        TTempBufCuttingWrapperOutput(TTempBuf& tempbuf) +            : TempBuf_(tempbuf) +        { +        } + +        void DoWrite(const void* data, size_t len) override { +            TempBuf_.Append(data, Min(len, TempBuf_.Left())); +        } + +    private: +        TTempBuf& TempBuf_; +    }; +      class yexception: public std::exception {      public:          yexception(); @@ -51,7 +51,7 @@ namespace NPrivateException {          template <class T>          inline void Append(const T& t) { -            TTempBufCuttingWrapperOutput tempBuf(Buf_);  +            TTempBufCuttingWrapperOutput tempBuf(Buf_);              static_cast<IOutputStream&>(tempBuf) << t;              ZeroTerminate();          } diff --git a/util/generic/yexception_ut.cpp b/util/generic/yexception_ut.cpp index a724c7dcdba..cb3e29fed84 100644 --- a/util/generic/yexception_ut.cpp +++ b/util/generic/yexception_ut.cpp @@ -11,8 +11,8 @@ static inline void Throw2DontMove() {  #include <library/cpp/testing/unittest/registar.h>  #include <util/generic/algorithm.h> -#include <util/memory/tempbuf.h>  -#include <util/random/mersenne.h>  +#include <util/memory/tempbuf.h> +#include <util/random/mersenne.h>  #include <util/stream/output.h>  #include <util/string/subst.h> @@ -50,7 +50,7 @@ class TExceptionTest: public TTestBase {      UNIT_TEST(TestEnsureWithBackTrace2)      UNIT_TEST(TestRethrowAppend)      UNIT_TEST(TestMacroOverload) -    UNIT_TEST(TestMessageCrop)  +    UNIT_TEST(TestMessageCrop)      UNIT_TEST(TestTIoSystemErrorSpecialMethods)      UNIT_TEST(TestCurrentExceptionTypeNameMethod)      UNIT_TEST_SUITE_END(); @@ -280,22 +280,22 @@ private:              UNIT_ASSERT(e.AsStrBuf().Contains("10 > 20"));          }      } -  -    void TestMessageCrop() {  -        TTempBuf tmp;  -        size_t size = tmp.Size() * 1.5;  -        TString s;  -        s.reserve(size);  -        TMersenne<ui64> generator(42);  -        for (int j = 0; j < 50; ++j) {  -            for (size_t i = 0; i < size; ++i) {  -                s += static_cast<char>('a' + generator() % 26);  -            }  -            yexception e;  -            e << s;  + +    void TestMessageCrop() { +        TTempBuf tmp; +        size_t size = tmp.Size() * 1.5; +        TString s; +        s.reserve(size); +        TMersenne<ui64> generator(42); +        for (int j = 0; j < 50; ++j) { +            for (size_t i = 0; i < size; ++i) { +                s += static_cast<char>('a' + generator() % 26); +            } +            yexception e; +            e << s;              UNIT_ASSERT_EQUAL(e.AsStrBuf(), s.substr(0, tmp.Size() - 1)); -        }  -    }  +        } +    }      void TestTIoSystemErrorSpecialMethods() {          TString testStr{"systemError"};  | 
