imageorder.m 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. TEST_BUILD
  3. $C{COMPILE} $DIR/imageorder1.m -o imageorder1.dylib -dynamiclib
  4. $C{COMPILE} $DIR/imageorder2.m -x none imageorder1.dylib -o imageorder2.dylib -dynamiclib
  5. $C{COMPILE} $DIR/imageorder3.m -x none imageorder2.dylib imageorder1.dylib -o imageorder3.dylib -dynamiclib
  6. $C{COMPILE} $DIR/imageorder.m -x none imageorder3.dylib imageorder2.dylib imageorder1.dylib -o imageorder.exe
  7. END
  8. */
  9. #include "test.h"
  10. #include "imageorder.h"
  11. #include <objc/runtime.h>
  12. #include <dlfcn.h>
  13. int main()
  14. {
  15. // +load methods and C static initializers
  16. testassert(state == 3);
  17. testassert(cstate == 3);
  18. Class cls = objc_getClass("Super");
  19. testassert(cls);
  20. // make sure all categories arrived
  21. state = -1;
  22. [Super method0];
  23. testassert(state == 0);
  24. [Super method1];
  25. testassert(state == 1);
  26. [Super method2];
  27. testassert(state == 2);
  28. [Super method3];
  29. testassert(state == 3);
  30. // make sure imageorder3.dylib is the last category to attach
  31. state = 0;
  32. [Super method];
  33. testassert(state == 3);
  34. succeed(__FILE__);
  35. }