10 @interface Deallocator : TestRoot @end
11 @implementation Deallocator
19 @interface Super : TestRoot @end
22 if (self == [Super class]) {
23 testprintf("in +[Super initialize]\n");
24 testassert(state == 2);
27 testprintf("in +[Super initialize] on behalf of Sub\n");
28 testassert(state == 3);
32 -(void)load { fail("-[Super load] called!"); }
34 testprintf("in +[Super load]\n");
35 testassert(state == 0);
40 @interface Sub : Super { } @end
43 testprintf("in +[Sub load]\n");
44 testassert(state == 1);
47 -(void)load { fail("-[Sub load] called!"); }
50 @interface SubNoLoad : Super { } @end
51 @implementation SubNoLoad @end
53 @interface Super (Category) @end
54 @implementation Super (Category)
55 -(void)load { fail("-[Super(Category) load called!"); }
57 testprintf("in +[Super(Category) load]\n");
58 testassert(state >= 1);
64 @interface Sub (Category) @end
65 @implementation Sub (Category)
66 -(void)load { fail("-[Sub(Category) load called!"); }
68 testprintf("in +[Sub(Category) load]\n");
69 testassert(state >= 2);
72 // test autorelease pool
74 x = AUTORELEASE([Deallocator new]);
79 @interface SubNoLoad (Category) @end
80 @implementation SubNoLoad (Category)
81 -(void)load { fail("-[SubNoLoad(Category) load called!"); }
83 testprintf("in +[SubNoLoad(Category) load]\n");
84 testassert(state >= 1);
91 testassert(state == 2);
92 testassert(catstate == 3);
93 testassert(deallocstate == 1);
95 testassert(state == 4);
96 testassert(catstate == 3);