super.m 614 B

123456789101112131415161718192021
  1. // TEST_CONFIG
  2. #include "test.h"
  3. #include "testroot.i"
  4. #include <objc/objc-runtime.h>
  5. @interface Sub : TestRoot @end
  6. @implementation Sub @end
  7. int main()
  8. {
  9. // [super ...] messages are tested in msgSend.m
  10. testassert(class_getSuperclass([Sub class]) == [TestRoot class]);
  11. testassert(class_getSuperclass(object_getClass([Sub class])) == object_getClass([TestRoot class]));
  12. testassert(class_getSuperclass([TestRoot class]) == Nil);
  13. testassert(class_getSuperclass(object_getClass([TestRoot class])) == [TestRoot class]);
  14. testassert(class_getSuperclass(Nil) == Nil);
  15. succeed(__FILE__);
  16. }