diff options
author | Max Cai <maxtroy@google.com> | 2013-09-24 17:40:37 +0100 |
---|---|---|
committer | Max Cai <maxtroy@google.com> | 2013-09-25 19:44:27 +0100 |
commit | 1479c7ab1b72346df56b95816a58234ba2ceb9cd (patch) | |
tree | 35f29c2fab71ccb576c1226644ce7f64914beb6b /java/src | |
parent | b337f25628ceb3649df5c4e89b5125e7698a9b47 (diff) | |
download | protobuf-1479c7ab1b72346df56b95816a58234ba2ceb9cd.tar.gz protobuf-1479c7ab1b72346df56b95816a58234ba2ceb9cd.tar.bz2 protobuf-1479c7ab1b72346df56b95816a58234ba2ceb9cd.zip |
Implement enum_style=java option.
This javanano_out command line option creates a container interface
at the normal place where the enum constants would reside, per enum
definition. The java_multiple_files flag would now affect the file-
scope enums with the shells. If the flag is true then file-scope
container interfaces are created in their own files.
Change-Id: Id52258fcff8d3dee9db8f3d8022147a811bf3565
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/test/java/com/google/protobuf/NanoTest.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/java/src/test/java/com/google/protobuf/NanoTest.java b/java/src/test/java/com/google/protobuf/NanoTest.java index fb6cccb2..84836195 100644 --- a/java/src/test/java/com/google/protobuf/NanoTest.java +++ b/java/src/test/java/com/google/protobuf/NanoTest.java @@ -31,8 +31,11 @@ package com.google.protobuf; import com.google.protobuf.nano.CodedInputByteBufferNano; +import com.google.protobuf.nano.EnumClassNanoMultiple; +import com.google.protobuf.nano.EnumClassNanos; import com.google.protobuf.nano.Extensions; import com.google.protobuf.nano.Extensions.AnotherMessage; +import com.google.protobuf.nano.FileScopeEnumMultiple; import com.google.protobuf.nano.FileScopeEnumRefNano; import com.google.protobuf.nano.InternalNano; import com.google.protobuf.nano.MessageNano; @@ -2391,6 +2394,16 @@ public class NanoTest extends TestCase { assertEquals(0, newMsg.id); } + public void testNanoJavaEnumStyle() throws Exception { + EnumClassNanos.EnumClassNano msg = new EnumClassNanos.EnumClassNano(); + assertEquals(EnumClassNanos.FileScopeEnum.ONE, msg.one); + assertEquals(EnumClassNanos.EnumClassNano.MessageScopeEnum.TWO, msg.two); + + EnumClassNanoMultiple msg2 = new EnumClassNanoMultiple(); + assertEquals(FileScopeEnumMultiple.THREE, msg2.three); + assertEquals(EnumClassNanoMultiple.MessageScopeEnumMultiple.FOUR, msg2.four); + } + /** * Tests that fields with a default value of NaN are not serialized when * set to NaN. This is a special case as NaN != NaN, so normal equality |