#import <objc/runtime.h>
@implementation Object
- (void) main {
__block BOOL called = NO;
SEL sel = NSSelectorFromString(@"aMethod");
IMP imp = imp_implementationWithBlock(^(Object* self) {
called = YES;
});
class_addMethod([Object class], sel, imp, "v@");
[self performSelector:sel];
NSAssert(called, @"Block is not called.");
}
@end