forked from RetVal/objc-runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
imageorder.m
executable file
·41 lines (35 loc) · 1.06 KB
/
imageorder.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
TEST_BUILD
$C{COMPILE} $DIR/imageorder1.m -o imageorder1.dylib -dynamiclib
$C{COMPILE} $DIR/imageorder2.m -x none imageorder1.dylib -o imageorder2.dylib -dynamiclib
$C{COMPILE} $DIR/imageorder3.m -x none imageorder2.dylib imageorder1.dylib -o imageorder3.dylib -dynamiclib
$C{COMPILE} $DIR/imageorder.m -x none imageorder3.dylib imageorder2.dylib imageorder1.dylib -o imageorder.out
END
*/
#include "test.h"
#include "imageorder.h"
#include <objc/runtime.h>
#include <dlfcn.h>
int main()
{
// +load methods and C static initializers
testassert(state == 3);
testassert(cstate == 3);
Class cls = objc_getClass("Super");
testassert(cls);
// make sure all categories arrived
state = -1;
[Super method0];
testassert(state == 0);
[Super method1];
testassert(state == 1);
[Super method2];
testassert(state == 2);
[Super method3];
testassert(state == 3);
// make sure imageorder3.dylib is the last category to attach
state = 0;
[Super method];
testassert(state == 3);
succeed(__FILE__);
}