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