diff options
| author | yazevnul <[email protected]> | 2022-02-10 16:46:48 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:46:48 +0300 | 
| commit | 9abfb1a53b7f7b791444d1378e645d8fad9b06ed (patch) | |
| tree | 49e222ea1c5804306084bb3ae065bb702625360f /library/cpp/json | |
| parent | 8cbc307de0221f84c80c42dcbe07d40727537e2c (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/json')
| -rw-r--r-- | library/cpp/json/fast_sax/parser.rl6 | 34 | ||||
| -rw-r--r-- | library/cpp/json/rapidjson_helpers.h | 4 | ||||
| -rw-r--r-- | library/cpp/json/ut/json_prettifier_ut.cpp | 12 | ||||
| -rw-r--r-- | library/cpp/json/ut/json_reader_ut.cpp | 20 | ||||
| -rw-r--r-- | library/cpp/json/ut/json_writer_ut.cpp | 18 | ||||
| -rw-r--r-- | library/cpp/json/ut/ya.make | 4 | ||||
| -rw-r--r-- | library/cpp/json/writer/json.h | 6 | ||||
| -rw-r--r-- | library/cpp/json/writer/json_ut.cpp | 46 | ||||
| -rw-r--r-- | library/cpp/json/writer/json_value.cpp | 10 | ||||
| -rw-r--r-- | library/cpp/json/writer/json_value_ut.cpp | 40 | ||||
| -rw-r--r-- | library/cpp/json/yson/json2yson_ut.cpp | 2 | 
11 files changed, 98 insertions, 98 deletions
| diff --git a/library/cpp/json/fast_sax/parser.rl6 b/library/cpp/json/fast_sax/parser.rl6 index d25e26b02e7..edb4e9ee1b3 100644 --- a/library/cpp/json/fast_sax/parser.rl6 +++ b/library/cpp/json/fast_sax/parser.rl6 @@ -124,7 +124,7 @@ struct TParserCtx {      }      bool OnString(TStringBuf s, EStoredStr t) { -        if (Y_LIKELY(OnVal())) {  +        if (Y_LIKELY(OnVal())) {              String = s;              Stored = t;              return true; @@ -210,21 +210,21 @@ machine fastjson;  alphtype char; -action OnNull  { if (Y_UNLIKELY(!OnNull()))  goto TOKEN_ERROR; }  -action OnTrue  { if (Y_UNLIKELY(!OnTrue()))  goto TOKEN_ERROR; }  -action OnFalse { if (Y_UNLIKELY(!OnFalse())) goto TOKEN_ERROR; }  -action OnPInt  { if (Y_UNLIKELY(!OnPInt()))  goto TOKEN_ERROR; }  -action OnNInt  { if (Y_UNLIKELY(!OnNInt()))  goto TOKEN_ERROR; }  -action OnFlt   { if (Y_UNLIKELY(!OnFlt()))   goto TOKEN_ERROR; }  -action OnStrU  { if (Y_UNLIKELY(!OnStrU()))  goto TOKEN_ERROR; }  -action OnStrQ  { if (Y_UNLIKELY(!OnStrQ()))  goto TOKEN_ERROR; }  -action OnStrE  { if (Y_UNLIKELY(!OnStrE()))  goto TOKEN_ERROR; }  -action OnDictO { if (Y_UNLIKELY(!OnMapOpen()))  goto TOKEN_ERROR; }  -action OnDictC { if (Y_UNLIKELY(!OnMapClose())) goto TOKEN_ERROR; }  -action OnArrO  { if (Y_UNLIKELY(!OnArrOpen()))  goto TOKEN_ERROR; }  -action OnArrC  { if (Y_UNLIKELY(!OnArrClose())) goto TOKEN_ERROR; }  -action OnComma { if (Y_UNLIKELY(!OnComma())) goto TOKEN_ERROR; }  -action OnColon { if (Y_UNLIKELY(!OnColon())) goto TOKEN_ERROR; }  +action OnNull  { if (Y_UNLIKELY(!OnNull()))  goto TOKEN_ERROR; } +action OnTrue  { if (Y_UNLIKELY(!OnTrue()))  goto TOKEN_ERROR; } +action OnFalse { if (Y_UNLIKELY(!OnFalse())) goto TOKEN_ERROR; } +action OnPInt  { if (Y_UNLIKELY(!OnPInt()))  goto TOKEN_ERROR; } +action OnNInt  { if (Y_UNLIKELY(!OnNInt()))  goto TOKEN_ERROR; } +action OnFlt   { if (Y_UNLIKELY(!OnFlt()))   goto TOKEN_ERROR; } +action OnStrU  { if (Y_UNLIKELY(!OnStrU()))  goto TOKEN_ERROR; } +action OnStrQ  { if (Y_UNLIKELY(!OnStrQ()))  goto TOKEN_ERROR; } +action OnStrE  { if (Y_UNLIKELY(!OnStrE()))  goto TOKEN_ERROR; } +action OnDictO { if (Y_UNLIKELY(!OnMapOpen()))  goto TOKEN_ERROR; } +action OnDictC { if (Y_UNLIKELY(!OnMapClose())) goto TOKEN_ERROR; } +action OnArrO  { if (Y_UNLIKELY(!OnArrOpen()))  goto TOKEN_ERROR; } +action OnArrC  { if (Y_UNLIKELY(!OnArrClose())) goto TOKEN_ERROR; } +action OnComma { if (Y_UNLIKELY(!OnComma())) goto TOKEN_ERROR; } +action OnColon { if (Y_UNLIKELY(!OnColon())) goto TOKEN_ERROR; }  action OnError { goto TOKEN_ERROR; }  comment1 = "/*" (any* -- "*/") "*/"; @@ -296,7 +296,7 @@ bool TParserCtx::Parse() {              write exec;          }%%          ; -        Y_UNUSED(fastjson_en_main);  +        Y_UNUSED(fastjson_en_main);      } catch (const TFromStringException& e) {          return OnError(e.what());      } diff --git a/library/cpp/json/rapidjson_helpers.h b/library/cpp/json/rapidjson_helpers.h index 945a9ff7ee8..aeb96ff6703 100644 --- a/library/cpp/json/rapidjson_helpers.h +++ b/library/cpp/json/rapidjson_helpers.h @@ -58,7 +58,7 @@ namespace NJson {              return Count;          } -        TInputStreamWrapper(IInputStream& helper)  +        TInputStreamWrapper(IInputStream& helper)              : Helper(helper)              , Eof(false)              , Sz(0) @@ -69,7 +69,7 @@ namespace NJson {          static const size_t BUF_SIZE = 1 << 12; -        IInputStream& Helper;  +        IInputStream& Helper;          mutable char Buf[BUF_SIZE];          mutable bool Eof;          mutable size_t Sz; diff --git a/library/cpp/json/ut/json_prettifier_ut.cpp b/library/cpp/json/ut/json_prettifier_ut.cpp index 4ca9d5bd811..ae5f8dd81a4 100644 --- a/library/cpp/json/ut/json_prettifier_ut.cpp +++ b/library/cpp/json/ut/json_prettifier_ut.cpp @@ -2,8 +2,8 @@  #include <library/cpp/testing/unittest/registar.h> -Y_UNIT_TEST_SUITE(JsonPrettifier) {  -    Y_UNIT_TEST(PrettifyJsonShort) {  +Y_UNIT_TEST_SUITE(JsonPrettifier) { +    Y_UNIT_TEST(PrettifyJsonShort) {          UNIT_ASSERT_STRINGS_EQUAL(NJson::PrettifyJson(""), "");          UNIT_ASSERT_STRINGS_EQUAL(NJson::PrettifyJson("null"), "null");          UNIT_ASSERT_STRINGS_EQUAL(NJson::PrettifyJson("true"), "true"); @@ -34,7 +34,7 @@ Y_UNIT_TEST_SUITE(JsonPrettifier) {          UNIT_ASSERT_STRINGS_EQUAL(NJson::PrettifyJson("{k:v}", true, 2), "{\n  k : v\n}");      } -    Y_UNIT_TEST(PrettifyJsonLong) {  +    Y_UNIT_TEST(PrettifyJsonLong) {          UNIT_ASSERT_STRINGS_EQUAL(NJson::PrettifyJson("[{k:v},{a:b}]", false, 2, true),                                    "[\n"                                    "  {\n" @@ -110,7 +110,7 @@ Y_UNIT_TEST_SUITE(JsonPrettifier) {                                    "}");      } -    Y_UNIT_TEST(PrettifyJsonInvalid) {  +    Y_UNIT_TEST(PrettifyJsonInvalid) {          UNIT_ASSERT_STRINGS_EQUAL(NJson::PrettifyJson("}"), "");          UNIT_ASSERT_STRINGS_EQUAL(NJson::PrettifyJson("}}"), "");          UNIT_ASSERT_STRINGS_EQUAL(NJson::PrettifyJson("{}}"), ""); @@ -123,7 +123,7 @@ Y_UNIT_TEST_SUITE(JsonPrettifier) {          UNIT_ASSERT_STRINGS_EQUAL(NJson::PrettifyJson("{,,,}"), "");      } -    Y_UNIT_TEST(CompactifyJsonShort) {  +    Y_UNIT_TEST(CompactifyJsonShort) {          UNIT_ASSERT_STRINGS_EQUAL(NJson::CompactifyJson(""), "");          UNIT_ASSERT_STRINGS_EQUAL(NJson::CompactifyJson("null"), "null");          UNIT_ASSERT_STRINGS_EQUAL(NJson::CompactifyJson("true"), "true"); @@ -142,7 +142,7 @@ Y_UNIT_TEST_SUITE(JsonPrettifier) {          UNIT_ASSERT_STRINGS_EQUAL(NJson::CompactifyJson("{\n  'k' : 'v'\n}", true), "{k:v}");      } -    Y_UNIT_TEST(CompactifyJsonLong) {  +    Y_UNIT_TEST(CompactifyJsonLong) {          UNIT_ASSERT_STRINGS_EQUAL(NJson::CompactifyJson(                                        "[\n"                                        "  {\n" diff --git a/library/cpp/json/ut/json_reader_ut.cpp b/library/cpp/json/ut/json_reader_ut.cpp index f4c9bf9df6f..cd31afa0b8b 100644 --- a/library/cpp/json/ut/json_reader_ut.cpp +++ b/library/cpp/json/ut/json_reader_ut.cpp @@ -66,8 +66,8 @@ public:      }  }; -Y_UNIT_TEST_SUITE(TJsonReaderTest) {  -    Y_UNIT_TEST(JsonReformatTest) {  +Y_UNIT_TEST_SUITE(TJsonReaderTest) { +    Y_UNIT_TEST(JsonReformatTest) {          TString data = "{\"null value\": null, \"intkey\": 10, \"double key\": 11.11, \"string key\": \"string\", \"array\": [1,2,3,\"TString\"], \"bool key\": true}";          TString result1, result2; @@ -119,7 +119,7 @@ Y_UNIT_TEST_SUITE(TJsonReaderTest) {          }      } -    Y_UNIT_TEST(TJsonTreeTest) {  +    Y_UNIT_TEST(TJsonTreeTest) {          TString data = "{\"intkey\": 10, \"double key\": 11.11, \"null value\":null, \"string key\": \"string\", \"array\": [1,2,3,\"TString\"], \"bool key\": true}";          TStringStream in;          in << data; @@ -154,7 +154,7 @@ Y_UNIT_TEST_SUITE(TJsonReaderTest) {          UNIT_ASSERT_VALUES_EQUAL(value["array"][3].GetString(), (*array)[3].GetString());      } -    Y_UNIT_TEST(TJsonRomaTest) {  +    Y_UNIT_TEST(TJsonRomaTest) {          TString data = "{\"test\": [ {\"name\": \"A\"} ]}";          TStringStream in; @@ -165,7 +165,7 @@ Y_UNIT_TEST_SUITE(TJsonReaderTest) {          UNIT_ASSERT_VALUES_EQUAL(value["test"][0]["name"].GetString(), TString("A"));      } -    Y_UNIT_TEST(TJsonReadTreeWithComments) {  +    Y_UNIT_TEST(TJsonReadTreeWithComments) {          {              TString leadingCommentData = "{ // \"test\" : 1 \n}";              { @@ -209,7 +209,7 @@ Y_UNIT_TEST_SUITE(TJsonReaderTest) {          }      } -    Y_UNIT_TEST(TJsonSignedIntegerTest) {  +    Y_UNIT_TEST(TJsonSignedIntegerTest) {          {              TStringStream in;              in << "{ \"test\" : " << Min<i64>() << " }"; @@ -234,7 +234,7 @@ Y_UNIT_TEST_SUITE(TJsonReaderTest) {          } // Max<i64>() + 1      } -    Y_UNIT_TEST(TJsonUnsignedIntegerTest) {  +    Y_UNIT_TEST(TJsonUnsignedIntegerTest) {          {              TStringStream in;              in << "{ \"test\" : 1 }"; @@ -309,7 +309,7 @@ Y_UNIT_TEST_SUITE(TJsonReaderTest) {          }      } // TJsonUnsignedIntegerTest -    Y_UNIT_TEST(TJsonDoubleTest) {  +    Y_UNIT_TEST(TJsonDoubleTest) {          {              TStringStream in;              in << "{ \"test\" : 1.0 }"; @@ -355,7 +355,7 @@ Y_UNIT_TEST_SUITE(TJsonReaderTest) {          } // Max<ui64>()      }     // TJsonDoubleTest -    Y_UNIT_TEST(TJsonInvalidTest) {  +    Y_UNIT_TEST(TJsonInvalidTest) {          {              // No exceptions mode.              TStringStream in; @@ -373,7 +373,7 @@ Y_UNIT_TEST_SUITE(TJsonReaderTest) {          }      } -    Y_UNIT_TEST(TJsonMemoryLeakTest) {  +    Y_UNIT_TEST(TJsonMemoryLeakTest) {          // after https://clubs.at.yandex-team.ru/stackoverflow/3691          TString s = ".";          NJson::TJsonValue json; diff --git a/library/cpp/json/ut/json_writer_ut.cpp b/library/cpp/json/ut/json_writer_ut.cpp index bda63e38075..ca11d34dad9 100644 --- a/library/cpp/json/ut/json_writer_ut.cpp +++ b/library/cpp/json/ut/json_writer_ut.cpp @@ -5,8 +5,8 @@  using namespace NJson; -Y_UNIT_TEST_SUITE(TJsonWriterTest) {  -    Y_UNIT_TEST(SimpleWriteTest) {  +Y_UNIT_TEST_SUITE(TJsonWriterTest) { +    Y_UNIT_TEST(SimpleWriteTest) {          TString expected1 = "{\"key1\":1,\"key2\":2,\"key3\":3";          TString expected2 = expected1 + ",\"array\":[\"stroka\",false]";          TString expected3 = expected2 + "}"; @@ -41,7 +41,7 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) {          UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected3);      } -    Y_UNIT_TEST(SimpleWriteValueTest) {  +    Y_UNIT_TEST(SimpleWriteValueTest) {          TString expected = "{\"key1\":null,\"key2\":{\"subkey1\":[1,{\"subsubkey\":\"test2\"},null,true],\"subkey2\":\"test\"}}";          TJsonValue v;          v["key1"] = JSON_NULL; @@ -55,7 +55,7 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) {          UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected);      } -    Y_UNIT_TEST(FormatOutput) {  +    Y_UNIT_TEST(FormatOutput) {          TString expected = "{\n  \"key1\":null,\n  \"key2\":\n    {\n      \"subkey1\":\n        [\n          1,\n          {\n            \"subsubkey\":\"test2\"\n          },\n          null,\n          true\n        ],\n      \"subkey2\":\"test\"\n    }\n}";          TJsonValue v;          v["key1"] = JSON_NULL; @@ -69,7 +69,7 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) {          UNIT_ASSERT_STRINGS_EQUAL(out.Str(), expected);      } -    Y_UNIT_TEST(SortKeys) {  +    Y_UNIT_TEST(SortKeys) {          TString expected = "{\"a\":null,\"j\":null,\"n\":null,\"y\":null,\"z\":null}";          TJsonValue v;          v["z"] = JSON_NULL; @@ -82,7 +82,7 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) {          UNIT_ASSERT_STRINGS_EQUAL(out.Str(), expected);      } -    Y_UNIT_TEST(SimpleUnsignedIntegerWriteTest) {  +    Y_UNIT_TEST(SimpleUnsignedIntegerWriteTest) {          {              TString expected = "{\"test\":1}";              TJsonValue v; @@ -122,7 +122,7 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) {          } // 18446744073709551615      }     // SimpleUnsignedIntegerWriteTest -    Y_UNIT_TEST(WriteOptionalTest) {  +    Y_UNIT_TEST(WriteOptionalTest) {          {              TString expected = "{\"test\":1}"; @@ -180,7 +180,7 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) {          }      } -    Y_UNIT_TEST(Callback) {  +    Y_UNIT_TEST(Callback) {          NJsonWriter::TBuf json;          json.WriteString("A");          UNIT_ASSERT_VALUES_EQUAL(json.Str(), "\"A\""); @@ -188,7 +188,7 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) {          UNIT_ASSERT_VALUES_EQUAL(WrapJsonToCallback(json, "Foo"), "Foo(\"A\")");      } -    Y_UNIT_TEST(FloatPrecision) {  +    Y_UNIT_TEST(FloatPrecision) {          const double value = 1517933989.4242;          const NJson::TJsonValue json(value);          NJson::TJsonWriterConfig config; diff --git a/library/cpp/json/ut/ya.make b/library/cpp/json/ut/ya.make index edc8f0f3f6e..8e0362d84b2 100644 --- a/library/cpp/json/ut/ya.make +++ b/library/cpp/json/ut/ya.make @@ -1,5 +1,5 @@ -OWNER(velavokr)  -  +OWNER(velavokr) +  UNITTEST_FOR(library/cpp/json)  PEERDIR( diff --git a/library/cpp/json/writer/json.h b/library/cpp/json/writer/json.h index 94a19536305..0aae2531b94 100644 --- a/library/cpp/json/writer/json.h +++ b/library/cpp/json/writer/json.h @@ -41,7 +41,7 @@ namespace NJsonWriter {      class TBuf : TNonCopyable {      public: -        TBuf(EHtmlEscapeMode mode = HEM_DONT_ESCAPE_HTML, IOutputStream* stream = nullptr);  +        TBuf(EHtmlEscapeMode mode = HEM_DONT_ESCAPE_HTML, IOutputStream* stream = nullptr);          TValueContext WriteString(const TStringBuf& s, EHtmlEscapeMode hem);          TValueContext WriteString(const TStringBuf& s); @@ -93,7 +93,7 @@ namespace NJsonWriter {          /*** Dump and forget the string constructed so far.             * You may only call it if the `stream' parameter was NULL             * at construction time.                                        */ -        void FlushTo(IOutputStream* stream);  +        void FlushTo(IOutputStream* stream);          /*** Write a literal string that represents a JSON value             * (string, number, object, array, bool, or null). @@ -145,7 +145,7 @@ namespace NJsonWriter {          TValueContext WriteFloatImpl(TFloat f, EFloatToStringMode mode, int ndigits);      private: -        IOutputStream* Stream;  +        IOutputStream* Stream;          THolder<TStringStream> StringStream;          typedef TVector<const TString*> TKeys;          TKeys Keys; diff --git a/library/cpp/json/writer/json_ut.cpp b/library/cpp/json/writer/json_ut.cpp index c2b2ccb95c9..9980555683f 100644 --- a/library/cpp/json/writer/json_ut.cpp +++ b/library/cpp/json/writer/json_ut.cpp @@ -6,8 +6,8 @@  #include <limits> -Y_UNIT_TEST_SUITE(JsonWriter) {  -    Y_UNIT_TEST(Struct) {  +Y_UNIT_TEST_SUITE(JsonWriter) { +    Y_UNIT_TEST(Struct) {          NJsonWriter::TBuf w;          w.BeginList();          w.BeginObject() @@ -29,21 +29,21 @@ Y_UNIT_TEST_SUITE(JsonWriter) {          const char* exp = "[{\"key\":\"value\",\"xk\":13,\"key2\":[{},{}]},43,\"x\",\"...\"]";          UNIT_ASSERT_EQUAL(w.Str(), exp);      } -    Y_UNIT_TEST(EscapedString) {  +    Y_UNIT_TEST(EscapedString) {          NJsonWriter::TBuf w(NJsonWriter::HEM_ESCAPE_HTML);          w.WriteString(" \n \r \t \007 \b \f ' <tag> &ent; \"txt\" ");          TString ws = w.Str();          const char* exp = "\" \\n \\r \\t \\u0007 \\b \\f ' <tag> &ent; "txt" \"";          UNIT_ASSERT_STRINGS_EQUAL(ws.c_str(), exp);      } -    Y_UNIT_TEST(UnescapedString) {  +    Y_UNIT_TEST(UnescapedString) {          NJsonWriter::TBuf w;          w.WriteString(" \n \r \t \b \f '; -- <tag> &ent; \"txt\"", NJsonWriter::HEM_DONT_ESCAPE_HTML);          TString ws = w.Str();          const char* exp = "\" \\n \\r \\t \\b \\f \\u0027; -- \\u003Ctag\\u003E &ent; \\\"txt\\\"\"";          UNIT_ASSERT_STRINGS_EQUAL(ws.c_str(), exp);      } -    Y_UNIT_TEST(UnescapedChaining) {  +    Y_UNIT_TEST(UnescapedChaining) {          NJsonWriter::TBuf w(NJsonWriter::HEM_DONT_ESCAPE_HTML);          w.UnsafeWriteRawBytes("(", 1);          w.BeginList().WriteString("<>&'\\").BeginList(); @@ -52,27 +52,27 @@ Y_UNIT_TEST_SUITE(JsonWriter) {          const char* exp = "([\"\\u003C\\u003E&\\u0027\\\\\",[]]";          UNIT_ASSERT_STRINGS_EQUAL(ws.c_str(), exp);      } -    Y_UNIT_TEST(Utf8) {  +    Y_UNIT_TEST(Utf8) {          TString ws = NJsonWriter::TBuf().WriteString("яЯ σΣ ש א").Str();          const char* exp = "\"яЯ σΣ ש א\"";          UNIT_ASSERT_STRINGS_EQUAL(ws.c_str(), exp);      } -    Y_UNIT_TEST(WrongObject) {  +    Y_UNIT_TEST(WrongObject) {          NJsonWriter::TBuf w;          w.BeginObject();          UNIT_ASSERT_EXCEPTION(w.WriteString("hehe"), NJsonWriter::TError);      } -    Y_UNIT_TEST(WrongList) {  +    Y_UNIT_TEST(WrongList) {          NJsonWriter::TBuf w;          w.BeginList();          UNIT_ASSERT_EXCEPTION(w.WriteKey("hehe"), NJsonWriter::TError);      } -    Y_UNIT_TEST(Incomplete) {  +    Y_UNIT_TEST(Incomplete) {          NJsonWriter::TBuf w;          w.BeginList();          UNIT_ASSERT_EXCEPTION(w.Str(), NJsonWriter::TError);      } -    Y_UNIT_TEST(BareKey) {  +    Y_UNIT_TEST(BareKey) {          NJsonWriter::TBuf w;          w.BeginObject()              .CompatWriteKeyWithoutQuotes("p") @@ -84,24 +84,24 @@ Y_UNIT_TEST_SUITE(JsonWriter) {          const char* exp = "{p:1,n:0}";          UNIT_ASSERT_STRINGS_EQUAL(ws.c_str(), exp);      } -    Y_UNIT_TEST(UnescapedStringInObject) {  +    Y_UNIT_TEST(UnescapedStringInObject) {          NJsonWriter::TBuf w(NJsonWriter::HEM_DONT_ESCAPE_HTML);          w.BeginObject().WriteKey("key").WriteString("</&>'").EndObject();          TString ws = w.Str();          const char* exp = "{\"key\":\"\\u003C\\/&\\u003E\\u0027\"}";          UNIT_ASSERT_STRINGS_EQUAL(ws.c_str(), exp);      } -    Y_UNIT_TEST(ForeignStreamStr) {  +    Y_UNIT_TEST(ForeignStreamStr) {          NJsonWriter::TBuf w(NJsonWriter::HEM_DONT_ESCAPE_HTML, &Cerr);          UNIT_ASSERT_EXCEPTION(w.Str(), NJsonWriter::TError);      } -    Y_UNIT_TEST(ForeignStreamValue) {  +    Y_UNIT_TEST(ForeignStreamValue) {          TStringStream ss;          NJsonWriter::TBuf w(NJsonWriter::HEM_DONT_ESCAPE_HTML, &ss);          w.WriteInt(1543);          UNIT_ASSERT_STRINGS_EQUAL(ss.Str(), "1543");      } -    Y_UNIT_TEST(Indentation) {  +    Y_UNIT_TEST(Indentation) {          NJsonWriter::TBuf w(NJsonWriter::HEM_DONT_ESCAPE_HTML);          w.SetIndentSpaces(2);          w.BeginList() @@ -124,7 +124,7 @@ Y_UNIT_TEST_SUITE(JsonWriter) {                            "]";          UNIT_ASSERT_STRINGS_EQUAL(exp, w.Str());      } -    Y_UNIT_TEST(WriteJsonValue) {  +    Y_UNIT_TEST(WriteJsonValue) {          using namespace NJson;          TJsonValue val;          val.AppendValue(1); @@ -142,7 +142,7 @@ Y_UNIT_TEST_SUITE(JsonWriter) {          const char exp[] = "[1,\"2\",3.5,{\"key\":\"value\"},null]";          UNIT_ASSERT_STRINGS_EQUAL(exp, w.Str());      } -    Y_UNIT_TEST(WriteJsonValueSorted) {  +    Y_UNIT_TEST(WriteJsonValueSorted) {          using namespace NJson;          TJsonValue val;          val.InsertValue("1", TJsonValue(1)); @@ -159,35 +159,35 @@ Y_UNIT_TEST_SUITE(JsonWriter) {          const char exp[] = "{\"0\":{\"succ\":1,\"zero\":0},\"1\":1,\"2\":2}";          UNIT_ASSERT_STRINGS_EQUAL(exp, w.Str());      } -    Y_UNIT_TEST(Unescaped) {  +    Y_UNIT_TEST(Unescaped) {          NJsonWriter::TBuf buf(NJsonWriter::HEM_UNSAFE);          buf.WriteString("</security>'");          UNIT_ASSERT_STRINGS_EQUAL("\"</security>'\"", buf.Str());      } -    Y_UNIT_TEST(LittleBobbyJsonp) {  +    Y_UNIT_TEST(LittleBobbyJsonp) {          NJsonWriter::TBuf buf;          buf.WriteString("hello\xe2\x80\xa8\xe2\x80\xa9stranger");          UNIT_ASSERT_STRINGS_EQUAL("\"hello\\u2028\\u2029stranger\"", buf.Str());      } -    Y_UNIT_TEST(LittleBobbyInvalid) {  +    Y_UNIT_TEST(LittleBobbyInvalid) {          NJsonWriter::TBuf buf;          TStringBuf incomplete("\xe2\x80\xa8", 2);          buf.WriteString(incomplete);          // garbage in - garbage out          UNIT_ASSERT_STRINGS_EQUAL("\"\xe2\x80\"", buf.Str());      } -    Y_UNIT_TEST(OverlyZealous) {  +    Y_UNIT_TEST(OverlyZealous) {          NJsonWriter::TBuf buf;          buf.WriteString("—");          UNIT_ASSERT_STRINGS_EQUAL("\"—\"", buf.Str());      } -    Y_UNIT_TEST(RelaxedEscaping) {  +    Y_UNIT_TEST(RelaxedEscaping) {          NJsonWriter::TBuf buf(NJsonWriter::HEM_RELAXED);          buf.WriteString("</>");          UNIT_ASSERT_STRINGS_EQUAL("\"\\u003C/\\u003E\"", buf.Str());      } -    Y_UNIT_TEST(FloatFormatting) {  +    Y_UNIT_TEST(FloatFormatting) {          NJsonWriter::TBuf buf(NJsonWriter::HEM_DONT_ESCAPE_HTML);          buf.BeginList()              .WriteFloat(0.12345678987654321f) @@ -206,7 +206,7 @@ Y_UNIT_TEST_SUITE(JsonWriter) {          UNIT_ASSERT_STRINGS_EQUAL(exp, buf.Str());      } -    Y_UNIT_TEST(NanFormatting) {  +    Y_UNIT_TEST(NanFormatting) {          {              NJsonWriter::TBuf buf;              buf.BeginObject(); diff --git a/library/cpp/json/writer/json_value.cpp b/library/cpp/json/writer/json_value.cpp index 27da313fd4c..c61e8d1dc43 100644 --- a/library/cpp/json/writer/json_value.cpp +++ b/library/cpp/json/writer/json_value.cpp @@ -18,7 +18,7 @@ static bool  AreJsonMapsEqual(const NJson::TJsonValue& lhs, const NJson::TJsonValue& rhs) {      using namespace NJson; -    Y_VERIFY(lhs.GetType() == JSON_MAP, "lhs has not a JSON_MAP type.");  +    Y_VERIFY(lhs.GetType() == JSON_MAP, "lhs has not a JSON_MAP type.");      if (rhs.GetType() != JSON_MAP)          return false; @@ -30,12 +30,12 @@ AreJsonMapsEqual(const NJson::TJsonValue& lhs, const NJson::TJsonValue& rhs) {      if (lhsMap.size() != rhsMap.size())          return false; -    for (const auto& lhsIt : lhsMap) {  +    for (const auto& lhsIt : lhsMap) {          TMapType::const_iterator rhsIt = rhsMap.find(lhsIt.first);          if (rhsIt == rhsMap.end())              return false; -        if (lhsIt.second != rhsIt->second)  +        if (lhsIt.second != rhsIt->second)              return false;      } @@ -46,7 +46,7 @@ static bool  AreJsonArraysEqual(const NJson::TJsonValue& lhs, const NJson::TJsonValue& rhs) {      using namespace NJson; -    Y_VERIFY(lhs.GetType() == JSON_ARRAY, "lhs has not a JSON_ARRAY type.");  +    Y_VERIFY(lhs.GetType() == JSON_ARRAY, "lhs has not a JSON_ARRAY type.");      if (rhs.GetType() != JSON_ARRAY)          return false; @@ -1099,7 +1099,7 @@ namespace NJson {  }  template <> -void Out<NJson::TJsonValue>(IOutputStream& out, const NJson::TJsonValue& v) {  +void Out<NJson::TJsonValue>(IOutputStream& out, const NJson::TJsonValue& v) {      NJsonWriter::TBuf buf(NJsonWriter::HEM_DONT_ESCAPE_HTML, &out);      buf.WriteJsonValue(&v);  } diff --git a/library/cpp/json/writer/json_value_ut.cpp b/library/cpp/json/writer/json_value_ut.cpp index ea33ef08882..dc7f6affdff 100644 --- a/library/cpp/json/writer/json_value_ut.cpp +++ b/library/cpp/json/writer/json_value_ut.cpp @@ -6,8 +6,8 @@  using namespace NJson; -Y_UNIT_TEST_SUITE(TJsonValueTest) {  -    Y_UNIT_TEST(UndefTest) {  +Y_UNIT_TEST_SUITE(TJsonValueTest) { +    Y_UNIT_TEST(UndefTest) {          TJsonValue undef;          TJsonValue null(JSON_NULL);          TJsonValue _false(false); @@ -36,7 +36,7 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) {          UNIT_ASSERT(undef != emptyMap);      } -    Y_UNIT_TEST(DefaultCompareTest) {  +    Y_UNIT_TEST(DefaultCompareTest) {          {              TJsonValue lhs;              TJsonValue rhs; @@ -52,14 +52,14 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) {          }      } -    Y_UNIT_TEST(NullCompareTest) {  +    Y_UNIT_TEST(NullCompareTest) {          TJsonValue lhs(JSON_NULL);          TJsonValue rhs(JSON_NULL);          UNIT_ASSERT(lhs == rhs);          UNIT_ASSERT(rhs == lhs);      } -    Y_UNIT_TEST(StringCompareTest) {  +    Y_UNIT_TEST(StringCompareTest) {          {              TJsonValue lhs(JSON_STRING);              TJsonValue rhs(JSON_STRING); @@ -89,7 +89,7 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) {          }      } -    Y_UNIT_TEST(ArrayCompareTest) {  +    Y_UNIT_TEST(ArrayCompareTest) {          {              TJsonValue lhs(JSON_ARRAY);              TJsonValue rhs(JSON_ARRAY); @@ -139,7 +139,7 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) {          }      } -    Y_UNIT_TEST(CompareTest) {  +    Y_UNIT_TEST(CompareTest) {          {              TJsonValue lhs;              lhs.InsertValue("null value", TJsonValue(JSON_NULL)); @@ -209,7 +209,7 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) {          }      } -    Y_UNIT_TEST(SwapTest) {  +    Y_UNIT_TEST(SwapTest) {          {              TJsonValue lhs;              lhs.InsertValue("a", "b"); @@ -233,7 +233,7 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) {          }      } -    Y_UNIT_TEST(GetValueByPathTest) {  +    Y_UNIT_TEST(GetValueByPathTest) {          {              TJsonValue lhs;              TJsonValue first; @@ -285,7 +285,7 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) {          }      } -    Y_UNIT_TEST(GetValueByPathConstTest) {  +    Y_UNIT_TEST(GetValueByPathConstTest) {          TJsonValue lhs;          TJsonValue first;          TJsonValue second; @@ -339,7 +339,7 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) {          UNIT_ASSERT(third.GetValueByPath("t.[1].c.e", '.')->GetStringRobust() == "f");      } -    Y_UNIT_TEST(EraseValueFromArray) {  +    Y_UNIT_TEST(EraseValueFromArray) {          {              TJsonValue vec;              vec.AppendValue(TJsonValue(0)); @@ -378,7 +378,7 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) {          }      } -    Y_UNIT_TEST(NonConstMethodsTest) {  +    Y_UNIT_TEST(NonConstMethodsTest) {          {              TJsonValue src;              TJsonValue value1; @@ -506,7 +506,7 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) {          }      } -    Y_UNIT_TEST(NonexistentFieldAccessTest) {  +    Y_UNIT_TEST(NonexistentFieldAccessTest) {          {              TJsonValue json;              json.InsertValue("some", "key"); @@ -518,7 +518,7 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) {          }      } -    Y_UNIT_TEST(DefaultValuesTest) {  +    Y_UNIT_TEST(DefaultValuesTest) {          {              TJsonValue json;              json.InsertValue("some", "key"); @@ -540,7 +540,7 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) {          }      } -    Y_UNIT_TEST(GetArrayPointerInArrayTest) {  +    Y_UNIT_TEST(GetArrayPointerInArrayTest) {          TJsonValue outer;          {              TJsonValue json; @@ -555,7 +555,7 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) {          UNIT_ASSERT_VALUES_EQUAL((*array)[1], 2);      } -    Y_UNIT_TEST(GetArrayPointerInMapTest) {  +    Y_UNIT_TEST(GetArrayPointerInMapTest) {          TJsonValue outer;          {              TJsonValue json; @@ -570,7 +570,7 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) {          UNIT_ASSERT_VALUES_EQUAL((*array)[1], 2);      } -    Y_UNIT_TEST(GetMapPointerInArrayTest) {  +    Y_UNIT_TEST(GetMapPointerInArrayTest) {          TJsonValue outer;          {              TJsonValue json; @@ -585,7 +585,7 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) {          UNIT_ASSERT_VALUES_EQUAL((*map).at("b"), 2);      } -    Y_UNIT_TEST(GetMapPointerInMapTest) {  +    Y_UNIT_TEST(GetMapPointerInMapTest) {          TJsonValue outer;          {              TJsonValue json; @@ -600,14 +600,14 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) {          UNIT_ASSERT_VALUES_EQUAL((*map).at("b"), 2);      } -    Y_UNIT_TEST(GetIntegerRobustBignumStringTest) {  +    Y_UNIT_TEST(GetIntegerRobustBignumStringTest) {          TString value = "1626862681464633683";          TJsonValue json(value);          UNIT_ASSERT_VALUES_EQUAL(json.GetUIntegerRobust(), FromString<ui64>(value));          UNIT_ASSERT_VALUES_EQUAL(json.GetIntegerRobust(), FromString<i64>(value));      } -    Y_UNIT_TEST(MoveSubpartToSelf) {  +    Y_UNIT_TEST(MoveSubpartToSelf) {          TJsonValue json;          json[0] = "testing 0";          json[1] = "testing 1"; diff --git a/library/cpp/json/yson/json2yson_ut.cpp b/library/cpp/json/yson/json2yson_ut.cpp index a486b625c2e..9eb23354cf0 100644 --- a/library/cpp/json/yson/json2yson_ut.cpp +++ b/library/cpp/json/yson/json2yson_ut.cpp @@ -23,7 +23,7 @@ static TString GetRequestsWithDecoding(const TString& inputPath, const NBlockCod      return requests;  } -Y_UNIT_TEST_SUITE(Json2Yson) {  +Y_UNIT_TEST_SUITE(Json2Yson) {      Y_UNIT_TEST(NOAPACHE_REQUESTS) {          const ui32 warmUpRetries = 5;          const TVector<double> percentiles = {0.25, 0.5, 0.6, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 0.97, 0.99, 1.0}; | 
