diff options
author | Thomas Van Lenten <thomasvl@google.com> | 2016-09-01 11:45:50 -0400 |
---|---|---|
committer | Thomas Van Lenten <thomasvl@google.com> | 2016-09-01 18:08:59 -0400 |
commit | 13a41246dd9aa6c6a84d436307b933fd4a6ec4a8 (patch) | |
tree | b3874be6ed13a5d22655c55c0a2e4f80fdb99f35 /objectivec/Tests/GPBMessageTests+Runtime.m | |
parent | c0a6a6b4628a634f6a0529c9f7e9e1e0fe66d4d6 (diff) | |
download | protobuf-13a41246dd9aa6c6a84d436307b933fd4a6ec4a8.tar.gz protobuf-13a41246dd9aa6c6a84d436307b933fd4a6ec4a8.tar.bz2 protobuf-13a41246dd9aa6c6a84d436307b933fd4a6ec4a8.zip |
Make Root's +extensionRegistry generation smarter.
At generation time, walk the file's dependencies to see what really contains
extensions so we can generate more minimal code that only links together the
roots that provided extensions. Gets a bunch of otherwise noop code out of
the call flow when the roots are +initialized.
Diffstat (limited to 'objectivec/Tests/GPBMessageTests+Runtime.m')
-rw-r--r-- | objectivec/Tests/GPBMessageTests+Runtime.m | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/objectivec/Tests/GPBMessageTests+Runtime.m b/objectivec/Tests/GPBMessageTests+Runtime.m index 2cf9ccef..0058311b 100644 --- a/objectivec/Tests/GPBMessageTests+Runtime.m +++ b/objectivec/Tests/GPBMessageTests+Runtime.m @@ -36,6 +36,7 @@ #import "google/protobuf/MapUnittest.pbobjc.h" #import "google/protobuf/Unittest.pbobjc.h" +#import "google/protobuf/UnittestCycle.pbobjc.h" #import "google/protobuf/UnittestObjcStartup.pbobjc.h" #import "google/protobuf/UnittestRuntimeProto2.pbobjc.h" #import "google/protobuf/UnittestRuntimeProto3.pbobjc.h" @@ -49,11 +50,24 @@ // specific. - (void)testStartupOrdering { - // Just have to create a message. Nothing else uses the classes from - // this file, so the first selector invoked on the class will initialize - // it, which also initializes the root. + // Message class/Root class initialization is a little tricky, so these just + // create some possible patterns that can be a problem. The messages don't + // have to be exercised, just creating them is enough to test. If there + // is a problem, the runtime should assert or hang. + // + // Note: the messages from these proto files should not be used in any other + // tests, that way when they are referenced here it will be the first use and + // initialization will take place now. + TestObjCStartupMessage *message = [TestObjCStartupMessage message]; XCTAssertNotNil(message); + + CycleBaz *baz = [CycleBaz message]; + CycleBar *bar = [CycleBar message]; + CycleFoo *foo = [CycleFoo message]; + XCTAssertNotNil(baz); + XCTAssertNotNil(bar); + XCTAssertNotNil(foo); } - (void)testProto2HasMethodSupport { |