diff options
author | 2017-09-12 10:32:01 -0700 | |
---|---|---|
committer | 2017-09-14 10:03:57 -0700 | |
commit | 13fd045dbb2b4dacea32be162a41d5a4b0d1802f (patch) | |
tree | c219e7eb18b82523e36c6748861c403a14ea66ae /src/google/protobuf/lite_unittest.cc | |
parent | d1bc27caef8377a710370189675cb0958443e8f1 (diff) |
Integrated internal changes from Google
Diffstat (limited to 'src/google/protobuf/lite_unittest.cc')
-rw-r--r-- | src/google/protobuf/lite_unittest.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/google/protobuf/lite_unittest.cc b/src/google/protobuf/lite_unittest.cc index 6cf16629..d6693963 100644 --- a/src/google/protobuf/lite_unittest.cc +++ b/src/google/protobuf/lite_unittest.cc @@ -988,3 +988,18 @@ TEST(Lite, AllLite44) { std::cout << "PASS" << std::endl; } + +TEST(Lite, AllLite45) { + // Test unknown fields are not discarded upon parsing. + string data = "\20\1"; // varint 1 with field number 2 + + protobuf_unittest::ForeignMessageLite a; + EXPECT_TRUE(a.ParseFromString(data)); + google::protobuf::io::CodedInputStream input_stream( + reinterpret_cast<const ::google::protobuf::uint8*>(data.data()), data.size()); + EXPECT_TRUE(a.MergePartialFromCodedStream(&input_stream)); + + string serialized = a.SerializeAsString(); + EXPECT_EQ(serialized.substr(0, 2), data); + EXPECT_EQ(serialized.substr(2), data); +} |