[ObjC] Test file cleanups

- Remove some types not needed.
- Remove some files not needed.
- Move some tests files into different prefixes to logically segment things.
- Add objc_class_prefix to the files.
- Use an expected prefix file during generation to exercise that code and
  validate things.
- Require prefixes for the test file.
pull/10488/head
Thomas Van Lenten 2 years ago
parent d220b43c6c
commit 5cf61b7e47
  1. 13
      objectivec/DevTools/compile_testing_protos.sh
  2. 4
      objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj
  3. 4
      objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj
  4. 4
      objectivec/ProtocolBuffers_tvOS.xcodeproj/project.pbxproj
  5. 1
      objectivec/Tests/GPBARCUnittestProtos.m
  6. 2
      objectivec/Tests/GPBUnittestProtos.m
  7. 18
      objectivec/Tests/GPBWellKnownTypesTest.m
  8. 59
      objectivec/Tests/GPBWireFormatTests.m
  9. 6
      objectivec/Tests/any_test.proto
  10. 12
      objectivec/Tests/expected_prefixes.txt
  11. 8
      objectivec/Tests/map_proto2_unittest.proto
  12. 6
      objectivec/Tests/map_unittest.proto
  13. 36
      objectivec/Tests/unittest.proto
  14. 28
      objectivec/Tests/unittest_cycle.proto
  15. 14
      objectivec/Tests/unittest_extension_chain_a.proto
  16. 10
      objectivec/Tests/unittest_extension_chain_b.proto
  17. 8
      objectivec/Tests/unittest_extension_chain_c.proto
  18. 12
      objectivec/Tests/unittest_extension_chain_d.proto
  19. 6
      objectivec/Tests/unittest_extension_chain_e.proto
  20. 8
      objectivec/Tests/unittest_extension_chain_f.proto
  21. 8
      objectivec/Tests/unittest_extension_chain_g.proto
  22. 12
      objectivec/Tests/unittest_import.proto
  23. 6
      objectivec/Tests/unittest_import_public.proto
  24. 41
      objectivec/Tests/unittest_import_public_lite.proto
  25. 60
      objectivec/Tests/unittest_mset.proto
  26. 48
      objectivec/Tests/unittest_mset_wire_format.proto
  27. 3
      objectivec/Tests/unittest_objc.proto
  28. 9
      objectivec/Tests/unittest_objc_startup.proto
  29. 3
      objectivec/Tests/unittest_runtime_proto2.proto
  30. 3
      objectivec/Tests/unittest_runtime_proto3.proto

@ -42,10 +42,8 @@ OBJC_TEST_PROTO_FILES=(
objectivec/Tests/unittest_extension_chain_e.proto
objectivec/Tests/unittest_extension_chain_f.proto
objectivec/Tests/unittest_extension_chain_g.proto
objectivec/Tests/unittest_import_public_lite.proto
objectivec/Tests/unittest_import_public.proto
objectivec/Tests/unittest_import.proto
objectivec/Tests/unittest_mset_wire_format.proto
objectivec/Tests/unittest_mset.proto
objectivec/Tests/unittest_objc_options.proto
objectivec/Tests/unittest_objc_startup.proto
@ -128,8 +126,11 @@ find "${OUTPUT_DIR}" \
# -----------------------------------------------------------------------------
# Generate the Objective C specific testing protos.
"${PROTOC}" \
--objc_out="${OUTPUT_DIR}" \
--proto_path=. \
--proto_path=src \
"${PROTOC}" \
--objc_out="${OUTPUT_DIR}" \
--objc_opt=expected_prefixes_path=objectivec/Tests/expected_prefixes.txt \
--objc_opt=prefixes_must_be_registered=yes \
--objc_opt=require_prefixes=yes \
--proto_path=. \
--proto_path=src \
"${OBJC_TEST_PROTO_FILES[@]}"

@ -218,9 +218,7 @@
F44FEABE28B5465900EC57B3 /* unittest_deprecated_file.proto */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.protobuf; path = unittest_deprecated_file.proto; sourceTree = "<group>"; };
F44FEABF28B5465900EC57B3 /* unittest_mset.proto */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.protobuf; path = unittest_mset.proto; sourceTree = "<group>"; };
F44FEAC028B5465900EC57B3 /* unittest_import.proto */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.protobuf; path = unittest_import.proto; sourceTree = "<group>"; };
F44FEAC128B5465900EC57B3 /* unittest_mset_wire_format.proto */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.protobuf; path = unittest_mset_wire_format.proto; sourceTree = "<group>"; };
F44FEAC228B5465900EC57B3 /* unittest.proto */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.protobuf; path = unittest.proto; sourceTree = "<group>"; };
F44FEAC328B5465900EC57B3 /* unittest_import_public_lite.proto */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.protobuf; path = unittest_import_public_lite.proto; sourceTree = "<group>"; };
F44FEAC428B5465900EC57B3 /* unittest_preserve_unknown_enum.proto */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.protobuf; path = unittest_preserve_unknown_enum.proto; sourceTree = "<group>"; };
F44FEAC528B5465900EC57B3 /* any_test.proto */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.protobuf; path = any_test.proto; sourceTree = "<group>"; };
F44FEAC628B5465900EC57B3 /* unittest_import_public.proto */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.protobuf; path = unittest_import_public.proto; sourceTree = "<group>"; };
@ -519,10 +517,8 @@
F44FEAC928B5465900EC57B3 /* unittest_extension_chain_e.proto */,
F44FEAD028B5465A00EC57B3 /* unittest_extension_chain_f.proto */,
F44FEAC828B5465900EC57B3 /* unittest_extension_chain_g.proto */,
F44FEAC328B5465900EC57B3 /* unittest_import_public_lite.proto */,
F44FEAC628B5465900EC57B3 /* unittest_import_public.proto */,
F44FEAC028B5465900EC57B3 /* unittest_import.proto */,
F44FEAC128B5465900EC57B3 /* unittest_mset_wire_format.proto */,
F44FEABF28B5465900EC57B3 /* unittest_mset.proto */,
8B35468421A616F6000BD30D /* unittest_objc_options.proto */,
F4CF31701B162ED800BD9B06 /* unittest_objc_startup.proto */,

