]> git.saurik.com Git - apple/objc4.git/blob - test/protocol_cw.m
objc4-437.3.tar.gz
[apple/objc4.git] / test / protocol_cw.m
1 #include "test.h"
2
3 #if __OBJC2__
4
5 int main()
6 {
7 succeed(__FILE__);
8 }
9
10 #else
11
12 // rdar://4951638
13
14 #include <string.h>
15 #include <objc/Protocol.h>
16
17 char Protocol_name[] __attribute__((section("__OBJC,__class_names"))) = "Protocol";
18
19 struct {
20 void *isa;
21 char *protocol_name;
22 void *protocol_list;
23 void *instance_methods;
24 void *class_methods;
25 } Foo_protocol __attribute__((section("__OBJC,__protocol"))) = { Protocol_name, "Foo", 0, 0, 0 };
26
27 int main()
28 {
29 Protocol *foo = objc_getProtocol("Foo");
30
31 testassert(foo == (Protocol *)&Foo_protocol);
32 testassert(0 == strcmp("Foo", [foo name]));
33 succeed(__FILE__);
34 }
35
36 #endif