| Index: third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestBadIdentifiers.java
|
| diff --git a/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestCornerCases.cs b/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestBadIdentifiers.java
|
| similarity index 55%
|
| copy from third_party/protobuf/csharp/src/Google.Protobuf.Test/TestCornerCases.cs
|
| copy to third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestBadIdentifiers.java
|
| index fd75b19f42ed9de79a1d373a12038dcf0a103fef..50867322958a1fdee80ae45b90fb5550b6757b42 100644
|
| --- a/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestCornerCases.cs
|
| +++ b/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestBadIdentifiers.java
|
| @@ -1,7 +1,6 @@
|
| -#region Copyright notice and license
|
| // Protocol Buffers - Google's data interchange format
|
| // Copyright 2008 Google Inc. All rights reserved.
|
| -// https://developers.google.com/protocol-buffers/
|
| +// http://code.google.com/p/protobuf/
|
| //
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| @@ -28,35 +27,38 @@
|
| // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| -#endregion
|
| -
|
| -using UnitTest.Issues.TestProtos;
|
| -using NUnit.Framework;
|
|
|
| -namespace Google.Protobuf
|
| -{
|
| - public class TestCornerCases
|
| - {
|
| - [Test]
|
| - public void TestRoundTripNegativeEnums()
|
| - {
|
| - NegativeEnumMessage msg = new NegativeEnumMessage
|
| - {
|
| - Value = NegativeEnum.MinusOne,
|
| - Values = { NegativeEnum.Zero, NegativeEnum.MinusOne, NegativeEnum.FiveBelow },
|
| - PackedValues = { NegativeEnum.Zero, NegativeEnum.MinusOne, NegativeEnum.FiveBelow }
|
| - };
|
| +package com.google.protobuf.test;
|
| +import com.google.protobuf.*;
|
|
|
| - Assert.AreEqual(58, msg.CalculateSize());
|
| +import junit.framework.TestCase;
|
|
|
| - byte[] bytes = new byte[58];
|
| - CodedOutputStream output = new CodedOutputStream(bytes);
|
| +/**
|
| + * Tests that proto2 api generation doesn't cause compile errors when
|
| + * compiling protocol buffers that have names that would otherwise conflict
|
| + * if not fully qualified (like @Deprecated and @Override).
|
| + *
|
| + * @author jonp@google.com (Jon Perlow)
|
| + */
|
| +public class TestBadIdentifiers extends TestCase {
|
|
|
| - msg.WriteTo(output);
|
| - Assert.AreEqual(0, output.SpaceLeft);
|
| + public void testCompilation() {
|
| + // If this compiles, it means the generation was correct.
|
| + TestBadIdentifiersProto.Deprecated.newBuilder();
|
| + TestBadIdentifiersProto.Override.newBuilder();
|
| + }
|
|
|
| - NegativeEnumMessage copy = NegativeEnumMessage.Parser.ParseFrom(bytes);
|
| - Assert.AreEqual(msg, copy);
|
| - }
|
| - }
|
| + public void testGetDescriptor() {
|
| + Descriptors.FileDescriptor fileDescriptor =
|
| + TestBadIdentifiersProto.getDescriptor();
|
| + String descriptorField = TestBadIdentifiersProto.Descriptor
|
| + .getDefaultInstance().getDescriptor();
|
| + Descriptors.Descriptor protoDescriptor = TestBadIdentifiersProto.Descriptor
|
| + .getDefaultInstance().getDescriptorForType();
|
| + String nestedDescriptorField = TestBadIdentifiersProto.Descriptor
|
| + .NestedDescriptor.getDefaultInstance().getDescriptor();
|
| + Descriptors.Descriptor nestedProtoDescriptor = TestBadIdentifiersProto
|
| + .Descriptor.NestedDescriptor.getDefaultInstance()
|
| + .getDescriptorForType();
|
| + }
|
| }
|
|
|