@ -226,8 +226,6 @@
F44FEAD628B546E300EC57B3 /* unittest_deprecated.proto */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.protobuf; path = unittest_deprecated.proto; sourceTree = "<group>"; };
F44FEAD728B546E300EC57B3 /* any_test.proto */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.protobuf; path = any_test.proto; sourceTree = "<group>"; };
F44FEAD828B546E300EC57B3 /* unittest_extension_chain_b.proto */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.protobuf; path = unittest_extension_chain_b.proto; sourceTree = "<group>"; };
F44FEAD928B546E300EC57B3 /* unittest_import_public_lite.proto */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.protobuf; path = unittest_import_public_lite.proto; sourceTree = "<group>"; };
F44FEADA28B546E300EC57B3 /* unittest_mset_wire_format.proto */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.protobuf; path = unittest_mset_wire_format.proto; sourceTree = "<group>"; };
F44FEADB28B546E300EC57B3 /* unittest_import.proto */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.protobuf; path = unittest_import.proto; sourceTree = "<group>"; };
F44FEADC28B546E300EC57B3 /* unittest_mset.proto */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.protobuf; path = unittest_mset.proto; sourceTree = "<group>"; };
F44FEADD28B546E300EC57B3 /* unittest.proto */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.protobuf; path = unittest.proto; sourceTree = "<group>"; };
@ -525,10 +523,8 @@
F44FEAE328B546E300EC57B3 /* unittest_extension_chain_e.proto */,
F44FEADE28B546E300EC57B3 /* unittest_extension_chain_f.proto */,
F44FEAE128B546E300EC57B3 /* unittest_extension_chain_g.proto */,
F44FEAD928B546E300EC57B3 /* unittest_import_public_lite.proto */,
F44FEAE028B546E300EC57B3 /* unittest_import_public.proto */,
F44FEADB28B546E300EC57B3 /* unittest_import.proto */,
F44FEADA28B546E300EC57B3 /* unittest_mset_wire_format.proto */,
F44FEADC28B546E300EC57B3 /* unittest_mset.proto */,
8B35468621A61EB2000BD30D /* unittest_objc_options.proto */,
F4CF31711B162EF500BD9B06 /* unittest_objc_startup.proto */,

@ -218,9 +218,7 @@
F4487C801AAF62FC00531423 /* GPBMessageTests+Serialization.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GPBMessageTests+Serialization.m"; sourceTree = "<group>"; };
F4487C841AAF6AC500531423 /* GPBMessageTests+Merge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GPBMessageTests+Merge.m"; sourceTree = "<group>"; };
F44929021C866B3B00C2548A /* GPBCodedOutputStream_PackagePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPBCodedOutputStream_PackagePrivate.h; sourceTree = "<group>"; };
F44FEAE428B5471300EC57B3 /* unittest_import_public_lite.proto */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.protobuf; path = unittest_import_public_lite.proto; sourceTree = "<group>"; };
F44FEAE528B5471300EC57B3 /* unittest_extension_chain_a.proto */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.protobuf; path = unittest_extension_chain_a.proto; sourceTree = "<group>"; };
F44FEAE628B5471300EC57B3 /* unittest_mset_wire_format.proto */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.protobuf; path = unittest_mset_wire_format.proto; sourceTree = "<group>"; };
F44FEAE728B5471300EC57B3 /* unittest_extension_chain_c.proto */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.protobuf; path = unittest_extension_chain_c.proto; sourceTree = "<group>"; };
F44FEAE828B5471300EC57B3 /* unittest_extension_chain_g.proto */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.protobuf; path = unittest_extension_chain_g.proto; sourceTree = "<group>"; };
F44FEAE928B5471300EC57B3 /* unittest_import.proto */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.protobuf; path = unittest_import.proto; sourceTree = "<group>"; };
@ -525,10 +523,8 @@
F44FEAF428B5471300EC57B3 /* unittest_extension_chain_e.proto */,
F44FEAEC28B5471300EC57B3 /* unittest_extension_chain_f.proto */,
F44FEAE828B5471300EC57B3 /* unittest_extension_chain_g.proto */,
F44FEAE428B5471300EC57B3 /* unittest_import_public_lite.proto */,
F44FEAEB28B5471300EC57B3 /* unittest_import_public.proto */,
F44FEAE928B5471300EC57B3 /* unittest_import.proto */,
F44FEAE628B5471300EC57B3 /* unittest_mset_wire_format.proto */,
F44FEAF128B5471300EC57B3 /* unittest_mset.proto */,
8B35468621A61EB2000BD30D /* unittest_objc_options.proto */,
F4CF31711B162EF500BD9B06 /* unittest_objc_startup.proto */,

