3 #include <objc/objc-runtime.h>
5 @interface Super { @public id isa; } @end
8 +class { return self; }
11 @interface Fake { @public id isa; } @end
14 +class { return self; }
20 Super *obj = (Super *)buf;
21 buf[0] = [Fake class];
23 testassert(obj->isa == [Fake class]);
24 testassert(object_setClass(obj, [Super class]) == [Fake class]);
25 testassert(obj->isa == [Super class]);
26 testassert(object_setClass(nil, [Super class]) == nil);
28 testassert(object_getClass(obj) == buf[0]);
29 testassert(object_getClass([Super class]) == [Super class]->isa);
30 testassert(object_getClass(nil) == Nil);
32 testassert(0 == strcmp(object_getClassName(obj), "Super"));
33 testassert(0 == strcmp(object_getClassName([Super class]), "Super"));
34 testassert(0 == strcmp(object_getClassName(nil), "nil"));
36 testassert(0 == strcmp(class_getName([Super class]), "Super"));
37 testassert(0 == strcmp(class_getName([Super class]->isa), "Super"));
38 testassert(0 == strcmp(class_getName(nil), "nil"));