protoc 2.6.1.1 → 2.6.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/protoc/Makefile.in +10 -13
- data/ext/protoc/extconf.rb +0 -1
- data/ext/protoc/protobuf/CHANGES.txt +593 -0
- data/ext/protoc/protobuf/CONTRIBUTORS.txt +93 -0
- data/ext/protoc/protobuf/INSTALL.txt +237 -0
- data/ext/protoc/protobuf/LICENSE +33 -0
- data/ext/protoc/protobuf/Makefile.am +267 -0
- data/ext/protoc/protobuf/README.md +167 -0
- data/ext/protoc/protobuf/autogen.sh +41 -0
- data/ext/protoc/protobuf/benchmarks/ProtoBench.java +203 -0
- data/ext/protoc/protobuf/benchmarks/google_message1.dat +0 -0
- data/ext/protoc/protobuf/benchmarks/google_message2.dat +0 -0
- data/ext/protoc/protobuf/benchmarks/google_size.proto +136 -0
- data/ext/protoc/protobuf/benchmarks/google_speed.proto +136 -0
- data/ext/protoc/protobuf/benchmarks/readme.txt +50 -0
- data/ext/protoc/protobuf/configure.ac +159 -0
- data/ext/protoc/protobuf/editors/README.txt +5 -0
- data/ext/protoc/protobuf/editors/proto.vim +105 -0
- data/ext/protoc/protobuf/editors/protobuf-mode.el +220 -0
- data/ext/protoc/protobuf/examples/AddPerson.java +95 -0
- data/ext/protoc/protobuf/examples/ListPeople.java +50 -0
- data/ext/protoc/protobuf/examples/Makefile +58 -0
- data/ext/protoc/protobuf/examples/README.txt +29 -0
- data/ext/protoc/protobuf/examples/add_person.cc +95 -0
- data/ext/protoc/protobuf/examples/add_person.py +58 -0
- data/ext/protoc/protobuf/examples/addressbook.proto +30 -0
- data/ext/protoc/protobuf/examples/list_people.cc +68 -0
- data/ext/protoc/protobuf/examples/list_people.py +38 -0
- data/ext/protoc/protobuf/generate_descriptor_proto.sh +33 -0
- data/ext/protoc/protobuf/java/README.txt +96 -0
- data/ext/protoc/protobuf/java/pom.xml +217 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/AbstractMessage.java +466 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/AbstractMessageLite.java +355 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/AbstractParser.java +253 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/BlockingRpcChannel.java +51 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/BlockingService.java +64 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/BoundedByteString.java +163 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ByteString.java +1022 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/CodedInputStream.java +1311 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/CodedOutputStream.java +1297 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Descriptors.java +2238 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/DynamicMessage.java +622 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Extension.java +96 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ExtensionRegistry.java +392 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ExtensionRegistryLite.java +185 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/FieldSet.java +907 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/GeneratedMessage.java +2213 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/GeneratedMessageLite.java +949 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Internal.java +391 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java +122 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LazyField.java +154 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LazyFieldLite.java +176 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LazyStringArrayList.java +367 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LazyStringList.java +163 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LiteralByteString.java +362 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Message.java +244 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/MessageLite.java +320 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java +60 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/MessageOrBuilder.java +143 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/MessageReflection.java +931 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Parser.java +261 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ProtocolMessageEnum.java +58 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ProtocolStringList.java +48 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java +696 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RopeByteString.java +957 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RpcCallback.java +47 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RpcChannel.java +71 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RpcController.java +118 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RpcUtil.java +134 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Service.java +117 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ServiceException.java +52 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/SingleFieldBuilder.java +241 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/SmallSortedMap.java +618 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/TextFormat.java +1984 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/UninitializedMessageException.java +99 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/UnknownFieldSet.java +995 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java +205 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Utf8.java +349 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/WireFormat.java +163 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/AbstractMessageTest.java +527 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/BoundedByteStringTest.java +68 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/ByteStringTest.java +759 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/CheckUtf8Test.java +141 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/CodedInputStreamTest.java +769 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/CodedOutputStreamTest.java +401 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/DeprecatedFieldTest.java +80 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/DescriptorsTest.java +735 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/DynamicMessageTest.java +326 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java +48 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/GeneratedMessageTest.java +1515 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/IsValidUtf8Test.java +180 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java +421 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyFieldLiteTest.java +134 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyFieldTest.java +121 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyMessageLiteTest.java +319 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyStringArrayListTest.java +174 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java +143 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java +85 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LiteTest.java +148 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LiteralByteStringTest.java +396 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/MessageTest.java +353 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/NestedBuildersTest.java +185 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/ParserTest.java +381 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java +190 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java +97 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/RopeByteStringTest.java +115 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/ServiceTest.java +320 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/SingleFieldBuilderTest.java +155 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/SmallSortedMapTest.java +420 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/TestBadIdentifiers.java +96 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/TestUtil.java +4124 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/TextFormatTest.java +994 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/UnknownFieldSetTest.java +653 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java +227 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/WireFormatTest.java +606 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/lazy_fields_lite.proto +61 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/lite_equals_and_hash.proto +55 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/multiple_files_test.proto +77 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/nested_builders_test.proto +53 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/nested_extension.proto +46 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/nested_extension_lite.proto +48 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/non_nested_extension.proto +49 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/non_nested_extension_lite.proto +50 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/outer_class_name_test.proto +38 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/outer_class_name_test2.proto +42 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/outer_class_name_test3.proto +43 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_bad_identifiers.proto +157 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_check_utf8.proto +50 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_check_utf8_size.proto +51 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_custom_options.proto +43 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_extra_interfaces.proto +60 -0
- data/ext/protoc/protobuf/m4/ac_system_extensions.m4 +37 -0
- data/ext/protoc/protobuf/m4/acx_check_suncc.m4 +75 -0
- data/ext/protoc/protobuf/m4/acx_pthread.m4 +397 -0
- data/ext/protoc/protobuf/m4/stl_hash.m4 +72 -0
- data/ext/protoc/protobuf/more_tests/Makefile +41 -0
- data/ext/protoc/protobuf/post_process_dist.sh +60 -0
- data/ext/protoc/protobuf/protobuf-lite.pc.in +13 -0
- data/ext/protoc/protobuf/protobuf.pc.in +14 -0
- data/ext/protoc/protobuf/python/README.txt +105 -0
- data/ext/protoc/protobuf/python/ez_setup.py +284 -0
- data/ext/protoc/protobuf/python/google/__init__.py +1 -0
- data/ext/protoc/protobuf/python/google/protobuf/__init__.py +0 -0
- data/ext/protoc/protobuf/python/google/protobuf/descriptor.py +849 -0
- data/ext/protoc/protobuf/python/google/protobuf/descriptor_database.py +137 -0
- data/ext/protoc/protobuf/python/google/protobuf/descriptor_pool.py +643 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/__init__.py +0 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/api_implementation.cc +139 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/api_implementation.py +89 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/api_implementation_default_test.py +63 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/containers.py +269 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/cpp_message.py +663 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/decoder.py +831 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_database_test.py +63 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_pool_test.py +564 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_pool_test1.proto +94 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_pool_test2.proto +70 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_python_test.py +54 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_test.py +669 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/encoder.py +788 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/enum_type_wrapper.py +89 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/factory_test1.proto +57 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/factory_test2.proto +92 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/generator_test.py +343 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/message_factory_python_test.py +54 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/message_factory_test.py +131 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/message_listener.py +78 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/message_python_test.py +54 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/message_test.py +681 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/missing_enum_values.proto +50 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/more_extensions.proto +58 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/more_extensions_dynamic.proto +49 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/more_messages.proto +51 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/python_message.py +1251 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/reflection_test.py +2934 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/service_reflection_test.py +136 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/symbol_database_test.py +120 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/test_bad_identifiers.proto +52 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/test_util.py +662 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/text_encoding_test.py +68 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/text_format_test.py +743 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/type_checkers.py +328 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/unknown_fields_test.py +231 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/wire_format.py +268 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/wire_format_test.py +253 -0
- data/ext/protoc/protobuf/python/google/protobuf/message.py +284 -0
- data/ext/protoc/protobuf/python/google/protobuf/message_factory.py +155 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/README +6 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/__init__.py +0 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/cpp_message.py +61 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/descriptor.cc +357 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/descriptor.h +96 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/descriptor_cpp2_test.py +58 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/extension_dict.cc +338 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/extension_dict.h +123 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/message.cc +2561 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/message.h +305 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/message_factory_cpp2_test.py +56 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/proto2_api_test.proto +38 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/python.proto +66 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/python_protobuf.h +57 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/reflection_cpp2_generated_test.py +94 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc +763 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/repeated_composite_container.h +172 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/repeated_scalar_container.cc +825 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/repeated_scalar_container.h +112 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/scoped_pyobject_ptr.h +95 -0
- data/ext/protoc/protobuf/python/google/protobuf/reflection.py +205 -0
- data/ext/protoc/protobuf/python/google/protobuf/service.py +226 -0
- data/ext/protoc/protobuf/python/google/protobuf/service_reflection.py +284 -0
- data/ext/protoc/protobuf/python/google/protobuf/symbol_database.py +185 -0
- data/ext/protoc/protobuf/python/google/protobuf/text_encoding.py +110 -0
- data/ext/protoc/protobuf/python/google/protobuf/text_format.py +873 -0
- data/ext/protoc/protobuf/python/mox.py +1401 -0
- data/ext/protoc/protobuf/python/setup.py +201 -0
- data/ext/protoc/protobuf/python/stubout.py +140 -0
- data/ext/protoc/protobuf/src/Makefile.am +418 -0
- data/ext/protoc/protobuf/src/google/protobuf/SEBS +240 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/code_generator.cc +84 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/code_generator.h +145 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/command_line_interface.cc +1603 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/command_line_interface.h +378 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/command_line_interface_unittest.cc +1654 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc +158 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.cc +288 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.h +103 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.cc +431 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.h +122 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_extension.cc +210 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_extension.h +86 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_field.cc +166 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_field.h +185 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc +665 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_file.h +99 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.cc +125 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.h +72 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc +494 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h +206 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc +2645 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_message.h +175 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.cc +375 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.h +121 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_options.h +58 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc +123 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc +451 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.h +123 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_service.cc +334 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_service.h +118 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.cc +642 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.h +127 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto +132 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_unittest.cc +2074 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_unittest.h +51 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/importer.cc +480 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/importer.h +317 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/importer_unittest.cc +617 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_context.cc +195 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_context.h +95 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_doc_comment.cc +233 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_doc_comment.h +69 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_doc_comment_unittest.cc +67 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_enum.cc +333 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_enum.h +99 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_enum_field.cc +778 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_enum_field.h +158 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_extension.cc +207 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_extension.h +109 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_field.cc +213 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_field.h +162 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_file.cc +534 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_file.h +115 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_generator.cc +158 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_generator.h +72 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_generator_factory.cc +77 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_generator_factory.h +101 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_helpers.cc +737 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_helpers.h +322 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_lazy_message_field.cc +826 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_lazy_message_field.h +121 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_message.cc +1666 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_message.h +140 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_message_field.cc +1343 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_message_field.h +173 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_name_resolver.cc +266 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_name_resolver.h +124 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_plugin_unittest.cc +124 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_primitive_field.cc +877 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_primitive_field.h +160 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_service.cc +473 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_service.h +135 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.cc +201 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.h +90 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_string_field.cc +1056 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_string_field.h +160 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/main.cc +61 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/mock_code_generator.cc +240 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/mock_code_generator.h +117 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/package_info.h +64 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/parser.cc +1750 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/parser.h +522 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/parser_unittest.cc +2612 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.cc +163 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.h +72 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.pb.cc +1148 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.pb.h +897 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.proto +147 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/python/python_generator.cc +1262 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/python/python_generator.h +166 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/python/python_plugin_unittest.cc +118 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/subprocess.cc +463 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/subprocess.h +108 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/test_plugin.cc +51 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/zip_output_unittest.sh +91 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/zip_writer.cc +218 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/zip_writer.h +93 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor.cc +5420 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor.h +1691 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor.pb.cc +9135 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor.pb.h +6761 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor.proto +687 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor_database.cc +543 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor_database.h +369 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor_database_unittest.cc +748 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor_pb2_test.py +54 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor_unittest.cc +5501 -0
- data/ext/protoc/protobuf/src/google/protobuf/dynamic_message.cc +764 -0
- data/ext/protoc/protobuf/src/google/protobuf/dynamic_message.h +148 -0
- data/ext/protoc/protobuf/src/google/protobuf/dynamic_message_unittest.cc +230 -0
- data/ext/protoc/protobuf/src/google/protobuf/extension_set.cc +1663 -0
- data/ext/protoc/protobuf/src/google/protobuf/extension_set.h +1234 -0
- data/ext/protoc/protobuf/src/google/protobuf/extension_set_heavy.cc +734 -0
- data/ext/protoc/protobuf/src/google/protobuf/extension_set_unittest.cc +1095 -0
- data/ext/protoc/protobuf/src/google/protobuf/generated_enum_reflection.h +91 -0
- data/ext/protoc/protobuf/src/google/protobuf/generated_message_reflection.cc +1683 -0
- data/ext/protoc/protobuf/src/google/protobuf/generated_message_reflection.h +504 -0
- data/ext/protoc/protobuf/src/google/protobuf/generated_message_reflection_unittest.cc +795 -0
- data/ext/protoc/protobuf/src/google/protobuf/generated_message_util.cc +65 -0
- data/ext/protoc/protobuf/src/google/protobuf/generated_message_util.h +113 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/coded_stream.cc +914 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/coded_stream.h +1220 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/coded_stream_inl.h +69 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/coded_stream_unittest.cc +1378 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/gzip_stream.cc +326 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/gzip_stream.h +209 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/gzip_stream_unittest.sh +44 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/package_info.h +54 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/printer.cc +198 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/printer.h +136 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/printer_unittest.cc +285 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/strtod.cc +113 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/strtod.h +50 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/tokenizer.cc +1127 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/tokenizer.h +402 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/tokenizer_unittest.cc +999 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream.cc +57 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream.h +248 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc +473 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h +358 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc +405 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h +354 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_unittest.cc +965 -0
- data/ext/protoc/protobuf/src/google/protobuf/lite_unittest.cc +350 -0
- data/ext/protoc/protobuf/src/google/protobuf/message.cc +358 -0
- data/ext/protoc/protobuf/src/google/protobuf/message.h +866 -0
- data/ext/protoc/protobuf/src/google/protobuf/message_lite.cc +335 -0
- data/ext/protoc/protobuf/src/google/protobuf/message_lite.h +247 -0
- data/ext/protoc/protobuf/src/google/protobuf/message_unittest.cc +427 -0
- data/ext/protoc/protobuf/src/google/protobuf/package_info.h +64 -0
- data/ext/protoc/protobuf/src/google/protobuf/reflection_ops.cc +269 -0
- data/ext/protoc/protobuf/src/google/protobuf/reflection_ops.h +81 -0
- data/ext/protoc/protobuf/src/google/protobuf/reflection_ops_unittest.cc +475 -0
- data/ext/protoc/protobuf/src/google/protobuf/repeated_field.cc +87 -0
- data/ext/protoc/protobuf/src/google/protobuf/repeated_field.h +1603 -0
- data/ext/protoc/protobuf/src/google/protobuf/repeated_field_reflection_unittest.cc +195 -0
- data/ext/protoc/protobuf/src/google/protobuf/repeated_field_unittest.cc +1442 -0
- data/ext/protoc/protobuf/src/google/protobuf/service.cc +46 -0
- data/ext/protoc/protobuf/src/google/protobuf/service.h +291 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops.h +227 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_arm64_gcc.h +325 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_arm_gcc.h +151 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_arm_qnx.h +146 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h +122 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h +137 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h +225 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_mips_gcc.h +313 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_pnacl.h +73 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_solaris.h +188 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_tsan.h +219 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc +137 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.h +293 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc +112 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_msvc.h +150 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/common.cc +395 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/common.h +1226 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/common_unittest.cc +357 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/hash.h +232 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/map_util.h +771 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/once.cc +99 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/once.h +166 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/once_unittest.cc +253 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/platform_macros.h +103 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/shared_ptr.h +470 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/stl_util.h +121 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/stringprintf.cc +175 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/stringprintf.h +76 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/stringprintf_unittest.cc +152 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/structurally_valid.cc +536 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/structurally_valid_unittest.cc +40 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/strutil.cc +1279 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/strutil.h +562 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/strutil_unittest.cc +73 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/substitute.cc +134 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/substitute.h +170 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/template_util.h +138 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/template_util_unittest.cc +130 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/type_traits.h +336 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/type_traits_unittest.cc +628 -0
- data/ext/protoc/protobuf/src/google/protobuf/test_util.cc +3345 -0
- data/ext/protoc/protobuf/src/google/protobuf/test_util.h +215 -0
- data/ext/protoc/protobuf/src/google/protobuf/test_util_lite.cc +1585 -0
- data/ext/protoc/protobuf/src/google/protobuf/test_util_lite.h +101 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/bad_utf8_string +1 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/golden_message +0 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/golden_message_oneof_implemented +0 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/golden_packed_fields_message +0 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_data.txt +134 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_data_oneof_implemented.txt +129 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_data_pointy.txt +134 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_data_pointy_oneof.txt +129 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_extensions_data.txt +134 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt +134 -0
- data/ext/protoc/protobuf/src/google/protobuf/testing/file.cc +194 -0
- data/ext/protoc/protobuf/src/google/protobuf/testing/file.h +97 -0
- data/ext/protoc/protobuf/src/google/protobuf/testing/googletest.cc +255 -0
- data/ext/protoc/protobuf/src/google/protobuf/testing/googletest.h +102 -0
- data/ext/protoc/protobuf/src/google/protobuf/testing/zcgunzip.cc +73 -0
- data/ext/protoc/protobuf/src/google/protobuf/testing/zcgzip.cc +79 -0
- data/ext/protoc/protobuf/src/google/protobuf/text_format.cc +1746 -0
- data/ext/protoc/protobuf/src/google/protobuf/text_format.h +473 -0
- data/ext/protoc/protobuf/src/google/protobuf/text_format_unittest.cc +1479 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest.proto +861 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_custom_options.proto +393 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_embed_optimize_for.proto +50 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_empty.proto +37 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_enormous_descriptor.proto +1046 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_import.proto +64 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_import_lite.proto +51 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_import_public.proto +40 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_import_public_lite.proto +42 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_lite.proto +384 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_lite_imports_nonlite.proto +43 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_mset.proto +83 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_no_generic_services.proto +53 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_optimize_for.proto +66 -0
- data/ext/protoc/protobuf/src/google/protobuf/unknown_field_set.cc +265 -0
- data/ext/protoc/protobuf/src/google/protobuf/unknown_field_set.h +318 -0
- data/ext/protoc/protobuf/src/google/protobuf/unknown_field_set_unittest.cc +599 -0
- data/ext/protoc/protobuf/src/google/protobuf/wire_format.cc +1101 -0
- data/ext/protoc/protobuf/src/google/protobuf/wire_format.h +336 -0
- data/ext/protoc/protobuf/src/google/protobuf/wire_format_lite.cc +471 -0
- data/ext/protoc/protobuf/src/google/protobuf/wire_format_lite.h +661 -0
- data/ext/protoc/protobuf/src/google/protobuf/wire_format_lite_inl.h +860 -0
- data/ext/protoc/protobuf/src/google/protobuf/wire_format_unittest.cc +1120 -0
- data/ext/protoc/protobuf/src/solaris/libstdc++.la +51 -0
- data/ext/protoc/protobuf/vsprojects/config.h +29 -0
- data/ext/protoc/protobuf/vsprojects/convert2008to2005.sh +20 -0
- data/ext/protoc/protobuf/vsprojects/extract_includes.bat +50 -0
- data/ext/protoc/protobuf/vsprojects/libprotobuf-lite.vcproj +302 -0
- data/ext/protoc/protobuf/vsprojects/libprotobuf.vcproj +470 -0
- data/ext/protoc/protobuf/vsprojects/libprotoc.vcproj +466 -0
- data/ext/protoc/protobuf/vsprojects/lite-test.vcproj +305 -0
- data/ext/protoc/protobuf/vsprojects/protobuf.sln +92 -0
- data/ext/protoc/protobuf/vsprojects/protoc.vcproj +192 -0
- data/ext/protoc/protobuf/vsprojects/readme.txt +114 -0
- data/ext/protoc/protobuf/vsprojects/test_plugin.vcproj +209 -0
- data/ext/protoc/protobuf/vsprojects/tests.vcproj +681 -0
- data/lib/protoc/version.rb +1 -1
- metadata +480 -3
@@ -0,0 +1,94 @@
|
|
1
|
+
// Protocol Buffers - Google's data interchange format
|
2
|
+
// Copyright 2008 Google Inc. All rights reserved.
|
3
|
+
// https://developers.google.com/protocol-buffers/
|
4
|
+
//
|
5
|
+
// Redistribution and use in source and binary forms, with or without
|
6
|
+
// modification, are permitted provided that the following conditions are
|
7
|
+
// met:
|
8
|
+
//
|
9
|
+
// * Redistributions of source code must retain the above copyright
|
10
|
+
// notice, this list of conditions and the following disclaimer.
|
11
|
+
// * Redistributions in binary form must reproduce the above
|
12
|
+
// copyright notice, this list of conditions and the following disclaimer
|
13
|
+
// in the documentation and/or other materials provided with the
|
14
|
+
// distribution.
|
15
|
+
// * Neither the name of Google Inc. nor the names of its
|
16
|
+
// contributors may be used to endorse or promote products derived from
|
17
|
+
// this software without specific prior written permission.
|
18
|
+
//
|
19
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
20
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
21
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
22
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
23
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
24
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
25
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
26
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
27
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
+
|
31
|
+
package google.protobuf.python.internal;
|
32
|
+
|
33
|
+
|
34
|
+
message DescriptorPoolTest1 {
|
35
|
+
extensions 1000 to max;
|
36
|
+
|
37
|
+
enum NestedEnum {
|
38
|
+
ALPHA = 1;
|
39
|
+
BETA = 2;
|
40
|
+
}
|
41
|
+
|
42
|
+
optional NestedEnum nested_enum = 1 [default = BETA];
|
43
|
+
|
44
|
+
message NestedMessage {
|
45
|
+
enum NestedEnum {
|
46
|
+
EPSILON = 5;
|
47
|
+
ZETA = 6;
|
48
|
+
}
|
49
|
+
optional NestedEnum nested_enum = 1 [default = ZETA];
|
50
|
+
optional string nested_field = 2 [default = "beta"];
|
51
|
+
optional DeepNestedMessage deep_nested_message = 3;
|
52
|
+
|
53
|
+
message DeepNestedMessage {
|
54
|
+
enum NestedEnum {
|
55
|
+
ETA = 7;
|
56
|
+
THETA = 8;
|
57
|
+
}
|
58
|
+
optional NestedEnum nested_enum = 1 [default = ETA];
|
59
|
+
optional string nested_field = 2 [default = "theta"];
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
optional NestedMessage nested_message = 2;
|
64
|
+
}
|
65
|
+
|
66
|
+
message DescriptorPoolTest2 {
|
67
|
+
enum NestedEnum {
|
68
|
+
GAMMA = 3;
|
69
|
+
DELTA = 4;
|
70
|
+
}
|
71
|
+
|
72
|
+
optional NestedEnum nested_enum = 1 [default = GAMMA];
|
73
|
+
|
74
|
+
message NestedMessage {
|
75
|
+
enum NestedEnum {
|
76
|
+
IOTA = 9;
|
77
|
+
KAPPA = 10;
|
78
|
+
}
|
79
|
+
optional NestedEnum nested_enum = 1 [default = IOTA];
|
80
|
+
optional string nested_field = 2 [default = "delta"];
|
81
|
+
optional DeepNestedMessage deep_nested_message = 3;
|
82
|
+
|
83
|
+
message DeepNestedMessage {
|
84
|
+
enum NestedEnum {
|
85
|
+
LAMBDA = 11;
|
86
|
+
MU = 12;
|
87
|
+
}
|
88
|
+
optional NestedEnum nested_enum = 1 [default = MU];
|
89
|
+
optional string nested_field = 2 [default = "lambda"];
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
optional NestedMessage nested_message = 2;
|
94
|
+
}
|
@@ -0,0 +1,70 @@
|
|
1
|
+
// Protocol Buffers - Google's data interchange format
|
2
|
+
// Copyright 2008 Google Inc. All rights reserved.
|
3
|
+
// https://developers.google.com/protocol-buffers/
|
4
|
+
//
|
5
|
+
// Redistribution and use in source and binary forms, with or without
|
6
|
+
// modification, are permitted provided that the following conditions are
|
7
|
+
// met:
|
8
|
+
//
|
9
|
+
// * Redistributions of source code must retain the above copyright
|
10
|
+
// notice, this list of conditions and the following disclaimer.
|
11
|
+
// * Redistributions in binary form must reproduce the above
|
12
|
+
// copyright notice, this list of conditions and the following disclaimer
|
13
|
+
// in the documentation and/or other materials provided with the
|
14
|
+
// distribution.
|
15
|
+
// * Neither the name of Google Inc. nor the names of its
|
16
|
+
// contributors may be used to endorse or promote products derived from
|
17
|
+
// this software without specific prior written permission.
|
18
|
+
//
|
19
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
20
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
21
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
22
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
23
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
24
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
25
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
26
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
27
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
+
|
31
|
+
package google.protobuf.python.internal;
|
32
|
+
|
33
|
+
import "google/protobuf/internal/descriptor_pool_test1.proto";
|
34
|
+
|
35
|
+
|
36
|
+
message DescriptorPoolTest3 {
|
37
|
+
|
38
|
+
extend DescriptorPoolTest1 {
|
39
|
+
optional DescriptorPoolTest3 descriptor_pool_test = 1001;
|
40
|
+
}
|
41
|
+
|
42
|
+
enum NestedEnum {
|
43
|
+
NU = 13;
|
44
|
+
XI = 14;
|
45
|
+
}
|
46
|
+
|
47
|
+
optional NestedEnum nested_enum = 1 [default = XI];
|
48
|
+
|
49
|
+
message NestedMessage {
|
50
|
+
enum NestedEnum {
|
51
|
+
OMICRON = 15;
|
52
|
+
PI = 16;
|
53
|
+
}
|
54
|
+
optional NestedEnum nested_enum = 1 [default = PI];
|
55
|
+
optional string nested_field = 2 [default = "nu"];
|
56
|
+
optional DeepNestedMessage deep_nested_message = 3;
|
57
|
+
|
58
|
+
message DeepNestedMessage {
|
59
|
+
enum NestedEnum {
|
60
|
+
RHO = 17;
|
61
|
+
SIGMA = 18;
|
62
|
+
}
|
63
|
+
optional NestedEnum nested_enum = 1 [default = RHO];
|
64
|
+
optional string nested_field = 2 [default = "sigma"];
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
optional NestedMessage nested_message = 2;
|
69
|
+
}
|
70
|
+
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#! /usr/bin/python
|
2
|
+
#
|
3
|
+
# Protocol Buffers - Google's data interchange format
|
4
|
+
# Copyright 2008 Google Inc. All rights reserved.
|
5
|
+
# https://developers.google.com/protocol-buffers/
|
6
|
+
#
|
7
|
+
# Redistribution and use in source and binary forms, with or without
|
8
|
+
# modification, are permitted provided that the following conditions are
|
9
|
+
# met:
|
10
|
+
#
|
11
|
+
# * Redistributions of source code must retain the above copyright
|
12
|
+
# notice, this list of conditions and the following disclaimer.
|
13
|
+
# * Redistributions in binary form must reproduce the above
|
14
|
+
# copyright notice, this list of conditions and the following disclaimer
|
15
|
+
# in the documentation and/or other materials provided with the
|
16
|
+
# distribution.
|
17
|
+
# * Neither the name of Google Inc. nor the names of its
|
18
|
+
# contributors may be used to endorse or promote products derived from
|
19
|
+
# this software without specific prior written permission.
|
20
|
+
#
|
21
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
22
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
23
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
24
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
25
|
+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
26
|
+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
27
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
28
|
+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
29
|
+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
30
|
+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
31
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
32
|
+
|
33
|
+
"""Unittest for descriptor.py for the pure Python implementation."""
|
34
|
+
|
35
|
+
import os
|
36
|
+
os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'] = 'python'
|
37
|
+
|
38
|
+
# We must set the implementation version above before the google3 imports.
|
39
|
+
# pylint: disable=g-import-not-at-top
|
40
|
+
from google.apputils import basetest
|
41
|
+
from google.protobuf.internal import api_implementation
|
42
|
+
# Run all tests from the original module by putting them in our namespace.
|
43
|
+
# pylint: disable=wildcard-import
|
44
|
+
from google.protobuf.internal.descriptor_test import *
|
45
|
+
|
46
|
+
|
47
|
+
class ConfirmPurePythonTest(basetest.TestCase):
|
48
|
+
|
49
|
+
def testImplementationSetting(self):
|
50
|
+
self.assertEqual('python', api_implementation.Type())
|
51
|
+
|
52
|
+
|
53
|
+
if __name__ == '__main__':
|
54
|
+
basetest.main()
|
@@ -0,0 +1,669 @@
|
|
1
|
+
#! /usr/bin/python
|
2
|
+
#
|
3
|
+
# Protocol Buffers - Google's data interchange format
|
4
|
+
# Copyright 2008 Google Inc. All rights reserved.
|
5
|
+
# https://developers.google.com/protocol-buffers/
|
6
|
+
#
|
7
|
+
# Redistribution and use in source and binary forms, with or without
|
8
|
+
# modification, are permitted provided that the following conditions are
|
9
|
+
# met:
|
10
|
+
#
|
11
|
+
# * Redistributions of source code must retain the above copyright
|
12
|
+
# notice, this list of conditions and the following disclaimer.
|
13
|
+
# * Redistributions in binary form must reproduce the above
|
14
|
+
# copyright notice, this list of conditions and the following disclaimer
|
15
|
+
# in the documentation and/or other materials provided with the
|
16
|
+
# distribution.
|
17
|
+
# * Neither the name of Google Inc. nor the names of its
|
18
|
+
# contributors may be used to endorse or promote products derived from
|
19
|
+
# this software without specific prior written permission.
|
20
|
+
#
|
21
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
22
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
23
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
24
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
25
|
+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
26
|
+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
27
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
28
|
+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
29
|
+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
30
|
+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
31
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
32
|
+
|
33
|
+
"""Unittest for google.protobuf.internal.descriptor."""
|
34
|
+
|
35
|
+
__author__ = 'robinson@google.com (Will Robinson)'
|
36
|
+
|
37
|
+
from google.apputils import basetest
|
38
|
+
from google.protobuf import unittest_custom_options_pb2
|
39
|
+
from google.protobuf import unittest_import_pb2
|
40
|
+
from google.protobuf import unittest_pb2
|
41
|
+
from google.protobuf import descriptor_pb2
|
42
|
+
from google.protobuf import descriptor
|
43
|
+
from google.protobuf import text_format
|
44
|
+
|
45
|
+
|
46
|
+
TEST_EMPTY_MESSAGE_DESCRIPTOR_ASCII = """
|
47
|
+
name: 'TestEmptyMessage'
|
48
|
+
"""
|
49
|
+
|
50
|
+
|
51
|
+
class DescriptorTest(basetest.TestCase):
|
52
|
+
|
53
|
+
def setUp(self):
|
54
|
+
self.my_file = descriptor.FileDescriptor(
|
55
|
+
name='some/filename/some.proto',
|
56
|
+
package='protobuf_unittest'
|
57
|
+
)
|
58
|
+
self.my_enum = descriptor.EnumDescriptor(
|
59
|
+
name='ForeignEnum',
|
60
|
+
full_name='protobuf_unittest.ForeignEnum',
|
61
|
+
filename=None,
|
62
|
+
file=self.my_file,
|
63
|
+
values=[
|
64
|
+
descriptor.EnumValueDescriptor(name='FOREIGN_FOO', index=0, number=4),
|
65
|
+
descriptor.EnumValueDescriptor(name='FOREIGN_BAR', index=1, number=5),
|
66
|
+
descriptor.EnumValueDescriptor(name='FOREIGN_BAZ', index=2, number=6),
|
67
|
+
])
|
68
|
+
self.my_message = descriptor.Descriptor(
|
69
|
+
name='NestedMessage',
|
70
|
+
full_name='protobuf_unittest.TestAllTypes.NestedMessage',
|
71
|
+
filename=None,
|
72
|
+
file=self.my_file,
|
73
|
+
containing_type=None,
|
74
|
+
fields=[
|
75
|
+
descriptor.FieldDescriptor(
|
76
|
+
name='bb',
|
77
|
+
full_name='protobuf_unittest.TestAllTypes.NestedMessage.bb',
|
78
|
+
index=0, number=1,
|
79
|
+
type=5, cpp_type=1, label=1,
|
80
|
+
has_default_value=False, default_value=0,
|
81
|
+
message_type=None, enum_type=None, containing_type=None,
|
82
|
+
is_extension=False, extension_scope=None),
|
83
|
+
],
|
84
|
+
nested_types=[],
|
85
|
+
enum_types=[
|
86
|
+
self.my_enum,
|
87
|
+
],
|
88
|
+
extensions=[])
|
89
|
+
self.my_method = descriptor.MethodDescriptor(
|
90
|
+
name='Bar',
|
91
|
+
full_name='protobuf_unittest.TestService.Bar',
|
92
|
+
index=0,
|
93
|
+
containing_service=None,
|
94
|
+
input_type=None,
|
95
|
+
output_type=None)
|
96
|
+
self.my_service = descriptor.ServiceDescriptor(
|
97
|
+
name='TestServiceWithOptions',
|
98
|
+
full_name='protobuf_unittest.TestServiceWithOptions',
|
99
|
+
file=self.my_file,
|
100
|
+
index=0,
|
101
|
+
methods=[
|
102
|
+
self.my_method
|
103
|
+
])
|
104
|
+
|
105
|
+
def testEnumValueName(self):
|
106
|
+
self.assertEqual(self.my_message.EnumValueName('ForeignEnum', 4),
|
107
|
+
'FOREIGN_FOO')
|
108
|
+
|
109
|
+
self.assertEqual(
|
110
|
+
self.my_message.enum_types_by_name[
|
111
|
+
'ForeignEnum'].values_by_number[4].name,
|
112
|
+
self.my_message.EnumValueName('ForeignEnum', 4))
|
113
|
+
|
114
|
+
def testEnumFixups(self):
|
115
|
+
self.assertEqual(self.my_enum, self.my_enum.values[0].type)
|
116
|
+
|
117
|
+
def testContainingTypeFixups(self):
|
118
|
+
self.assertEqual(self.my_message, self.my_message.fields[0].containing_type)
|
119
|
+
self.assertEqual(self.my_message, self.my_enum.containing_type)
|
120
|
+
|
121
|
+
def testContainingServiceFixups(self):
|
122
|
+
self.assertEqual(self.my_service, self.my_method.containing_service)
|
123
|
+
|
124
|
+
def testGetOptions(self):
|
125
|
+
self.assertEqual(self.my_enum.GetOptions(),
|
126
|
+
descriptor_pb2.EnumOptions())
|
127
|
+
self.assertEqual(self.my_enum.values[0].GetOptions(),
|
128
|
+
descriptor_pb2.EnumValueOptions())
|
129
|
+
self.assertEqual(self.my_message.GetOptions(),
|
130
|
+
descriptor_pb2.MessageOptions())
|
131
|
+
self.assertEqual(self.my_message.fields[0].GetOptions(),
|
132
|
+
descriptor_pb2.FieldOptions())
|
133
|
+
self.assertEqual(self.my_method.GetOptions(),
|
134
|
+
descriptor_pb2.MethodOptions())
|
135
|
+
self.assertEqual(self.my_service.GetOptions(),
|
136
|
+
descriptor_pb2.ServiceOptions())
|
137
|
+
|
138
|
+
def testSimpleCustomOptions(self):
|
139
|
+
file_descriptor = unittest_custom_options_pb2.DESCRIPTOR
|
140
|
+
message_descriptor =\
|
141
|
+
unittest_custom_options_pb2.TestMessageWithCustomOptions.DESCRIPTOR
|
142
|
+
field_descriptor = message_descriptor.fields_by_name["field1"]
|
143
|
+
enum_descriptor = message_descriptor.enum_types_by_name["AnEnum"]
|
144
|
+
enum_value_descriptor =\
|
145
|
+
message_descriptor.enum_values_by_name["ANENUM_VAL2"]
|
146
|
+
service_descriptor =\
|
147
|
+
unittest_custom_options_pb2.TestServiceWithCustomOptions.DESCRIPTOR
|
148
|
+
method_descriptor = service_descriptor.FindMethodByName("Foo")
|
149
|
+
|
150
|
+
file_options = file_descriptor.GetOptions()
|
151
|
+
file_opt1 = unittest_custom_options_pb2.file_opt1
|
152
|
+
self.assertEqual(9876543210, file_options.Extensions[file_opt1])
|
153
|
+
message_options = message_descriptor.GetOptions()
|
154
|
+
message_opt1 = unittest_custom_options_pb2.message_opt1
|
155
|
+
self.assertEqual(-56, message_options.Extensions[message_opt1])
|
156
|
+
field_options = field_descriptor.GetOptions()
|
157
|
+
field_opt1 = unittest_custom_options_pb2.field_opt1
|
158
|
+
self.assertEqual(8765432109, field_options.Extensions[field_opt1])
|
159
|
+
field_opt2 = unittest_custom_options_pb2.field_opt2
|
160
|
+
self.assertEqual(42, field_options.Extensions[field_opt2])
|
161
|
+
enum_options = enum_descriptor.GetOptions()
|
162
|
+
enum_opt1 = unittest_custom_options_pb2.enum_opt1
|
163
|
+
self.assertEqual(-789, enum_options.Extensions[enum_opt1])
|
164
|
+
enum_value_options = enum_value_descriptor.GetOptions()
|
165
|
+
enum_value_opt1 = unittest_custom_options_pb2.enum_value_opt1
|
166
|
+
self.assertEqual(123, enum_value_options.Extensions[enum_value_opt1])
|
167
|
+
|
168
|
+
service_options = service_descriptor.GetOptions()
|
169
|
+
service_opt1 = unittest_custom_options_pb2.service_opt1
|
170
|
+
self.assertEqual(-9876543210, service_options.Extensions[service_opt1])
|
171
|
+
method_options = method_descriptor.GetOptions()
|
172
|
+
method_opt1 = unittest_custom_options_pb2.method_opt1
|
173
|
+
self.assertEqual(unittest_custom_options_pb2.METHODOPT1_VAL2,
|
174
|
+
method_options.Extensions[method_opt1])
|
175
|
+
|
176
|
+
def testDifferentCustomOptionTypes(self):
|
177
|
+
kint32min = -2**31
|
178
|
+
kint64min = -2**63
|
179
|
+
kint32max = 2**31 - 1
|
180
|
+
kint64max = 2**63 - 1
|
181
|
+
kuint32max = 2**32 - 1
|
182
|
+
kuint64max = 2**64 - 1
|
183
|
+
|
184
|
+
message_descriptor =\
|
185
|
+
unittest_custom_options_pb2.CustomOptionMinIntegerValues.DESCRIPTOR
|
186
|
+
message_options = message_descriptor.GetOptions()
|
187
|
+
self.assertEqual(False, message_options.Extensions[
|
188
|
+
unittest_custom_options_pb2.bool_opt])
|
189
|
+
self.assertEqual(kint32min, message_options.Extensions[
|
190
|
+
unittest_custom_options_pb2.int32_opt])
|
191
|
+
self.assertEqual(kint64min, message_options.Extensions[
|
192
|
+
unittest_custom_options_pb2.int64_opt])
|
193
|
+
self.assertEqual(0, message_options.Extensions[
|
194
|
+
unittest_custom_options_pb2.uint32_opt])
|
195
|
+
self.assertEqual(0, message_options.Extensions[
|
196
|
+
unittest_custom_options_pb2.uint64_opt])
|
197
|
+
self.assertEqual(kint32min, message_options.Extensions[
|
198
|
+
unittest_custom_options_pb2.sint32_opt])
|
199
|
+
self.assertEqual(kint64min, message_options.Extensions[
|
200
|
+
unittest_custom_options_pb2.sint64_opt])
|
201
|
+
self.assertEqual(0, message_options.Extensions[
|
202
|
+
unittest_custom_options_pb2.fixed32_opt])
|
203
|
+
self.assertEqual(0, message_options.Extensions[
|
204
|
+
unittest_custom_options_pb2.fixed64_opt])
|
205
|
+
self.assertEqual(kint32min, message_options.Extensions[
|
206
|
+
unittest_custom_options_pb2.sfixed32_opt])
|
207
|
+
self.assertEqual(kint64min, message_options.Extensions[
|
208
|
+
unittest_custom_options_pb2.sfixed64_opt])
|
209
|
+
|
210
|
+
message_descriptor =\
|
211
|
+
unittest_custom_options_pb2.CustomOptionMaxIntegerValues.DESCRIPTOR
|
212
|
+
message_options = message_descriptor.GetOptions()
|
213
|
+
self.assertEqual(True, message_options.Extensions[
|
214
|
+
unittest_custom_options_pb2.bool_opt])
|
215
|
+
self.assertEqual(kint32max, message_options.Extensions[
|
216
|
+
unittest_custom_options_pb2.int32_opt])
|
217
|
+
self.assertEqual(kint64max, message_options.Extensions[
|
218
|
+
unittest_custom_options_pb2.int64_opt])
|
219
|
+
self.assertEqual(kuint32max, message_options.Extensions[
|
220
|
+
unittest_custom_options_pb2.uint32_opt])
|
221
|
+
self.assertEqual(kuint64max, message_options.Extensions[
|
222
|
+
unittest_custom_options_pb2.uint64_opt])
|
223
|
+
self.assertEqual(kint32max, message_options.Extensions[
|
224
|
+
unittest_custom_options_pb2.sint32_opt])
|
225
|
+
self.assertEqual(kint64max, message_options.Extensions[
|
226
|
+
unittest_custom_options_pb2.sint64_opt])
|
227
|
+
self.assertEqual(kuint32max, message_options.Extensions[
|
228
|
+
unittest_custom_options_pb2.fixed32_opt])
|
229
|
+
self.assertEqual(kuint64max, message_options.Extensions[
|
230
|
+
unittest_custom_options_pb2.fixed64_opt])
|
231
|
+
self.assertEqual(kint32max, message_options.Extensions[
|
232
|
+
unittest_custom_options_pb2.sfixed32_opt])
|
233
|
+
self.assertEqual(kint64max, message_options.Extensions[
|
234
|
+
unittest_custom_options_pb2.sfixed64_opt])
|
235
|
+
|
236
|
+
message_descriptor =\
|
237
|
+
unittest_custom_options_pb2.CustomOptionOtherValues.DESCRIPTOR
|
238
|
+
message_options = message_descriptor.GetOptions()
|
239
|
+
self.assertEqual(-100, message_options.Extensions[
|
240
|
+
unittest_custom_options_pb2.int32_opt])
|
241
|
+
self.assertAlmostEqual(12.3456789, message_options.Extensions[
|
242
|
+
unittest_custom_options_pb2.float_opt], 6)
|
243
|
+
self.assertAlmostEqual(1.234567890123456789, message_options.Extensions[
|
244
|
+
unittest_custom_options_pb2.double_opt])
|
245
|
+
self.assertEqual("Hello, \"World\"", message_options.Extensions[
|
246
|
+
unittest_custom_options_pb2.string_opt])
|
247
|
+
self.assertEqual(b"Hello\0World", message_options.Extensions[
|
248
|
+
unittest_custom_options_pb2.bytes_opt])
|
249
|
+
dummy_enum = unittest_custom_options_pb2.DummyMessageContainingEnum
|
250
|
+
self.assertEqual(
|
251
|
+
dummy_enum.TEST_OPTION_ENUM_TYPE2,
|
252
|
+
message_options.Extensions[unittest_custom_options_pb2.enum_opt])
|
253
|
+
|
254
|
+
message_descriptor =\
|
255
|
+
unittest_custom_options_pb2.SettingRealsFromPositiveInts.DESCRIPTOR
|
256
|
+
message_options = message_descriptor.GetOptions()
|
257
|
+
self.assertAlmostEqual(12, message_options.Extensions[
|
258
|
+
unittest_custom_options_pb2.float_opt], 6)
|
259
|
+
self.assertAlmostEqual(154, message_options.Extensions[
|
260
|
+
unittest_custom_options_pb2.double_opt])
|
261
|
+
|
262
|
+
message_descriptor =\
|
263
|
+
unittest_custom_options_pb2.SettingRealsFromNegativeInts.DESCRIPTOR
|
264
|
+
message_options = message_descriptor.GetOptions()
|
265
|
+
self.assertAlmostEqual(-12, message_options.Extensions[
|
266
|
+
unittest_custom_options_pb2.float_opt], 6)
|
267
|
+
self.assertAlmostEqual(-154, message_options.Extensions[
|
268
|
+
unittest_custom_options_pb2.double_opt])
|
269
|
+
|
270
|
+
def testComplexExtensionOptions(self):
|
271
|
+
descriptor =\
|
272
|
+
unittest_custom_options_pb2.VariousComplexOptions.DESCRIPTOR
|
273
|
+
options = descriptor.GetOptions()
|
274
|
+
self.assertEqual(42, options.Extensions[
|
275
|
+
unittest_custom_options_pb2.complex_opt1].foo)
|
276
|
+
self.assertEqual(324, options.Extensions[
|
277
|
+
unittest_custom_options_pb2.complex_opt1].Extensions[
|
278
|
+
unittest_custom_options_pb2.quux])
|
279
|
+
self.assertEqual(876, options.Extensions[
|
280
|
+
unittest_custom_options_pb2.complex_opt1].Extensions[
|
281
|
+
unittest_custom_options_pb2.corge].qux)
|
282
|
+
self.assertEqual(987, options.Extensions[
|
283
|
+
unittest_custom_options_pb2.complex_opt2].baz)
|
284
|
+
self.assertEqual(654, options.Extensions[
|
285
|
+
unittest_custom_options_pb2.complex_opt2].Extensions[
|
286
|
+
unittest_custom_options_pb2.grault])
|
287
|
+
self.assertEqual(743, options.Extensions[
|
288
|
+
unittest_custom_options_pb2.complex_opt2].bar.foo)
|
289
|
+
self.assertEqual(1999, options.Extensions[
|
290
|
+
unittest_custom_options_pb2.complex_opt2].bar.Extensions[
|
291
|
+
unittest_custom_options_pb2.quux])
|
292
|
+
self.assertEqual(2008, options.Extensions[
|
293
|
+
unittest_custom_options_pb2.complex_opt2].bar.Extensions[
|
294
|
+
unittest_custom_options_pb2.corge].qux)
|
295
|
+
self.assertEqual(741, options.Extensions[
|
296
|
+
unittest_custom_options_pb2.complex_opt2].Extensions[
|
297
|
+
unittest_custom_options_pb2.garply].foo)
|
298
|
+
self.assertEqual(1998, options.Extensions[
|
299
|
+
unittest_custom_options_pb2.complex_opt2].Extensions[
|
300
|
+
unittest_custom_options_pb2.garply].Extensions[
|
301
|
+
unittest_custom_options_pb2.quux])
|
302
|
+
self.assertEqual(2121, options.Extensions[
|
303
|
+
unittest_custom_options_pb2.complex_opt2].Extensions[
|
304
|
+
unittest_custom_options_pb2.garply].Extensions[
|
305
|
+
unittest_custom_options_pb2.corge].qux)
|
306
|
+
self.assertEqual(1971, options.Extensions[
|
307
|
+
unittest_custom_options_pb2.ComplexOptionType2
|
308
|
+
.ComplexOptionType4.complex_opt4].waldo)
|
309
|
+
self.assertEqual(321, options.Extensions[
|
310
|
+
unittest_custom_options_pb2.complex_opt2].fred.waldo)
|
311
|
+
self.assertEqual(9, options.Extensions[
|
312
|
+
unittest_custom_options_pb2.complex_opt3].qux)
|
313
|
+
self.assertEqual(22, options.Extensions[
|
314
|
+
unittest_custom_options_pb2.complex_opt3].complexoptiontype5.plugh)
|
315
|
+
self.assertEqual(24, options.Extensions[
|
316
|
+
unittest_custom_options_pb2.complexopt6].xyzzy)
|
317
|
+
|
318
|
+
# Check that aggregate options were parsed and saved correctly in
|
319
|
+
# the appropriate descriptors.
|
320
|
+
def testAggregateOptions(self):
|
321
|
+
file_descriptor = unittest_custom_options_pb2.DESCRIPTOR
|
322
|
+
message_descriptor =\
|
323
|
+
unittest_custom_options_pb2.AggregateMessage.DESCRIPTOR
|
324
|
+
field_descriptor = message_descriptor.fields_by_name["fieldname"]
|
325
|
+
enum_descriptor = unittest_custom_options_pb2.AggregateEnum.DESCRIPTOR
|
326
|
+
enum_value_descriptor = enum_descriptor.values_by_name["VALUE"]
|
327
|
+
service_descriptor =\
|
328
|
+
unittest_custom_options_pb2.AggregateService.DESCRIPTOR
|
329
|
+
method_descriptor = service_descriptor.FindMethodByName("Method")
|
330
|
+
|
331
|
+
# Tests for the different types of data embedded in fileopt
|
332
|
+
file_options = file_descriptor.GetOptions().Extensions[
|
333
|
+
unittest_custom_options_pb2.fileopt]
|
334
|
+
self.assertEqual(100, file_options.i)
|
335
|
+
self.assertEqual("FileAnnotation", file_options.s)
|
336
|
+
self.assertEqual("NestedFileAnnotation", file_options.sub.s)
|
337
|
+
self.assertEqual("FileExtensionAnnotation", file_options.file.Extensions[
|
338
|
+
unittest_custom_options_pb2.fileopt].s)
|
339
|
+
self.assertEqual("EmbeddedMessageSetElement", file_options.mset.Extensions[
|
340
|
+
unittest_custom_options_pb2.AggregateMessageSetElement
|
341
|
+
.message_set_extension].s)
|
342
|
+
|
343
|
+
# Simple tests for all the other types of annotations
|
344
|
+
self.assertEqual(
|
345
|
+
"MessageAnnotation",
|
346
|
+
message_descriptor.GetOptions().Extensions[
|
347
|
+
unittest_custom_options_pb2.msgopt].s)
|
348
|
+
self.assertEqual(
|
349
|
+
"FieldAnnotation",
|
350
|
+
field_descriptor.GetOptions().Extensions[
|
351
|
+
unittest_custom_options_pb2.fieldopt].s)
|
352
|
+
self.assertEqual(
|
353
|
+
"EnumAnnotation",
|
354
|
+
enum_descriptor.GetOptions().Extensions[
|
355
|
+
unittest_custom_options_pb2.enumopt].s)
|
356
|
+
self.assertEqual(
|
357
|
+
"EnumValueAnnotation",
|
358
|
+
enum_value_descriptor.GetOptions().Extensions[
|
359
|
+
unittest_custom_options_pb2.enumvalopt].s)
|
360
|
+
self.assertEqual(
|
361
|
+
"ServiceAnnotation",
|
362
|
+
service_descriptor.GetOptions().Extensions[
|
363
|
+
unittest_custom_options_pb2.serviceopt].s)
|
364
|
+
self.assertEqual(
|
365
|
+
"MethodAnnotation",
|
366
|
+
method_descriptor.GetOptions().Extensions[
|
367
|
+
unittest_custom_options_pb2.methodopt].s)
|
368
|
+
|
369
|
+
def testNestedOptions(self):
|
370
|
+
nested_message =\
|
371
|
+
unittest_custom_options_pb2.NestedOptionType.NestedMessage.DESCRIPTOR
|
372
|
+
self.assertEqual(1001, nested_message.GetOptions().Extensions[
|
373
|
+
unittest_custom_options_pb2.message_opt1])
|
374
|
+
nested_field = nested_message.fields_by_name["nested_field"]
|
375
|
+
self.assertEqual(1002, nested_field.GetOptions().Extensions[
|
376
|
+
unittest_custom_options_pb2.field_opt1])
|
377
|
+
outer_message =\
|
378
|
+
unittest_custom_options_pb2.NestedOptionType.DESCRIPTOR
|
379
|
+
nested_enum = outer_message.enum_types_by_name["NestedEnum"]
|
380
|
+
self.assertEqual(1003, nested_enum.GetOptions().Extensions[
|
381
|
+
unittest_custom_options_pb2.enum_opt1])
|
382
|
+
nested_enum_value = outer_message.enum_values_by_name["NESTED_ENUM_VALUE"]
|
383
|
+
self.assertEqual(1004, nested_enum_value.GetOptions().Extensions[
|
384
|
+
unittest_custom_options_pb2.enum_value_opt1])
|
385
|
+
nested_extension = outer_message.extensions_by_name["nested_extension"]
|
386
|
+
self.assertEqual(1005, nested_extension.GetOptions().Extensions[
|
387
|
+
unittest_custom_options_pb2.field_opt2])
|
388
|
+
|
389
|
+
def testFileDescriptorReferences(self):
|
390
|
+
self.assertEqual(self.my_enum.file, self.my_file)
|
391
|
+
self.assertEqual(self.my_message.file, self.my_file)
|
392
|
+
|
393
|
+
def testFileDescriptor(self):
|
394
|
+
self.assertEqual(self.my_file.name, 'some/filename/some.proto')
|
395
|
+
self.assertEqual(self.my_file.package, 'protobuf_unittest')
|
396
|
+
|
397
|
+
|
398
|
+
class DescriptorCopyToProtoTest(basetest.TestCase):
|
399
|
+
"""Tests for CopyTo functions of Descriptor."""
|
400
|
+
|
401
|
+
def _AssertProtoEqual(self, actual_proto, expected_class, expected_ascii):
|
402
|
+
expected_proto = expected_class()
|
403
|
+
text_format.Merge(expected_ascii, expected_proto)
|
404
|
+
|
405
|
+
self.assertEqual(
|
406
|
+
actual_proto, expected_proto,
|
407
|
+
'Not equal,\nActual:\n%s\nExpected:\n%s\n'
|
408
|
+
% (str(actual_proto), str(expected_proto)))
|
409
|
+
|
410
|
+
def _InternalTestCopyToProto(self, desc, expected_proto_class,
|
411
|
+
expected_proto_ascii):
|
412
|
+
actual = expected_proto_class()
|
413
|
+
desc.CopyToProto(actual)
|
414
|
+
self._AssertProtoEqual(
|
415
|
+
actual, expected_proto_class, expected_proto_ascii)
|
416
|
+
|
417
|
+
def testCopyToProto_EmptyMessage(self):
|
418
|
+
self._InternalTestCopyToProto(
|
419
|
+
unittest_pb2.TestEmptyMessage.DESCRIPTOR,
|
420
|
+
descriptor_pb2.DescriptorProto,
|
421
|
+
TEST_EMPTY_MESSAGE_DESCRIPTOR_ASCII)
|
422
|
+
|
423
|
+
def testCopyToProto_NestedMessage(self):
|
424
|
+
TEST_NESTED_MESSAGE_ASCII = """
|
425
|
+
name: 'NestedMessage'
|
426
|
+
field: <
|
427
|
+
name: 'bb'
|
428
|
+
number: 1
|
429
|
+
label: 1 # Optional
|
430
|
+
type: 5 # TYPE_INT32
|
431
|
+
>
|
432
|
+
"""
|
433
|
+
|
434
|
+
self._InternalTestCopyToProto(
|
435
|
+
unittest_pb2.TestAllTypes.NestedMessage.DESCRIPTOR,
|
436
|
+
descriptor_pb2.DescriptorProto,
|
437
|
+
TEST_NESTED_MESSAGE_ASCII)
|
438
|
+
|
439
|
+
def testCopyToProto_ForeignNestedMessage(self):
|
440
|
+
TEST_FOREIGN_NESTED_ASCII = """
|
441
|
+
name: 'TestForeignNested'
|
442
|
+
field: <
|
443
|
+
name: 'foreign_nested'
|
444
|
+
number: 1
|
445
|
+
label: 1 # Optional
|
446
|
+
type: 11 # TYPE_MESSAGE
|
447
|
+
type_name: '.protobuf_unittest.TestAllTypes.NestedMessage'
|
448
|
+
>
|
449
|
+
"""
|
450
|
+
|
451
|
+
self._InternalTestCopyToProto(
|
452
|
+
unittest_pb2.TestForeignNested.DESCRIPTOR,
|
453
|
+
descriptor_pb2.DescriptorProto,
|
454
|
+
TEST_FOREIGN_NESTED_ASCII)
|
455
|
+
|
456
|
+
def testCopyToProto_ForeignEnum(self):
|
457
|
+
TEST_FOREIGN_ENUM_ASCII = """
|
458
|
+
name: 'ForeignEnum'
|
459
|
+
value: <
|
460
|
+
name: 'FOREIGN_FOO'
|
461
|
+
number: 4
|
462
|
+
>
|
463
|
+
value: <
|
464
|
+
name: 'FOREIGN_BAR'
|
465
|
+
number: 5
|
466
|
+
>
|
467
|
+
value: <
|
468
|
+
name: 'FOREIGN_BAZ'
|
469
|
+
number: 6
|
470
|
+
>
|
471
|
+
"""
|
472
|
+
|
473
|
+
self._InternalTestCopyToProto(
|
474
|
+
unittest_pb2._FOREIGNENUM,
|
475
|
+
descriptor_pb2.EnumDescriptorProto,
|
476
|
+
TEST_FOREIGN_ENUM_ASCII)
|
477
|
+
|
478
|
+
def testCopyToProto_Options(self):
|
479
|
+
TEST_DEPRECATED_FIELDS_ASCII = """
|
480
|
+
name: 'TestDeprecatedFields'
|
481
|
+
field: <
|
482
|
+
name: 'deprecated_int32'
|
483
|
+
number: 1
|
484
|
+
label: 1 # Optional
|
485
|
+
type: 5 # TYPE_INT32
|
486
|
+
options: <
|
487
|
+
deprecated: true
|
488
|
+
>
|
489
|
+
>
|
490
|
+
"""
|
491
|
+
|
492
|
+
self._InternalTestCopyToProto(
|
493
|
+
unittest_pb2.TestDeprecatedFields.DESCRIPTOR,
|
494
|
+
descriptor_pb2.DescriptorProto,
|
495
|
+
TEST_DEPRECATED_FIELDS_ASCII)
|
496
|
+
|
497
|
+
def testCopyToProto_AllExtensions(self):
|
498
|
+
TEST_EMPTY_MESSAGE_WITH_EXTENSIONS_ASCII = """
|
499
|
+
name: 'TestEmptyMessageWithExtensions'
|
500
|
+
extension_range: <
|
501
|
+
start: 1
|
502
|
+
end: 536870912
|
503
|
+
>
|
504
|
+
"""
|
505
|
+
|
506
|
+
self._InternalTestCopyToProto(
|
507
|
+
unittest_pb2.TestEmptyMessageWithExtensions.DESCRIPTOR,
|
508
|
+
descriptor_pb2.DescriptorProto,
|
509
|
+
TEST_EMPTY_MESSAGE_WITH_EXTENSIONS_ASCII)
|
510
|
+
|
511
|
+
def testCopyToProto_SeveralExtensions(self):
|
512
|
+
TEST_MESSAGE_WITH_SEVERAL_EXTENSIONS_ASCII = """
|
513
|
+
name: 'TestMultipleExtensionRanges'
|
514
|
+
extension_range: <
|
515
|
+
start: 42
|
516
|
+
end: 43
|
517
|
+
>
|
518
|
+
extension_range: <
|
519
|
+
start: 4143
|
520
|
+
end: 4244
|
521
|
+
>
|
522
|
+
extension_range: <
|
523
|
+
start: 65536
|
524
|
+
end: 536870912
|
525
|
+
>
|
526
|
+
"""
|
527
|
+
|
528
|
+
self._InternalTestCopyToProto(
|
529
|
+
unittest_pb2.TestMultipleExtensionRanges.DESCRIPTOR,
|
530
|
+
descriptor_pb2.DescriptorProto,
|
531
|
+
TEST_MESSAGE_WITH_SEVERAL_EXTENSIONS_ASCII)
|
532
|
+
|
533
|
+
# Disable this test so we can make changes to the proto file.
|
534
|
+
# TODO(xiaofeng): Enable this test after cl/55530659 is submitted.
|
535
|
+
#
|
536
|
+
# def testCopyToProto_FileDescriptor(self):
|
537
|
+
# UNITTEST_IMPORT_FILE_DESCRIPTOR_ASCII = ("""
|
538
|
+
# name: 'google/protobuf/unittest_import.proto'
|
539
|
+
# package: 'protobuf_unittest_import'
|
540
|
+
# dependency: 'google/protobuf/unittest_import_public.proto'
|
541
|
+
# message_type: <
|
542
|
+
# name: 'ImportMessage'
|
543
|
+
# field: <
|
544
|
+
# name: 'd'
|
545
|
+
# number: 1
|
546
|
+
# label: 1 # Optional
|
547
|
+
# type: 5 # TYPE_INT32
|
548
|
+
# >
|
549
|
+
# >
|
550
|
+
# """ +
|
551
|
+
# """enum_type: <
|
552
|
+
# name: 'ImportEnum'
|
553
|
+
# value: <
|
554
|
+
# name: 'IMPORT_FOO'
|
555
|
+
# number: 7
|
556
|
+
# >
|
557
|
+
# value: <
|
558
|
+
# name: 'IMPORT_BAR'
|
559
|
+
# number: 8
|
560
|
+
# >
|
561
|
+
# value: <
|
562
|
+
# name: 'IMPORT_BAZ'
|
563
|
+
# number: 9
|
564
|
+
# >
|
565
|
+
# >
|
566
|
+
# options: <
|
567
|
+
# java_package: 'com.google.protobuf.test'
|
568
|
+
# optimize_for: 1 # SPEED
|
569
|
+
# >
|
570
|
+
# public_dependency: 0
|
571
|
+
# """)
|
572
|
+
# self._InternalTestCopyToProto(
|
573
|
+
# unittest_import_pb2.DESCRIPTOR,
|
574
|
+
# descriptor_pb2.FileDescriptorProto,
|
575
|
+
# UNITTEST_IMPORT_FILE_DESCRIPTOR_ASCII)
|
576
|
+
|
577
|
+
def testCopyToProto_ServiceDescriptor(self):
|
578
|
+
TEST_SERVICE_ASCII = """
|
579
|
+
name: 'TestService'
|
580
|
+
method: <
|
581
|
+
name: 'Foo'
|
582
|
+
input_type: '.protobuf_unittest.FooRequest'
|
583
|
+
output_type: '.protobuf_unittest.FooResponse'
|
584
|
+
>
|
585
|
+
method: <
|
586
|
+
name: 'Bar'
|
587
|
+
input_type: '.protobuf_unittest.BarRequest'
|
588
|
+
output_type: '.protobuf_unittest.BarResponse'
|
589
|
+
>
|
590
|
+
"""
|
591
|
+
self._InternalTestCopyToProto(
|
592
|
+
unittest_pb2.TestService.DESCRIPTOR,
|
593
|
+
descriptor_pb2.ServiceDescriptorProto,
|
594
|
+
TEST_SERVICE_ASCII)
|
595
|
+
|
596
|
+
|
597
|
+
class MakeDescriptorTest(basetest.TestCase):
|
598
|
+
|
599
|
+
def testMakeDescriptorWithNestedFields(self):
|
600
|
+
file_descriptor_proto = descriptor_pb2.FileDescriptorProto()
|
601
|
+
file_descriptor_proto.name = 'Foo2'
|
602
|
+
message_type = file_descriptor_proto.message_type.add()
|
603
|
+
message_type.name = file_descriptor_proto.name
|
604
|
+
nested_type = message_type.nested_type.add()
|
605
|
+
nested_type.name = 'Sub'
|
606
|
+
enum_type = nested_type.enum_type.add()
|
607
|
+
enum_type.name = 'FOO'
|
608
|
+
enum_type_val = enum_type.value.add()
|
609
|
+
enum_type_val.name = 'BAR'
|
610
|
+
enum_type_val.number = 3
|
611
|
+
field = message_type.field.add()
|
612
|
+
field.number = 1
|
613
|
+
field.name = 'uint64_field'
|
614
|
+
field.label = descriptor.FieldDescriptor.LABEL_REQUIRED
|
615
|
+
field.type = descriptor.FieldDescriptor.TYPE_UINT64
|
616
|
+
field = message_type.field.add()
|
617
|
+
field.number = 2
|
618
|
+
field.name = 'nested_message_field'
|
619
|
+
field.label = descriptor.FieldDescriptor.LABEL_REQUIRED
|
620
|
+
field.type = descriptor.FieldDescriptor.TYPE_MESSAGE
|
621
|
+
field.type_name = 'Sub'
|
622
|
+
enum_field = nested_type.field.add()
|
623
|
+
enum_field.number = 2
|
624
|
+
enum_field.name = 'bar_field'
|
625
|
+
enum_field.label = descriptor.FieldDescriptor.LABEL_REQUIRED
|
626
|
+
enum_field.type = descriptor.FieldDescriptor.TYPE_ENUM
|
627
|
+
enum_field.type_name = 'Foo2.Sub.FOO'
|
628
|
+
|
629
|
+
result = descriptor.MakeDescriptor(message_type)
|
630
|
+
self.assertEqual(result.fields[0].cpp_type,
|
631
|
+
descriptor.FieldDescriptor.CPPTYPE_UINT64)
|
632
|
+
self.assertEqual(result.fields[1].cpp_type,
|
633
|
+
descriptor.FieldDescriptor.CPPTYPE_MESSAGE)
|
634
|
+
self.assertEqual(result.fields[1].message_type.containing_type,
|
635
|
+
result)
|
636
|
+
self.assertEqual(result.nested_types[0].fields[0].full_name,
|
637
|
+
'Foo2.Sub.bar_field')
|
638
|
+
self.assertEqual(result.nested_types[0].fields[0].enum_type,
|
639
|
+
result.nested_types[0].enum_types[0])
|
640
|
+
|
641
|
+
def testMakeDescriptorWithUnsignedIntField(self):
|
642
|
+
file_descriptor_proto = descriptor_pb2.FileDescriptorProto()
|
643
|
+
file_descriptor_proto.name = 'Foo'
|
644
|
+
message_type = file_descriptor_proto.message_type.add()
|
645
|
+
message_type.name = file_descriptor_proto.name
|
646
|
+
enum_type = message_type.enum_type.add()
|
647
|
+
enum_type.name = 'FOO'
|
648
|
+
enum_type_val = enum_type.value.add()
|
649
|
+
enum_type_val.name = 'BAR'
|
650
|
+
enum_type_val.number = 3
|
651
|
+
field = message_type.field.add()
|
652
|
+
field.number = 1
|
653
|
+
field.name = 'uint64_field'
|
654
|
+
field.label = descriptor.FieldDescriptor.LABEL_REQUIRED
|
655
|
+
field.type = descriptor.FieldDescriptor.TYPE_UINT64
|
656
|
+
enum_field = message_type.field.add()
|
657
|
+
enum_field.number = 2
|
658
|
+
enum_field.name = 'bar_field'
|
659
|
+
enum_field.label = descriptor.FieldDescriptor.LABEL_REQUIRED
|
660
|
+
enum_field.type = descriptor.FieldDescriptor.TYPE_ENUM
|
661
|
+
enum_field.type_name = 'Foo.FOO'
|
662
|
+
|
663
|
+
result = descriptor.MakeDescriptor(message_type)
|
664
|
+
self.assertEqual(result.fields[0].cpp_type,
|
665
|
+
descriptor.FieldDescriptor.CPPTYPE_UINT64)
|
666
|
+
|
667
|
+
|
668
|
+
if __name__ == '__main__':
|
669
|
+
basetest.main()
|