@ -304,12 +304,6 @@
- ( void ) testOneofDescriptor {
GPBDescriptor * descriptor = [ TestOneof2 descriptor ] ;
/ / All fields should be listed .
XCTAssertEqual ( descriptor . fields . count , 21 U ) ;
/ / There are two oneofs in there .
XCTAssertEqual ( descriptor . oneofs . count , 2 U ) ;
GPBFieldDescriptor * fooStringField =
[ descriptor fieldWithNumber : TestOneof2_FieldNumber_FooString ] ;
XCTAssertNotNil ( fooStringField ) ;
@ -317,22 +311,24 @@
[ descriptor fieldWithNumber : TestOneof2_FieldNumber_BarString ] ;
XCTAssertNotNil ( barStringField ) ;
/ / Check the oneofs to have what is expected .
/ / Check the oneofs to have what is expected but not other onesofs
GPBOneofDescriptor * oneofFoo = [ descriptor oneofWithName : @ "foo "] ;
XCTAssertNotNil ( oneofFoo ) ;
XCTAssertEqual ( oneofFoo . fields . count , 9 U ) ;
XCTAssertNotNil ( [ oneofFoo fieldWithName : @ "fooString "] ) ;
XCTAssertNil ( [ oneofFoo fieldWithName : @ "barString "] ) ;
GPBOneofDescriptor * oneofBar = [ descriptor oneofWithName : @ "bar "] ;
XCTAssertNotNil ( oneofBar ) ;
XCTAssertNil ( [ oneofBar fieldWithName : @ "fooString "] ) ;
XCTAssertNotNil ( [ oneofBar fieldWithName : @ "barString "] ) ;
/ / Pointer comparisons against lookups from message .
/ / Pointer comparisons .
XCTAssertEqual ( [ oneofFoo fieldWithNumber : TestOneof2_FieldNumber_FooString ] ,
fooStringField ) ;
XCTAssertEqual ( [ oneofFoo fieldWithName : @ "fooString "] , fooStringField ) ;
GPBOneofDescriptor * oneofBar = [ descriptor oneofWithName : @ "bar "] ;
XCTAssertNotNil ( oneofBar ) ;
XCTAssertEqual ( oneofBar . fields . count , 10 U ) ;
/ / Pointer comparisons .
XCTAssertEqual ( [ oneofBar fieldWithNumber : TestOneof2_FieldNumber_BarString ] ,
barStringField ) ;
XCTAssertEqual ( [ oneofBar fieldWithName : @ "barString "] , barStringField ) ;