diff options
author | csharptest <roger@csharptest.net> | 2011-09-15 18:16:15 -0500 |
---|---|---|
committer | rogerk <devnull@localhost> | 2011-09-15 18:16:15 -0500 |
commit | 2a1f0bd44078abb6271091657cde9a1d7dba99e0 (patch) | |
tree | 16684fdac75a888ad80b2bfa16fc0ce871a65496 /src/ProtocolBuffers.Test/ReusableBuilderTest.cs | |
parent | 7b6044f88865ae035f75acf742748df74181483d (diff) | |
download | protobuf-2a1f0bd44078abb6271091657cde9a1d7dba99e0.tar.gz protobuf-2a1f0bd44078abb6271091657cde9a1d7dba99e0.tar.bz2 protobuf-2a1f0bd44078abb6271091657cde9a1d7dba99e0.zip |
Added a few more tests to ensure XxxxList { get; } clones readonly builder
Diffstat (limited to 'src/ProtocolBuffers.Test/ReusableBuilderTest.cs')
-rw-r--r-- | src/ProtocolBuffers.Test/ReusableBuilderTest.cs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/ProtocolBuffers.Test/ReusableBuilderTest.cs b/src/ProtocolBuffers.Test/ReusableBuilderTest.cs index 9a5e3f36..2f81a814 100644 --- a/src/ProtocolBuffers.Test/ReusableBuilderTest.cs +++ b/src/ProtocolBuffers.Test/ReusableBuilderTest.cs @@ -90,6 +90,15 @@ namespace Google.ProtocolBuffers }
[Test]
+ public void CloneOnGetRepeatedBoolList()
+ {
+ TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
+ Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
+ GC.KeepAlive(builder.RepeatedBoolList);
+ Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
+ }
+
+ [Test]
public void CloneOnChangeMessage()
{
TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
@@ -108,11 +117,11 @@ namespace Google.ProtocolBuffers }
[Test]
- public void CloneOnAddRepeatedForeignMessage()
+ public void CloneOnGetRepeatedForeignMessageList()
{
TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
- builder.AddRepeatedForeignMessage(ForeignMessage.DefaultInstance);
+ GC.KeepAlive(builder.RepeatedForeignMessageList);
Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
}
@@ -126,11 +135,11 @@ namespace Google.ProtocolBuffers }
[Test]
- public void CloneOnAddRepeatedForeignEnum()
+ public void CloneOnGetRepeatedForeignEnumList()
{
TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
- builder.AddRepeatedForeignEnum(ForeignEnum.FOREIGN_BAR);
+ GC.KeepAlive(builder.RepeatedForeignEnumList);
Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
}
|