]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/_dyld_get_objc_selector.dtest/main.m
9845721ef23e5eb1179145df395677e76c8d4b02
[apple/dyld.git] / testing / test-cases / _dyld_get_objc_selector.dtest / main.m
1
2 // BUILD: $CC main.m -o $BUILD_DIR/_dyld_get_objc_selector.exe -lobjc
3
4 // RUN: ./_dyld_get_objc_selector.exe
5
6 #include <mach-o/dyld_priv.h>
7
8 #import <Foundation/Foundation.h>
9
10 @interface DyldClass : NSObject
11 @end
12
13 @implementation DyldClass
14 -(void) dyldClassFoo {
15
16 }
17 +(void) dyldClassFoo {
18
19 }
20 @end
21
22 @interface DyldMainClass : NSObject
23 @end
24
25 @implementation DyldMainClass
26 -(void) dyldMainClassFoo {
27
28 }
29 -(void) dyldMainClassFoo2 {
30
31 }
32 @end
33
34 extern int printf(const char*, ...);
35
36 extern id objc_getClass(const char *name);
37
38 int main() {
39 printf("[BEGIN] _dyld_get_objc_selector\n");
40
41 // dyldClassFoo
42 const char* sel = _dyld_get_objc_selector("dyldClassFoo");
43 if (sel) {
44 if ((SEL)sel != @selector(dyldClassFoo)) {
45 printf("[FAIL] _dyld_get_objc_selector: dyldClassFoo is wrong\n");
46 return 0;
47 }
48 }
49
50 // dyldMainClassFoo
51 sel = _dyld_get_objc_selector("dyldMainClassFoo");
52 if (sel) {
53 if ((SEL)sel != @selector(dyldMainClassFoo)) {
54 printf("[FAIL] _dyld_get_objc_selector: dyldMainClassFoo is wrong\n");
55 return 0;
56 }
57 }
58
59 // dyldMainClassFoo2
60 sel = _dyld_get_objc_selector("dyldMainClassFoo2");
61 if (sel) {
62 if ((SEL)sel != @selector(dyldMainClassFoo2)) {
63 printf("[FAIL] _dyld_get_objc_selector: dyldMainClassFoo2 is wrong\n");
64 return 0;
65 }
66 }
67
68 printf("[PASS] _dyld_get_objc_selector\n");
69
70 return 0;
71 }