Skip to content

Instantly share code, notes, and snippets.

@nvkv
Created September 27, 2010 06:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nvkv/598706 to your computer and use it in GitHub Desktop.
Save nvkv/598706 to your computer and use it in GitHub Desktop.
#pragma mark Runtime stuff
- (void) collectTestClasses
{
int classesCount = 0;
Class * c_list = NULL;
c_list = NULL;
classesCount = objc_getClassList(NULL, 0);
if (classesCount > 0)
{
c_list = malloc(sizeof(Class) * classesCount);
classesCount = objc_getClassList(c_list, classesCount);
for (int i = 0; i < classesCount; i++)
{
NSString *className = [NSString stringWithCString:class_getName(c_list[i])
encoding:NSUTF8StringEncoding];
if ([className hasSuffix:@"Tests"]) {
[testClasses addObject:className];
}
}
free(c_list);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment