10 @interface Deallocator : TestRoot @end
11 @implementation Deallocator
14 if (objc_collectingEnabled()) {
26 @interface Super : TestRoot @end
29 if (self == [Super class]) {
30 testprintf("in +[Super initialize]\n");
31 testassert(state == 2);
34 testprintf("in +[Super initialize] on behalf of Sub\n");
35 testassert(state == 3);
39 -(void)load { fail("-[Super load] called!"); }
41 testprintf("in +[Super load]\n");
42 testassert(state == 0);
47 @interface Sub : Super { } @end
50 testprintf("in +[Sub load]\n");
51 testassert(state == 1);
54 -(void)load { fail("-[Sub load] called!"); }
57 @interface SubNoLoad : Super { } @end
58 @implementation SubNoLoad @end
60 @interface Super (Category) @end
61 @implementation Super (Category)
62 -(void)load { fail("-[Super(Category) load called!"); }
64 testprintf("in +[Super(Category) load]\n");
65 testassert(state >= 1);
71 @interface Sub (Category) @end
72 @implementation Sub (Category)
73 -(void)load { fail("-[Sub(Category) load called!"); }
75 testprintf("in +[Sub(Category) load]\n");
76 testassert(state >= 2);
79 // test autorelease pool
81 x = AUTORELEASE([Deallocator new]);
86 @interface SubNoLoad (Category) @end
87 @implementation SubNoLoad (Category)
88 -(void)load { fail("-[SubNoLoad(Category) load called!"); }
90 testprintf("in +[SubNoLoad(Category) load]\n");
91 testassert(state >= 1);
98 testassert(state == 2);
99 testassert(catstate == 3);
100 testassert(deallocstate == 1);
102 testassert(state == 4);
103 testassert(catstate == 3);