2017-08-23 02:36:12 +08:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
|
|
|
#include "lldb/Utility/JSON.h"
|
2017-08-23 03:09:39 +08:00
|
|
|
#include "lldb/Utility/StreamString.h"
|
2017-08-23 02:36:12 +08:00
|
|
|
|
|
|
|
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"})");
|
|
|
|
}
|