1 /* Test the Modern GNU Objective-C Runtime API.
3 This is test 'property', covering all functions starting with 'property'. */
7 /* To get the modern GNU Objective-C Runtime API, you include
9 #include <objc/runtime.h>
14 @interface MyRootClass
21 @implementation MyRootClass
22 + alloc { return class_createInstance (self, 0); }
23 - init { return self; }
24 + initialize { return self; }
31 @protocol MySecondProtocol
32 - (id) setVariable: (id)value;
35 @interface MySubClass : MyRootClass <MyProtocol>
37 - (void) setVariable: (id)value;
41 @implementation MySubClass
42 - (void) setVariable: (id)value { variable_ivar = value; }
43 - (id) variable { return variable_ivar; }
49 /* Functions are tested in alphabetical order. */
51 /* TODO: Test new ABI (when available). */
52 std::cout << "Testing property_getAttributes () ...\n";
54 /* The Apple/NeXT runtime seems to crash on the following. */
55 #ifdef __GNU_LIBOBJC__
56 if (property_getAttributes (NULL) != NULL)
61 /* TODO: Test new ABI (when available). */
62 std::cout << "Testing property_getName () ...\n";
64 /* The Apple/NeXT runtime seems to crash on the following. */
65 #ifdef __GNU_LIBOBJC__
67 if (property_getName (NULL) != NULL)