|
|
@ -47,6 +47,7 @@ namespace { |
|
|
|
using proto3::FOO; |
|
|
|
using proto3::FOO; |
|
|
|
using proto3::BAR; |
|
|
|
using proto3::BAR; |
|
|
|
using proto3::TestMessage; |
|
|
|
using proto3::TestMessage; |
|
|
|
|
|
|
|
using proto3::TestMap; |
|
|
|
|
|
|
|
|
|
|
|
static const char kTypeUrlPrefix[] = "type.googleapis.com"; |
|
|
|
static const char kTypeUrlPrefix[] = "type.googleapis.com"; |
|
|
|
|
|
|
|
|
|
|
@ -147,6 +148,16 @@ TEST_F(JsonUtilTest, ParseMessage) { |
|
|
|
EXPECT_EQ(96, m.repeated_message_value(1).value()); |
|
|
|
EXPECT_EQ(96, m.repeated_message_value(1).value()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(JsonUtilTest, ParseMap) { |
|
|
|
|
|
|
|
TestMap message; |
|
|
|
|
|
|
|
(*message.mutable_string_map())["hello"] = 1234; |
|
|
|
|
|
|
|
JsonOptions options; |
|
|
|
|
|
|
|
EXPECT_EQ("{\"stringMap\":{\"hello\":1234}}", ToJson(message, options)); |
|
|
|
|
|
|
|
TestMap other; |
|
|
|
|
|
|
|
ASSERT_TRUE(FromJson(ToJson(message, options), &other)); |
|
|
|
|
|
|
|
EXPECT_EQ(message.DebugString(), other.DebugString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
typedef pair<char*, int> Segment; |
|
|
|
typedef pair<char*, int> Segment; |
|
|
|
// A ZeroCopyOutputStream that writes to multiple buffers.
|
|
|
|
// A ZeroCopyOutputStream that writes to multiple buffers.
|
|
|
|
class SegmentedZeroCopyOutputStream : public io::ZeroCopyOutputStream { |
|
|
|
class SegmentedZeroCopyOutputStream : public io::ZeroCopyOutputStream { |
|
|
|