associationForbidden2.m 572 B

12345678910111213141516171819
  1. // TEST_CRASHES
  2. /*
  3. TEST_RUN_OUTPUT
  4. Associated object is 0x[0-9a-fA-F]+
  5. objc\[\d+\]: objc_setAssociatedObject called on instance \(0x[0-9a-fA-F]+\) of class ForbiddenSubclass which does not allow associated objects
  6. objc\[\d+\]: HALTED
  7. END
  8. */
  9. #include "associationForbidden.h"
  10. void test(void)
  11. {
  12. ShouldSucceed([Normal alloc]);
  13. Class ForbiddenSubclass = objc_allocateClassPair([Forbidden class],
  14. "ForbiddenSubclass", 0);
  15. objc_registerClassPair(ForbiddenSubclass);
  16. ShouldFail([ForbiddenSubclass alloc]);
  17. }