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