Add a test case for notifications using dynamic lookup. Currently passes on OS

X, fails on GNUstep.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36605 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
theraven 2013-05-09 13:37:28 +00:00
parent 3a6d8a9bc9
commit 6ca63cef45

View file

@ -0,0 +1,27 @@
#import <Foundation/Foundation.h>
#include <objc/runtime.h>
#import "ObjectTesting.h"
@interface Toggle : NSObject @end
@implementation Toggle
- (void)foo: (NSNotification*)n
{
assert(0);
}
- (void)bar: (NSNotification*)n {}
@end
int main(void)
{
[NSAutoreleasePool new];
NSNotificationCenter *nc = [NSNotificationCenter new];
id t = [Toggle new];
[nc addObserver: t selector: @selector(foo:) name: nil object: nil];
class_replaceMethod([Toggle class],
@selector(foo:),
class_getMethodImplementation([Toggle class],
@selector(bar:)),
"v@:@");
[nc postNotificationName: @"foo" object: t];
return 0;
}