diff options
author | Jon Skeet <jonskeet@google.com> | 2015-08-08 07:24:28 +0100 |
---|---|---|
committer | Jon Skeet <jonskeet@google.com> | 2015-08-08 07:24:28 +0100 |
commit | 6e16037c9933e175f62feb445ff8bd22d7727285 (patch) | |
tree | 0216a5c47c8844051002464cdbf5bd9f9cafefc7 /csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs | |
parent | 5bdc57292f2a21706ff1dab21652fb8e1f058eb7 (diff) | |
download | protobuf-6e16037c9933e175f62feb445ff8bd22d7727285.tar.gz protobuf-6e16037c9933e175f62feb445ff8bd22d7727285.tar.bz2 protobuf-6e16037c9933e175f62feb445ff8bd22d7727285.zip |
Address review comments.
Diffstat (limited to 'csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs')
-rw-r--r-- | csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs b/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs index 6fdd1066..575d4586 100644 --- a/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs +++ b/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs @@ -629,5 +629,27 @@ namespace Google.Protobuf var data = new byte[] { 130, 3, 1 };
Assert.Throws<InvalidProtocolBufferException>(() => TestAllTypes.Parser.ParseFrom(data));
}
+
+ /// <summary>
+ /// Demonstrates current behaviour with an extraneous end group tag - see issue 688
+ /// for details; we may want to change this.
+ /// </summary>
+ [Test]
+ public void ExtraEndGroupSkipped()
+ {
+ var message = SampleMessages.CreateFullTestAllTypes();
+ var stream = new MemoryStream();
+ var output = new CodedOutputStream(stream);
+
+ output.WriteTag(100, WireFormat.WireType.EndGroup);
+ output.WriteTag(TestAllTypes.SingleFixed32FieldNumber, WireFormat.WireType.Fixed32);
+ output.WriteFixed32(123);
+
+ output.Flush();
+
+ stream.Position = 0;
+ var parsed = TestAllTypes.Parser.ParseFrom(stream);
+ Assert.AreEqual(new TestAllTypes { SingleFixed32 = 123 }, parsed);
+ }
}
}
|