blob: d75770b24d5e6d9948b621c6c7199f33470430ff [file] [log] [blame]
#include "gtest/gtest.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Utility/JSON.h"
using namespace lldb_private;
TEST(JSONTest, Dictionary) {
JSONObject o;
o.SetObject("key", std::make_shared<JSONString>("value"));
StreamString stream;
o.Write(stream);
ASSERT_EQ(stream.GetString(), R"({"key":"value"})");
}
TEST(JSONTest, Newlines) {
JSONObject o;
o.SetObject("key", std::make_shared<JSONString>("hello\nworld"));
StreamString stream;
o.Write(stream);
ASSERT_EQ(stream.GetString(), R"({"key":"hello\nworld"})");
}