mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 17:51:01 +00:00
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32997 72102866-910b-0410-8b05-ffd578937521
32 lines
656 B
Objective-C
32 lines
656 B
Objective-C
#import <Foundation/Foundation.h>
|
|
#import "Testing.h"
|
|
|
|
static NSString *desc = @"[MyObject]";
|
|
|
|
static NSString *
|
|
myObjectDescription(id self, SEL _cmd)
|
|
{
|
|
return desc;
|
|
}
|
|
|
|
int
|
|
main(void)
|
|
{
|
|
id obj;
|
|
Class cls;
|
|
NSAutoreleasePool *pool;
|
|
|
|
pool = [NSAutoreleasePool new];
|
|
cls = (Class)objc_allocateClassPair([NSObject class], "MyObject", 0);
|
|
if (cls != Nil)
|
|
{
|
|
objc_registerClassPair(cls);
|
|
class_addMethod(cls, @selector(description),
|
|
(IMP)myObjectDescription, "@@:");
|
|
obj = [cls new];
|
|
pass([obj description] == desc, "New class's description method is called correctly");
|
|
[obj release];
|
|
}
|
|
|
|
return 0;
|
|
}
|