@ -40,7 +40,6 @@
#import "objectivec/Tests/UnittestDeprecatedFile.pbobjc.h"
#import "objectivec/Tests/UnittestImport.pbobjc.h"
#import "objectivec/Tests/UnittestImportPublic.pbobjc.h"
#import "objectivec/Tests/UnittestImportPublicLite.pbobjc.h"
#import "objectivec/Tests/UnittestMset.pbobjc.h"
#import "objectivec/Tests/UnittestObjc.pbobjc.h"
#import "objectivec/Tests/UnittestObjcOptions.pbobjc.h"

@ -40,9 +40,7 @@
#import "objectivec/Tests/UnittestDeprecatedFile.pbobjc.m"
#import "objectivec/Tests/UnittestImport.pbobjc.m"
#import "objectivec/Tests/UnittestImportPublic.pbobjc.m"
#import "objectivec/Tests/UnittestImportPublicLite.pbobjc.m"
#import "objectivec/Tests/UnittestMset.pbobjc.m"
#import "objectivec/Tests/UnittestMsetWireFormat.pbobjc.m"
#import "objectivec/Tests/UnittestObjc.pbobjc.m"
#import "objectivec/Tests/UnittestObjcOptions.pbobjc.m"
#import "objectivec/Tests/UnittestObjcStartup.pbobjc.m"

@ -161,9 +161,9 @@ static const NSTimeInterval kTimeAccuracy = 1e-9;
// Set and extract covers most of the code.
TestAny *subMessage = [TestAny message];
AnyTestMessage *subMessage = [AnyTestMessage message];
subMessage.int32Value = 12345;
TestAny *message = [TestAny message];
AnyTestMessage *message = [AnyTestMessage message];
NSError *err = nil;
message.anyValue = [GPBAny anyWithMessage:subMessage error:&err];
XCTAssertNil(err);
@ -171,14 +171,14 @@ static const NSTimeInterval kTimeAccuracy = 1e-9;
NSData *data = message.data;
XCTAssertNotNil(data);
TestAny *message2 = [TestAny parseFromData:data error:&err];
AnyTestMessage *message2 = [AnyTestMessage parseFromData:data error:&err];
XCTAssertNil(err);
XCTAssertNotNil(message2);
XCTAssertTrue(message2.hasAnyValue);
TestAny *subMessage2 =
(TestAny *)[message.anyValue unpackMessageClass:[TestAny class]
error:&err];
AnyTestMessage *subMessage2 =
(AnyTestMessage *)[message.anyValue unpackMessageClass:[AnyTestMessage class]
error:&err];
XCTAssertNil(err);
XCTAssertNotNil(subMessage2);
XCTAssertEqual(subMessage2.int32Value, 12345);
@ -189,9 +189,9 @@ static const NSTimeInterval kTimeAccuracy = 1e-9;
NSData *data2 = message.data;
XCTAssertEqualObjects(data2, data);
TestAny *subMessage3 =
(TestAny *)[message.anyValue unpackMessageClass:[TestAny class]
error:NULL];
AnyTestMessage *subMessage3 =
(AnyTestMessage *)[message.anyValue unpackMessageClass:[AnyTestMessage class]
error:NULL];
XCTAssertNotNil(subMessage3);
XCTAssertEqualObjects(subMessage2, subMessage3);

