Debian Codegraph @

gcc/testsuite/objc/execute/root_methods.m

raw
1 /* Contributed by Nicola Pero - Thu Mar 8 16:27:46 CET 2001 */
2
3 #import "../../objc-obj-c++-shared/runtime.h"
4 #import <objc/objc.h>
5
6 /* Test that instance methods of root classes are available as class
7 methods to other classes as well */
8
9 @interface RootClass
10 {
11 Class isa;
12 }
13 - (id) self;
14 @end
15
16 @implementation RootClass
17 - (id) self
18 {
19 return self;
20 }
21 + initialize { return self; }
22 @end
23
24 @interface NormalClass : RootClass
25 @end
26
27 @implementation NormalClass : RootClass
28 @end
29
30 int main (void)
31 {
32 Class normal = objc_getClass ("NormalClass");
33
34 if (normal == Nil)
35 {
36 abort ();
37 }
38
39 if ([NormalClass self] != normal)
40 {
41 abort ();
42 }
43
44 return 0;
45 }