Skip to content
This repository has been archived by the owner on May 19, 2018. It is now read-only.

Commit

Permalink
Added a test to demonstrate that you can call methods—even properties…
Browse files Browse the repository at this point in the history
…—on a variable without compiler warnings by use of the ClassName<Protocol> * type declaration.
  • Loading branch information
robrix committed Nov 16, 2009
1 parent 02499e9 commit 03f7fff
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions RXConcreteProtocolTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,12 @@ -(void)testExtendingAClassOverridesMethodsDefinedOnItsSuperclass {
testSubclass = Nil;
}

-(void)testStaticallyTypedVariablesWithConformanceDeclarationsDoNotCauseCompilerWarnings {
// for purposes of easier verification, treat warnings as errors when compiling this
[RXTestConcreteProtocol extendClass: testClass];
NSObject<RXTestProtocol> *staticallyTypedInstance = [[testClass alloc] init]; // the class is given as NSObject because the compiler doesn’t know about testClass
RXAssertEquals(staticallyTypedInstance.foo, @"foo");
[staticallyTypedInstance release];
}

@end

0 comments on commit 03f7fff

Please sign in to comment.