]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/_dyld_get_objc_selector-chained.dtest/main.m
dyld-750.5.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 #include "test_support.h"
12
13 @interface DyldClass : NSObject
14 @end
15
16 @implementation DyldClass
17 -(void) dyldClassFoo {
18
19 }
20 +(void) dyldClassFoo {
21
22 }
23 @end
24
25 @interface DyldMainClass : NSObject
26 @end
27
28 @implementation DyldMainClass
29 -(void) dyldMainClassFoo {
30
31 }
32 -(void) dyldMainClassFoo2 {
33
34 }
35 @end
36
37 extern id objc_getClass(const char *name);
38
39 int main(int argc, const char* argv[], const char* envp[], const char* apple[]) {
40 // dyldClassFoo
41 const char* sel = _dyld_get_objc_selector("dyldClassFoo");
42 if (sel) {
43 if ((SEL)sel != @selector(dyldClassFoo)) {
44 FAIL("dyldClassFoo is wrong");
45 }
46 }
47
48 // dyldMainClassFoo
49 sel = _dyld_get_objc_selector("dyldMainClassFoo");
50 if (sel) {
51 if ((SEL)sel != @selector(dyldMainClassFoo)) {
52 FAIL("dyldMainClassFoo is wrong");
53 }
54 }
55
56 // dyldMainClassFoo2
57 sel = _dyld_get_objc_selector("dyldMainClassFoo2");
58 if (sel) {
59 if ((SEL)sel != @selector(dyldMainClassFoo2)) {
60 FAIL("dyldMainClassFoo2 is wrong");
61 }
62 }
63
64 PASS("Success");
65 }