@ -35,7 +35,6 @@
#import "GPBUnknownField_PackagePrivate.h"
#import "objectivec/Tests/Unittest.pbobjc.h"
#import "objectivec/Tests/UnittestMset.pbobjc.h"
#import "objectivec/Tests/UnittestMsetWireFormat.pbobjc.h"
@interface WireFormatTests : GPBTestCase
@end
@ -144,11 +143,11 @@
const int kUnknownTypeId = 1550055;
- (void)testSerializeMessageSet {
// Set up a TestMessageSet with two known messages and an unknown one.
TestMessageSet* message_set = [TestMessageSet message];
[[message_set getExtension:[TestMessageSetExtension1 messageSetExtension]]
// Set up a MSetMessage with two known messages and an unknown one.
MSetMessage* message_set = [MSetMessage message];
[[message_set getExtension:[MSetMessageExtension1 messageSetExtension]]
setI:123];
[[message_set getExtension:[TestMessageSetExtension2 messageSetExtension]]
[[message_set getExtension:[MSetMessageExtension2 messageSetExtension]]
setStr:@"foo"];
GPBUnknownField* unknownField =
[[[GPBUnknownField alloc] initWithNumber:kUnknownTypeId] autorelease];
@ -160,26 +159,26 @@ const int kUnknownTypeId = 1550055;
NSData* data = [message_set data];
// Parse back using RawMessageSet and check the contents.
RawMessageSet* raw = [RawMessageSet parseFromData:data error:NULL];
// Parse back using MSetRawMessageSet and check the contents.
MSetRawMessageSet* raw = [MSetRawMessageSet parseFromData:data error:NULL];
XCTAssertEqual([raw.unknownFields countOfFields], (NSUInteger)0);
XCTAssertEqual(raw.itemArray.count, (NSUInteger)3);
XCTAssertEqual((uint32_t)[raw.itemArray[0] typeId],
[TestMessageSetExtension1 messageSetExtension].fieldNumber);
[MSetMessageExtension1 messageSetExtension].fieldNumber);
XCTAssertEqual((uint32_t)[raw.itemArray[1] typeId],
[TestMessageSetExtension2 messageSetExtension].fieldNumber);
[MSetMessageExtension2 messageSetExtension].fieldNumber);
XCTAssertEqual([raw.itemArray[2] typeId], kUnknownTypeId);
TestMessageSetExtension1* message1 =
[TestMessageSetExtension1 parseFromData:[((RawMessageSet_Item*)raw.itemArray[0]) message]
error:NULL];
MSetMessageExtension1* message1 =
[MSetMessageExtension1 parseFromData:[((MSetRawMessageSet_Item*)raw.itemArray[0]) message]
error:NULL];
XCTAssertEqual(message1.i, 123);
TestMessageSetExtension2* message2 =
[TestMessageSetExtension2 parseFromData:[((RawMessageSet_Item*)raw.itemArray[1]) message]
error:NULL];
MSetMessageExtension2* message2 =
[MSetMessageExtension2 parseFromData:[((MSetRawMessageSet_Item*)raw.itemArray[1]) message]
error:NULL];
XCTAssertEqualObjects(message2.str, @"foo");
XCTAssertEqualObjects([raw.itemArray[2] message],
@ -187,29 +186,29 @@ const int kUnknownTypeId = 1550055;
}
- (void)testParseMessageSet {
// Set up a RawMessageSet with two known messages and an unknown one.
RawMessageSet* raw = [RawMessageSet message];
// Set up a MSetRawMessageSet with two known messages and an unknown one.
MSetRawMessageSet* raw = [MSetRawMessageSet message];
{
RawMessageSet_Item* item = [RawMessageSet_Item message];
item.typeId = [TestMessageSetExtension1 messageSetExtension].fieldNumber;
TestMessageSetExtension1* message = [TestMessageSetExtension1 message];
MSetRawMessageSet_Item* item = [MSetRawMessageSet_Item message];
item.typeId = [MSetMessageExtension1 messageSetExtension].fieldNumber;
MSetMessageExtension1* message = [MSetMessageExtension1 message];
message.i = 123;
item.message = [message data];
[raw.itemArray addObject:item];
}
{
RawMessageSet_Item* item = [RawMessageSet_Item message];
item.typeId = [TestMessageSetExtension2 messageSetExtension].fieldNumber;
TestMessageSetExtension2* message = [TestMessageSetExtension2 message];
MSetRawMessageSet_Item* item = [MSetRawMessageSet_Item message];
item.typeId = [MSetMessageExtension2 messageSetExtension].fieldNumber;
MSetMessageExtension2* message = [MSetMessageExtension2 message];
message.str = @"foo";
item.message = [message data];
[raw.itemArray addObject:item];
}
{
RawMessageSet_Item* item = [RawMessageSet_Item message];
MSetRawMessageSet_Item* item = [MSetRawMessageSet_Item message];
item.typeId = kUnknownTypeId;
item.message = [NSData dataWithBytes:"bar" length:3];
[raw.itemArray addObject:item];
@ -217,19 +216,19 @@ const int kUnknownTypeId = 1550055;
NSData* data = [raw data];
// Parse as a TestMessageSet and check the contents.
TestMessageSet* messageSet =
[TestMessageSet parseFromData:data
extensionRegistry:[UnittestMsetRoot extensionRegistry]
// Parse as a MSetMessage and check the contents.
MSetMessage* messageSet =
[MSetMessage parseFromData:data
extensionRegistry:[MSetUnittestMsetRoot extensionRegistry]
error:NULL];
XCTAssertEqual(
[[messageSet
getExtension:[TestMessageSetExtension1 messageSetExtension]] i],
getExtension:[MSetMessageExtension1 messageSetExtension]] i],
123);
XCTAssertEqualObjects(
[[messageSet
getExtension:[TestMessageSetExtension2 messageSetExtension]] str],
getExtension:[MSetMessageExtension2 messageSetExtension]] str],
@"foo");
XCTAssertEqual([messageSet.unknownFields countOfFields], (NSUInteger)1);

