1

Esteemed OCUnit testers,

OCUnit tests always pass if they contain a method named 'name', e.g:

#import <SenTestingKit/SenTestingKit.h>

@interface Tests : SenTestCase

@end

@implementation Tests

- (NSString *)name
{
    return @"Howard";
}

- (void)testSomeTest
{
    STFail(@"Unit tests are not implemented yet in Tests");
}

@end

Passes! I am running under XCode 4.

If I change 'name' to some other name then it is fine, i.e. it fails. Any idea why 'name' is a reserved name in OCUnit? Anyway to get round this? It is part of a protocol I am trying to test.

Thanks in advance for any suggestions, -- Howard.

Howard Lovatt
  • 968
  • 1
  • 8
  • 15

1 Answers1

1

SenTestCase.m already has an internal method called -name:

https://github.com/jy/SenTestingKit/blob/master/SenTestCase.m

I presume you're trying to test the results of a delegate protocol. Try pulling the delegate-providing test code into a separate object, outside of the test fixture.

Jon Reid
  • 20,545
  • 2
  • 64
  • 95