diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:12:36 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:12:36 +0000 |
commit | ef5d0b5e97ec8e6fa395d377b09aa7755e345b4f (patch) | |
tree | 27916256fdeeb57d10d2f3d6948be5d71a703215 /unittests/Utility/JSONTest.cpp | |
parent | 76e0736e7fcfeb179779e49c05604464b1ccd704 (diff) |
Notes
Diffstat (limited to 'unittests/Utility/JSONTest.cpp')
-rw-r--r-- | unittests/Utility/JSONTest.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/unittests/Utility/JSONTest.cpp b/unittests/Utility/JSONTest.cpp new file mode 100644 index 0000000000000..0c23350517ce6 --- /dev/null +++ b/unittests/Utility/JSONTest.cpp @@ -0,0 +1,26 @@ +#include "gtest/gtest.h" + +#include "lldb/Utility/JSON.h" +#include "lldb/Utility/StreamString.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"})"); +} |