@ -30,11 +30,13 @@
syntax = "proto3";
package objc.protobuf.tests;
package objc.protobuf.tests.any;
import "google/protobuf/any.proto";
message TestAny {
option objc_class_prefix = "Any";
message TestMessage {
int32 int32_value = 1;
google.protobuf.Any any_value = 2;
repeated google.protobuf.Any repeated_any_value = 3;

@ -0,0 +1,12 @@
objc.protobuf.tests = "" # Explicit empty prefix
objc.protobuf.tests.any = Any
objc.protobuf.tests.chain = Chain
objc.protobuf.tests.cycle = Cycle
objc.protobuf.tests.deprecated = Dep
objc.protobuf.tests.deprecated_file = FileDep
objc.protobuf.tests.import = Import
objc.protobuf.tests.mset = MSet
objc.protobuf.tests.options = GPBTEST
objc.protobuf.tests.proto3_preserve_unknown_enum = UnknownEnums
objc.protobuf.tests.public_import = PublicImport
objc.protobuf.tests.startup = TestObjCStartup

@ -32,11 +32,11 @@ syntax = "proto2";
import "objectivec/Tests/unittest_import.proto";
// We don't put this in a package within proto2 because we need to make sure
// that the generated code doesn't depend on being in the proto2 namespace.
// In map_test_util.h we do "using namespace unittest = objc.protobuf.tests".
package objc.protobuf.tests;
// Explicit empty prefix, tests some validations code paths also.
option objc_class_prefix = "";
enum Proto2MapEnum {
PROTO2_MAP_ENUM_FOO = 0;
PROTO2_MAP_ENUM_BAR = 1;
@ -61,7 +61,7 @@ message TestEnumMapPlusExtra {
}
message TestImportEnumMap {
map<int32, objc.protobuf.tests.import.ImportEnumForMap> import_enum_amp = 1;
map<int32, objc.protobuf.tests.import.EnumForMap> import_enum_amp = 1;
}
message TestIntIntMap {

@ -32,11 +32,11 @@ syntax = "proto3";
import "objectivec/Tests/unittest.proto";
// We don't put this in a package within proto2 because we need to make sure
// that the generated code doesn't depend on being in the proto2 namespace.
// In map_test_util.h we do "using namespace unittest = objc.protobuf.tests".
package objc.protobuf.tests;
// Explicit empty prefix, tests some validations code paths also.
option objc_class_prefix = "";
// Tests maps.
message TestMap {
map<int32, int32> map_int32_int32 = 1;

@ -28,21 +28,15 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Author: kenton@google.com (Kenton Varda)
// Based on original Protocol Buffers design by
// Sanjay Ghemawat, Jeff Dean, and others.
//
// A proto file we will use for unit testing.
//
// LINT: ALLOW_GROUPS, LEGACY_NAMES
syntax = "proto2";
import "objectivec/Tests/unittest_import.proto";
// We don't put this in a package within proto2 because we need to make sure
// that the generated code doesn't depend on being in the proto2 namespace.
// In test_util.h we do "using namespace unittest = objc.protobuf.tests".
// Explicit empty prefix, tests some validations code paths also.
option objc_class_prefix = "";
package objc.protobuf.tests;
// This proto includes every type of field in both singular and repeated
@ -85,17 +79,17 @@ message TestAllTypes {
optional NestedMessage optional_nested_message = 18;
optional ForeignMessage optional_foreign_message = 19;
optional objc.protobuf.tests.import.ImportMessage optional_import_message = 20;
optional objc.protobuf.tests.import.Message optional_import_message = 20;
optional NestedEnum optional_nested_enum = 21;
optional ForeignEnum optional_foreign_enum = 22;
optional objc.protobuf.tests.import.ImportEnum optional_import_enum = 23;
optional objc.protobuf.tests.import.Enum optional_import_enum = 23;
optional string optional_string_piece = 24 [ctype=STRING_PIECE];
optional string optional_cord = 25 [ctype=CORD];
// Defined in unittest_import_public.proto
optional objc.protobuf.tests.import.PublicImportMessage
optional objc.protobuf.tests.public_import.Message
optional_public_import_message = 26;
optional NestedMessage optional_lazy_message = 27 [lazy=true];
@ -124,11 +118,11 @@ message TestAllTypes {
repeated NestedMessage repeated_nested_message = 48;
repeated ForeignMessage repeated_foreign_message = 49;
repeated objc.protobuf.tests.import.ImportMessage repeated_import_message = 50;
repeated objc.protobuf.tests.import.Message repeated_import_message = 50;
repeated NestedEnum repeated_nested_enum = 51;
repeated ForeignEnum repeated_foreign_enum = 52;
repeated objc.protobuf.tests.import.ImportEnum repeated_import_enum = 53;
repeated objc.protobuf.tests.import.Enum repeated_import_enum = 53;
repeated string repeated_string_piece = 54 [ctype=STRING_PIECE];
repeated string repeated_cord = 55 [ctype=CORD];
@ -154,7 +148,7 @@ message TestAllTypes {
optional NestedEnum default_nested_enum = 81 [default = BAR ];
optional ForeignEnum default_foreign_enum = 82 [default = FOREIGN_BAR];
optional objc.protobuf.tests.import.ImportEnum
optional objc.protobuf.tests.import.Enum
default_import_enum = 83 [default = IMPORT_BAR];
optional string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"];
@ -241,18 +235,18 @@ extend TestAllExtensions {
optional TestAllTypes.NestedMessage optional_nested_message_extension = 18;
optional ForeignMessage optional_foreign_message_extension = 19;
optional objc.protobuf.tests.import.ImportMessage
optional objc.protobuf.tests.import.Message
optional_import_message_extension = 20;
optional TestAllTypes.NestedEnum optional_nested_enum_extension = 21;
optional ForeignEnum optional_foreign_enum_extension = 22;
optional objc.protobuf.tests.import.ImportEnum
optional objc.protobuf.tests.import.Enum
optional_import_enum_extension = 23;
optional string optional_string_piece_extension = 24 [ctype=STRING_PIECE];
optional string optional_cord_extension = 25 [ctype=CORD];
optional objc.protobuf.tests.import.PublicImportMessage
optional objc.protobuf.tests.public_import.Message
optional_public_import_message_extension = 26;
optional TestAllTypes.NestedMessage
@ -283,12 +277,12 @@ extend TestAllExtensions {
repeated TestAllTypes.NestedMessage repeated_nested_message_extension = 48;
repeated ForeignMessage repeated_foreign_message_extension = 49;
repeated objc.protobuf.tests.import.ImportMessage
repeated objc.protobuf.tests.import.Message
repeated_import_message_extension = 50;
repeated TestAllTypes.NestedEnum repeated_nested_enum_extension = 51;
repeated ForeignEnum repeated_foreign_enum_extension = 52;
repeated objc.protobuf.tests.import.ImportEnum
repeated objc.protobuf.tests.import.Enum
repeated_import_enum_extension = 53;
repeated string repeated_string_piece_extension = 54 [ctype=STRING_PIECE];
@ -318,7 +312,7 @@ extend TestAllExtensions {
default_nested_enum_extension = 81 [default = BAR];
optional ForeignEnum
default_foreign_enum_extension = 82 [default = FOREIGN_BAR];
optional objc.protobuf.tests.import.ImportEnum
optional objc.protobuf.tests.import.Enum
default_import_enum_extension = 83 [default = IMPORT_BAR];
optional string default_string_piece_extension = 84 [ctype=STRING_PIECE,

@ -29,7 +29,9 @@
syntax = "proto2";
package objc.protobuf.tests;
package objc.protobuf.tests.cycle;
option objc_class_prefix = "Cycle";
// Cycles in the Message graph can cause problems for message class
// initialization order.
@ -37,20 +39,20 @@ package objc.protobuf.tests;
// You can't make a object graph that spans files, so this can only be done
// within a single proto file.
message CycleFoo {
optional CycleFoo a_foo = 1;
optional CycleBar a_bar = 2;
optional CycleBaz a_baz = 3;
message Foo {
optional Foo a_foo = 1;
optional Bar a_bar = 2;
optional Baz a_baz = 3;
}
message CycleBar {
optional CycleBar a_bar = 1;
optional CycleBaz a_baz = 2;
optional CycleFoo a_foo = 3;
message Bar {
optional Bar a_bar = 1;
optional Baz a_baz = 2;
optional Foo a_foo = 3;
}
message CycleBaz {
optional CycleBaz a_baz = 1;
optional CycleFoo a_foo = 2;
optional CycleBar a_bar = 3;
message Baz {
optional Baz a_baz = 1;
optional Foo a_foo = 2;
optional Bar a_bar = 3;
}

@ -29,7 +29,7 @@
syntax = "proto2";
package objc.protobuf.tests;
package objc.protobuf.tests.chain;
import "objectivec/Tests/unittest.proto";
@ -37,15 +37,17 @@ import "objectivec/Tests/unittest_extension_chain_b.proto";
import "objectivec/Tests/unittest_extension_chain_c.proto";
import "objectivec/Tests/unittest_extension_chain_d.proto";
option objc_class_prefix = "Chain";
// The Root for this file should end up adding the local extension and merging
// in the extensions from D's Root (unittest and C will come via D's).
message ChainAMessage {
optional ChainBMessage b = 1;
optional ChainCMessage c = 2;
optional ChainDMessage d = 3;
message AMessage {
optional BMessage b = 1;
optional CMessage c = 2;
optional DMessage d = 3;
}
extend TestAllExtensions {
extend objc.protobuf.tests.TestAllExtensions {
optional int32 chain_a_extension = 10001;
}

@ -29,19 +29,21 @@
syntax = "proto2";
package objc.protobuf.tests;
package objc.protobuf.tests.chain;
import "objectivec/Tests/unittest.proto";
import "objectivec/Tests/unittest_extension_chain_c.proto";
option objc_class_prefix = "Chain";
// The Root for this file should end up adding the local extension and merging
// in the extensions from C's Root (unittest will come via C's).
message ChainBMessage {
optional ChainCMessage c = 1;
message BMessage {
optional CMessage c = 1;
}
extend TestAllExtensions {
extend objc.protobuf.tests.TestAllExtensions {
optional int32 chain_b_extension = 10002;
}

@ -29,17 +29,19 @@
syntax = "proto2";
package objc.protobuf.tests;
package objc.protobuf.tests.chain;
import "objectivec/Tests/unittest.proto";
option objc_class_prefix = "Chain";
// The Root for this file should end up adding the local extension and merging
// in the extensions from unittest.proto's Root.
message ChainCMessage {
message CMessage {
optional int32 my_field = 1;
}
extend TestAllExtensions {
extend objc.protobuf.tests.TestAllExtensions {
optional int32 chain_c_extension = 10003;
}

@ -29,21 +29,23 @@
syntax = "proto2";
package objc.protobuf.tests;
package objc.protobuf.tests.chain;
import "objectivec/Tests/unittest.proto";
import "objectivec/Tests/unittest_extension_chain_b.proto";
import "objectivec/Tests/unittest_extension_chain_c.proto";
option objc_class_prefix = "Chain";
// The root should end up needing to merge B (C will be merged into B, so it
// doesn't need to be directly merged).
message ChainDMessage {
optional ChainBMessage b = 1;
optional ChainCMessage c = 2;
message DMessage {
optional BMessage b = 1;
optional CMessage c = 2;
}
extend TestAllExtensions {
extend objc.protobuf.tests.TestAllExtensions {
optional int32 chain_d_extension = 10004;
}

@ -29,12 +29,14 @@
syntax = "proto2";
package objc.protobuf.tests;
package objc.protobuf.tests.chain;
import "objectivec/Tests/unittest.proto";
option objc_class_prefix = "Chain";
// The Root for this file should end up just merging in unittest's Root.
message ChainEMessage {
message EMessage {
optional TestAllTypes my_field = 1;
}

@ -29,16 +29,18 @@
syntax = "proto2";
package objc.protobuf.tests;
package objc.protobuf.tests.chain;
import "objectivec/Tests/unittest_extension_chain_g.proto";
option objc_class_prefix = "Chain";
// The Root for this file should just be merging in the extensions from C's
// Root (because G doesn't define anything itself).
// The generated source will also have to directly import C's .h file so it can
// compile the reference to C's Root class.
message ChainFMessage {
optional ChainGMessage g = 1;
message FMessage {
optional GMessage g = 1;
}

@ -29,13 +29,15 @@
syntax = "proto2";
package objc.protobuf.tests;
package objc.protobuf.tests.chain;
import "objectivec/Tests/unittest_extension_chain_c.proto";
option objc_class_prefix = "Chain";
// The Root for this file should just be merging in the extensions from C's
// Root.
message ChainGMessage {
optional ChainCMessage c = 1;
message GMessage {
optional CMessage c = 1;
}

@ -28,10 +28,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Author: kenton@google.com (Kenton Varda)
// Based on original Protocol Buffers design by
// Sanjay Ghemawat, Jeff Dean, and others.
//
// A proto file which is imported by unittest.proto to test importing.
syntax = "proto2";
@ -41,11 +37,13 @@ package objc.protobuf.tests.import;
// Test public import
import public "objectivec/Tests/unittest_import_public.proto";
message ImportMessage {
option objc_class_prefix = "Import";
message Message {
optional int32 d = 1;
}
enum ImportEnum {
enum Enum {
IMPORT_FOO = 7;
IMPORT_BAR = 8;
IMPORT_BAZ = 9;
@ -53,7 +51,7 @@ enum ImportEnum {
// To use an enum in a map, it must has the first value as 0.
enum ImportEnumForMap {
enum EnumForMap {
UNKNOWN = 0;
FOO = 1;
BAR = 2;

@ -32,8 +32,10 @@
syntax = "proto2";
package objc.protobuf.tests.import;
package objc.protobuf.tests.public_import;
message PublicImportMessage {
option objc_class_prefix = "PublicImport";
message Message {
optional int32 e = 1;
}

@ -1,41 +0,0 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// 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.
// Author: liujisi@google.com (Pherl Liu)
syntax = "proto2";
package objc.protobuf.tests.import;
option optimize_for = LITE_RUNTIME;
message PublicImportMessageLite {
optional int32 e = 1;
}

@ -28,68 +28,34 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Author: kenton@google.com (Kenton Varda)
// Based on original Protocol Buffers design by
// Sanjay Ghemawat, Jeff Dean, and others.
//
// This file is similar to unittest_mset_wire_format.proto, but does not
// have a TestMessageSet, so it can be downgraded to proto1.
syntax = "proto2";
import "objectivec/Tests/unittest_mset_wire_format.proto";
package objc.protobuf.tests;
message TestMessageSetContainer {
optional objc.protobuf.tests.wireformat.TestMessageSet message_set = 1;
}
package objc.protobuf.tests.mset;
message NestedTestMessageSetContainer {
optional TestMessageSetContainer container = 1;
optional NestedTestMessageSetContainer child = 2;
}
option objc_class_prefix = "MSet";
message NestedTestInt {
optional fixed32 a = 1;
optional int32 b = 3;
optional NestedTestInt child = 2;
// A message with message_set_wire_format.
message Message {
option message_set_wire_format = true;
extensions 4 to max;
}
message TestMessageSetExtension1 {
extend objc.protobuf.tests.wireformat.TestMessageSet {
optional TestMessageSetExtension1 message_set_extension = 1545008;
message MessageExtension1 {
extend Message {
optional MessageExtension1 message_set_extension = 1545008;
}
optional int32 i = 15;
optional objc.protobuf.tests.wireformat.TestMessageSet recursive = 16;
optional Message recursive = 16;
optional string test_aliasing = 17 [ctype = STRING_PIECE];
}
message TestMessageSetExtension2 {
extend objc.protobuf.tests.wireformat.TestMessageSet {
optional TestMessageSetExtension2 message_set_extension = 1547769;
message MessageExtension2 {
extend Message {
optional MessageExtension2 message_set_extension = 1547769;
}
optional string str = 25;
}
message TestMessageSetExtension3 {
extend objc.protobuf.tests.wireformat.TestMessageSet {
optional TestMessageSetExtension3 message_set_extension = 195273129;
}
optional NestedTestInt msg = 35;
}
// This message was used to generate
// //net/proto2/python/internal/testdata/message_set_message, but is commented
// out since it must not actually exist in code, to simulate an "unknown"
// extension.
// message TestMessageSetUnknownExtension {
// extend TestMessageSet {
// optional TestMessageSetUnknownExtension message_set_extension = 56141421;
// }
// optional int64 a = 1;
// }
// MessageSet wire format is equivalent to this.
message RawMessageSet {
repeated group Item = 1 {

@ -1,48 +0,0 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// 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.
// Author: kenton@google.com (Kenton Varda)
// Based on original Protocol Buffers design by
// Sanjay Ghemawat, Jeff Dean, and others.
//
// This file contains messages for testing message_set_wire_format.
syntax = "proto2";
package objc.protobuf.tests.wireformat;
// A message with message_set_wire_format.
message TestMessageSet {
option message_set_wire_format = true;
extensions 4 to max;
}
message TestMessageSetWireFormatContainer {
optional TestMessageSet message_set = 1;
}

@ -34,6 +34,9 @@ import "objectivec/Tests/unittest.proto";
package objc.protobuf.tests;
// Explicit empty prefix, tests some validations code paths also.
option objc_class_prefix = "";
// Used to check that Headerdocs and appledoc work correctly. If these comments
// are not handled correctly, Xcode will fail to build the tests.
message TestGeneratedComments {

@ -31,19 +31,20 @@
syntax = "proto2";
package objc.protobuf.tests.startup;
option objc_class_prefix = "TestObjCStartup";
message TestObjCStartupMessage {
message Message {
extensions 1 to max;
}
extend TestObjCStartupMessage {
extend Message {
// Singular
optional int32 optional_int32_extension = 1;
repeated int32 repeated_int32_extension = 2;
}
message TestObjCStartupNested {
extend TestObjCStartupMessage {
message Nested {
extend Message {
optional string nested_string_extension = 3;
}
}

@ -29,8 +29,11 @@
syntax = "proto2";
// Explicit empty prefix, tests some validations code paths also.
package objc.protobuf.tests;
option objc_class_prefix = "";
message Message2 {
enum Enum {
FOO = 0;

@ -29,8 +29,11 @@
syntax = "proto3";
// Explicit empty prefix, tests some validations code paths also.
package objc.protobuf.tests;
option objc_class_prefix = "";
message Message3 {
enum Enum {
FOO = 0;

Loading…
Cancel
Save