| 8 | |
| 9 | Y_UNIT_TEST_SUITE(JsonWriter) { |
| 10 | Y_UNIT_TEST(Struct) { |
| 11 | NJsonWriter::TBuf w; |
| 12 | w.BeginList(); |
| 13 | w.BeginObject() |
| 14 | .WriteKey("key") |
| 15 | .WriteString("value") |
| 16 | .UnsafeWritePair("\"xk\":13") |
| 17 | .WriteKey("key2") |
| 18 | .BeginList() |
| 19 | .BeginObject() |
| 20 | .EndObject() |
| 21 | .BeginObject() |
| 22 | .EndObject() |
| 23 | .EndList() |
| 24 | .EndObject(); |
| 25 | w.WriteInt(43); |
| 26 | w.UnsafeWriteValue("\"x\""); |
| 27 | w.WriteString("..."); |
| 28 | w.EndList(); |
| 29 | const char* exp = "[{\"key\":\"value\",\"xk\":13,\"key2\":[{},{}]},43,\"x\",\"...\"]"; |
| 30 | UNIT_ASSERT_EQUAL(w.Str(), exp); |
| 31 | } |
| 32 | Y_UNIT_TEST(EscapedString) { |
| 33 | NJsonWriter::TBuf w(NJsonWriter::HEM_ESCAPE_HTML); |
| 34 | w.WriteString(" \n \r \t \007 \b \f ' <tag> &ent; \"txt\" "); |
nothing calls this directly
no test coverage detected