I think that if the code could be in the test, it would make the test easier to understand.
so have something like:
```
{
string testInsideChild = testAnnotationBase + 
  "@interface C : A  \n"
  "- (void)bar;  \n"
  "@end  \n"
  "@implementation C    \n"
  "- (void)bar { [self foo]; }  \n"
  "@end \n";
  TestRuleOnObjCCode(/*...*/);
}
```