Add a test that hidden classes are correctly deallocated and don’t leave the runtime in an undefined state.

main
David Chisnall 11 years ago
parent d6ca506d6a
commit a74542ae4f

@ -0,0 +1,37 @@
#include "Test.h"
@interface MLTestClass : Test {
@public
}
- (void)someF;
@end
@implementation MLTestClass
- (void)someF
{
}
@end
static void ff(id obj, SEL _cmd)
{
}
int main()
{
static char static_char;
MLTestClass * tc;
tc = [MLTestClass new];
objc_setAssociatedObject(tc, &static_char, (id)1223, OBJC_ASSOCIATION_ASSIGN);
[tc release];
int i = 0;
tc = [MLTestClass new];
objc_setAssociatedObject(tc, &static_char, (id)1223, OBJC_ASSOCIATION_ASSIGN);
SEL some_sel = sel_registerName(".some_sel");
const char *types = "v@:";
class_addMethod(object_getClass(tc), some_sel,
(IMP)ff, types);
int j = (int)objc_getAssociatedObject(tc, &static_char);
[tc release];
}

@ -8,6 +8,7 @@ set(TESTS
#alignTest.m
AllocatePair.m
AssociatedObject.m
AssociatedObject2.m
BlockImpTest.m
BlockTest_arc.m
BoxedForeignException.m

@ -15,6 +15,12 @@ __attribute__((objc_root_class))
@interface Test { id isa; }
+ (Class)class;
+ (id)new;
#if !__has_feature(objc_arc)
- (void)dealloc;
- (id)autorelease;
- (id)retain;
- (void)release;
#endif
@end
#if !__has_feature(objc_arc)

Loading…
Cancel
Save